▶ Watch on YouTube — Full Build and Demo
AI code generation for Salesforce has always had one big problem: the output breaks governor limits, fails Code Analyzer, skips test coverage, and misses the with sharing keyword. Salesforce Skills for Claude Code fix all of that. They're specialized AI capabilities embedded directly into Claude Code that understand Salesforce architecture, governor limits, and deployment requirements — and generate code that's actually ready to deploy.
What Are Salesforce Skills?
Salesforce Skills are specialized AI capabilities that understand Salesforce architecture, governor limits, security patterns, and deployment requirements. Think of them as expert developers embedded directly into your development workflow.
When you ask Claude Code to create something, Skills don't just generate generic code. Behind the scenes, the relevant skill discovers your project conventions and generates production-grade code with proper error handling and governor-safe queries. It enforces guardrails like preventing SOQL in loops and validates bulkification patterns. It creates test classes with 75%+ coverage using TestDataFactory patterns. And before marking the task complete, it runs Salesforce Code Analyzer and executes your test suites automatically.
Installing Salesforce Skills
Setting up Salesforce Skills takes a single command in your Salesforce project directory:
The interactive installer lets you select individual skills with the spacebar. You can install at project scope (committed with your project) or global scope (available across all your projects). Installed skills are tracked in skills-lock.json in your project root.
The Four Skills You'll Use Most
How Skills Work Under the Hood
When you submit a prompt to Claude Code, the system follows a four-stage workflow:
- Skill matching — Claude analyses your prompt and activates the relevant skills. "Lightning Web Component" triggers
generating-lwc-components, "Apex class" triggersgenerating-apex, "test class" triggersgenerating-apex-test. - Skill execution — each skill discovers your project conventions including naming patterns and existing classes, chooses the correct architecture pattern (Service, Controller, Batch, etc.), and generates code with built-in guardrails — enforcing
with sharing, rejecting SOQL in loops, and creating required metadata files. - Guardrail enforcement — Skills reject code that violates best practices automatically. They won't complete without test classes. For LWC, they validate pattern formatting on both client and server sides. Every generated class includes its
.cls-meta.xmlfile. - Validation — before reporting success, Skills run
sf code-analyzerto catch security violations, executesf apex run testto verify functionality, and confirm 75%+ coverage is achieved.
Example: Building a Case Escalation Component
Here's an example of the kind of prompt that produces fully deployment-ready code in a single pass. This is similar to the case escalation build in the SF Bolt video above:
Submitting a prompt like this causes Claude Code to automatically activate the right skills, discover your project patterns, and generate all required files in one pass:
caseEscalation.html— LWC templatecaseEscalation.js— component logic with imperative Apex callscaseEscalation.js-meta.xml— metadata for App Builder exposureCaseEscalationController.cls— Apex controller with error handlingCaseEscalationController.cls-meta.xml— Apex metadataCaseEscalationControllerTest.cls— test class with bulk testing for 251+ recordsCaseEscalationControllerTest.cls-meta.xml— test metadata
Advanced Patterns Skills Can Handle
Skills handle complex scenarios well beyond a basic CRUD component:
| Pattern | What to ask for | What Skills generate |
|---|---|---|
| Batch jobs | "Create a batch Apex class to archive Cases older than two years" | Database.Stateful, governor-safe queries, start/execute/finish methods, test class with 251+ record bulk testing |
| Service layer | "Create an AccountService class using the Service-Selector-Domain pattern" | AccountService.cls with sharing, AccountSelector.cls for queries, List<Database.SaveResult> for partial success, TestDataFactory test class |
| Screen flows | "Create a screen flow for lead qualification with decision routing" | Flow metadata following Salesforce best practices with decision elements and queue assignments |
| Debug analysis | "Analyse Apex logs in debug.log to find governor limit issues" | SOQL/DML violation report, CPU time and heap analysis, specific optimisation suggestions |
Best Practices for Prompting Skills
The quality of your output improves significantly with more specific prompts:
- Include field API names — instead of "save account data", say "save Account Name, Phone, and BillingCity fields"
- Name the architecture explicitly — "using Service-Selector-Domain pattern" or "as a Queueable with Finalizer"
- Specify coverage targets — "test class with 90%+ coverage" gives Skills a goal to hit, not just the 75% default
- Be conversational — if the first pass isn't right, just say "Add bulk error handling" or "Change the test class to use TestDataFactory patterns". Skills maintain context.
Skills as a Learning Tool
The official blog makes an interesting observation: even experienced developers can use Skills to discover best practices. The generated test classes show the correct Given/When/Then structure, the Apex classes show which Code Analyzer flags matter most for security and performance, and batch jobs show the correct use of Database.Stateful. Skills aren't just automation — they're a teaching tool built from Salesforce's own best practice library.
Key Takeaways
- Install:
npx skills forcedotcom/sf-skillsfrom your Salesforce DX project directory - Install all 60+ skills at once with the
--allflag - Skills activate automatically based on your prompt keywords — no manual configuration
- Guardrails enforced automatically:
with sharingon all classes, no SOQL in loops, required metadata files generated - Code Analyzer and Apex tests run automatically before Skills report success
- Test coverage target: 75%+ by default, specify higher in your prompt
- Skills are open source — fork and customise for your team's naming conventions
- Skills are NOT an npm package —
npx skillsinstalls from GitHub - Always review generated code and test in sandbox before production deploy
If you've been using Claude Code or GitHub Copilot for Salesforce development and spending half your time fixing governor limit violations and writing test classes manually, Salesforce Skills are worth trying this week. One prompt. Production-ready code. Zero Code Analyzer violations.
📄 Sources: Build Production-Ready Apps in Claude Code with Salesforce Skills — Salesforce Developer Blog | forcedotcom/sf-skills — Official GitHub Repository | Agent Skills Specification — agentskills.io
0 Comments