Step-by-Step: Create Your Own Salesforce AI Assistants using Claude Code & Salesforce DX MCP

September 12, 2025 (3d ago)

Step-by-Step: Create Your Own Salesforce AI Assistants using Claude Code & Salesforce DX MCP

Reading Time: 12 minutes | Difficulty: Intermediate

In this blog, I demonstrated how to transform Claude into your personal Salesforce implementation team. Not theoretical concepts, but actual working AI assistants that can write validation rules, create triggers with test classes, and deploy directly to your org. This companion guide provides all the prompts, code examples, and troubleshooting tips from the session.

Special Thanks: I want to thank Amit and the entire ApexHours.com team for giving me this incredible opportunity to share these tools with the Salesforce community. ApexHours has been such a cornerstone resource for Salesforce professionals, and I’m honored to contribute to their mission of knowledge sharing.

Video Tutorial: Watch on ApexHours Step-by-Step: Create Your Own Salesforce AI Assistants Using Claude Code & Salesforce DX MCP

Note: This blog post is a companion guide to ‘Step-by-Step: Create Your Own Salesforce AI Assistants using Claude Code & Salesforce DX MCP’ on ApexHours. While the video shows the complete demonstration, this post provides copy-paste ready prompts and commands you can use immediately. While I’m using IntelliJ in my demonstrations, these agent creation steps work identically across all IDEs and editors – VS Code, Cline, Windsurf, Cursor, and others. Since Claude Code operates at the terminal level, the agent configuration and functionality remain the same regardless of your IDE choice.

What We’ll Cover

Table of Contents

  1. Setup Claude Code and Salesforce DX MCP
  2. Creating Your AI Assistants
  3. Real-World Use Cases
  4. Final Thoughts
  5. Common Questions and Troubleshooting
  6. Resources and Next Steps

Setup Claude Code and Salesforce DX MCP

Before we dive into creating AI assistants, you’ll need to have Claude Code and Salesforce DX MCP properly configured. I’ve created a comprehensive setup guide that covers all the installation and configuration steps.

Complete Setup Guide: Setting up Salesforce DX MCP with Claude Code

This guide includes:

Important: During the session, we’ll reference this setup guide to ensure everyone can follow along with the demonstrations.

Creating Your AI Assistants

Prerequisites

Before creating your AI assistants, ensure you have:

If you need help with setup, follow my detailed setup guide.

Creating the Salesforce Admin Agent

Step-by-Step Agent Creation in Claude Code

These steps are performed within the Claude Code interface (claude.ai/code):

  1. Navigate to Agents: In Claude Code, go to /agentsCreate New AgentProjectGenerate with Claude
  2. Agent Configuration Prompt: In the prompt field, paste this exact configuration:
	You are an expert Salesforce Administrator specializing in declarative development and org configuration. You have deep knowledge of Salesforce best practices, security model, and governance. 
	
	Your expertise includes:
	- Validation rules, workflow rules, and process automation
	- Custom objects, fields, and relationships  
	- Approval processes and email alerts
	- Permission sets and field-level security
	- Reports, dashboards, and list views
	- Data management and imports
	
	You have access to Salesforce DX MCP tools and should use them to:
	- Query org metadata and data
	- Create and modify declarative configurations
	- Deploy changes directly to the org
	- Validate changes before deployment
	
	IMPORTANT: You focus exclusively on declarative, point-and-click solutions. You do NOT write Apex code, triggers, or Lightning components - those are handled by the developer agent.
	
	Always follow Salesforce best practices:
	- Use proper naming conventions (API names, labels)
	- Consider bulk operations and performance
	- Implement proper security and sharing
	- Document your changes clearly
	- Test in sandbox before production
	
	When given a task, you should:
	1. Understand the business requirement
	2. Propose the declarative solution
	3. Implement using Salesforce DX commands
	4. Verify the deployment
	5. Provide clear documentation

  1. Model Selection: Click Continue → Select Sonnet → Choose Automatic Color (or your choice)

This creates a specialized assistant that only focuses on declarative Salesforce administration – no code, just point-and-click solutions.

Creating the Salesforce Developer Agent

Step-by-Step Agent Creation in Claude Code

These steps are performed within the Claude Code interface (claude.ai/code):

  1. Navigate to Agents: In Claude Code, go to /agentsCreate New AgentProjectGenerate with Claude
  2. Agent Configuration Prompt: In the prompt field, paste this exact configuration:
	You are an expert Salesforce Developer with 10+ years of experience in Apex, Lightning, and integrations. You write clean, efficient, and well-tested code following Salesforce best practices.
	
	Your expertise includes:
	- Apex triggers, classes, and batch processes
	- Lightning Web Components and Aura
	- REST/SOAP APIs and integrations
	- Comprehensive test classes with high coverage
	- Asynchronous processing and queueables
	- Governor limits optimization
	
	You have access to Salesforce DX MCP tools and should use them to:
	- Generate Apex code and test classes
	- Deploy code to the org
	- Run tests and verify coverage
	- Query and analyze existing code
	
	IMPORTANT: You focus exclusively on programmatic solutions. Declarative tasks are handled by the admin agent.
	
	Code standards you follow:
	- Bulkified triggers and operations
	- Proper error handling and logging
	- Meaningful variable and method names
	- Comprehensive test coverage (minimum 85%)
	- Security enforced SOQL queries
	- Comments for complex logic
	
	When given a development task:
	1. Analyze requirements and impacts
	2. Write clean, optimized code
	3. Create comprehensive test classes
	4. Deploy and verify functionality
	5. Provide deployment documentation

  1. Model Selection: Click Continue → Select Sonnet → Choose Automatic Color (or your choice)

This creates a specialized assistant that focuses on Salesforce development patterns – triggers, components, and clean code practices.

Real-World Use Cases

Use Case 1: Creating a Validation Rule (Admin Agent)

In my test, I asked the admin agent to create a validation rule with specific business logic:

Prompt:

Create a validation rule on Opportunity that prevents saving when Stage is "Closed Won", Amount is greater than $50,000, and Description field is blank. Error message should say "High-value opportunities require a description before closing"

Result: In my test, the agent created a validation rule with proper AND logic combining all three conditions – checking the Stage picklist value, Amount threshold, and blank Description field. It deployed the rule to my org in about 30 seconds. When I tested it by creating an Opportunity that violated these conditions, the validation fired exactly as expected with the correct error message.

Use Case 2: Creating a Trigger with Test Class (Developer Agent)

For the developer agent, I requested a trigger with proper architecture:

Prompt:

Create an Opportunity trigger that automatically creates a follow-up Task when an Opportunity is changed to Stage = "Closed Won". Task should have Subject "Follow-up with [Account Name] - Closed Won", Due Date 5 days from today, assigned to Opportunity Owner. Use handler pattern and include test class.

Result: In my test, the agent created a complete solution with three components:

The entire process took about 2 minutes. The agent deployed everything with 95% code coverage. When I updated an Opportunity to “Closed Won” in Salesforce, the follow-up task appeared automatically with the correct subject and due date. The trigger properly ignored other stage changes, just as specified.

Use Case 3: Querying Org Data

Example Queries:

Show me all Opportunities over $100K closed this quarter
List all Accounts without opportunities
Find all Users who haven't logged in for the past 60 days

Result: In my test, the agents automatically understand the context and write the appropriate SOQL queries, returning results immediately and saving time on manual query writing.

Final Thoughts

These Salesforce AI assistants show real promise for improving productivity. It’s not about replacing developer or admin skills – it’s about automating the repetitive parts so you can focus on solving complex business problems. The time saved on routine configurations and boilerplate code could be redirected to architecture discussions, requirements analysis, and working with stakeholders.

During my exploration with these agents, I found them particularly valuable for common Salesforce tasks – creating validation rules, writing trigger patterns, generating test classes. They handle the mechanical execution while I focus on the strategic decisions.

Remember, this is a tool to augment your capabilities, not replace your expertise. You still need to understand Salesforce best practices, security models, and your organization’s specific requirements. But for those routine tasks we all do dozens of times a week, having AI assistants that understand Salesforce could make a real difference.

The technology is here, it works, and it’s practical. Start small, test in sandboxes, and gradually expand usage as you build confidence. The productivity gains are real and immediate.

Common Questions and Troubleshooting

Q: Can these agents work in production orgs?

In my test environments, yes, but I always recommend:

Q: What if the agent creates incorrect code?

This happens occasionally. In my experience:

Q: How do I handle governor limits?

The developer agent understands governor limits. When I tested bulk operations, it automatically:

Q: Can agents see my org’s existing customizations?

Yes! Both agents can query your org’s metadata. They understand your custom objects, fields, and existing code. This context helps them create compatible solutions.

Resources and Next Steps

Get Started Today

  1. Set up Claude Code and MCP: Follow my setup guide
  2. Copy the agent prompts: Use the exact prompts from this post
  3. Start with simple tasks: Try creating a custom field or simple validation rule
  4. Build confidence: Move to more complex tasks as you get comfortable

Additional Resources

Follow Me for More Insights

YouTube | LinkedIn | X | Newsletter | GitHub

SalesforceAI #ClaudeCode #SalesforceDXMCP #SalesforceDX #MCP #SalesforceAdmin #SalesforceDeveloper #AIAgents #ApexDevelopment #SalesforceAutomation #ValidationRules #ApexTriggers #SalesforceProductivity #AIAssistants #SalesforceTools #DevOps #SalesforceBestPractices #CloudDevelopment #TechTutorial #AIWorkflow

Subscribe to my newsletter