Generates and reviews Salesforce Apex code with 2025 best practices and 150-point scoring. Build production-ready, secure, and maintainable Apex.
- Code Generation: Create Apex classes, triggers (TAF), tests, batch jobs, queueables from requirements
- Code Review: Analyze existing Apex for best practices violations with actionable fixes
- 150-Point Scoring: Automated validation across 8 categories
- Template Library: Pre-built patterns for common class types
- LSP Integration: Real-time syntax validation via Apex Language Server
# Install as part of sf-skills
claude /plugin install github:Jaganpro/sf-skills
# Or install standalone
claude /plugin install github:Jaganpro/sf-skills/sf-apexSkill: sf-apex
Request: "Create an AccountService class with CRUD methods"
The skill will ask about:
- Class type (Service, Selector, Trigger, Batch, etc.)
- Primary purpose
- Target object(s)
- Test requirements
The skill generates:
- Main class with ApexDoc comments
- Corresponding test class with 90%+ coverage patterns
- Proper naming following conventions
| Category | Points | Focus |
|---|---|---|
| Bulkification | 25 | No SOQL/DML in loops, collection patterns |
| Security | 25 | CRUD/FLS checks, no injection, SOQL injection prevention |
| Testing | 25 | Test coverage, assertions, negative tests |
| Architecture | 20 | SOLID principles, separation of concerns |
| Error Handling | 15 | Try-catch, custom exceptions, logging |
| Naming | 15 | Consistent naming, ApexDoc comments |
| Performance | 15 | Async patterns, efficient queries |
| Code Quality | 10 | Clean code, no hardcoding |
Thresholds: 90+ | 80-89 | 70-79 | Block: <60
| Template | Use Case |
|---|---|
trigger.trigger |
Trigger with TAF pattern |
trigger-action.cls |
Trigger Actions Framework handler |
service.cls |
Business logic service class |
selector.cls |
SOQL selector pattern |
batch.cls |
Batch Apex job |
queueable.cls |
Queueable async job |
test-class.cls |
Test class with data factory |
| Related Skill | When to Use |
|---|---|
| sf-flow | Create Flow to call @InvocableMethod |
| sf-lwc | Create LWC to call @AuraEnabled controllers |
| sf-testing | Run tests and analyze coverage |
| sf-deploy | Deploy Apex to org |
- sf CLI v2
- Target Salesforce org
- Java 11+ (for Apex LSP validation)
MIT License. See LICENSE file. Copyright (c) 2024-2025 Jag Valaiyapathy