sf-apex
Generates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
Security Assessment
About sf-apex
sf-apex is a Salesforce Apex code-generation and code-review skill. It helps write production-grade Apex — service classes, selectors, triggers, batch/queueable/schedulable jobs, invocable methods, and test classes — and reviews existing .cls/.trigger code against a 150-point rubric spread across eight categories (bulkification, security, testing, architecture, error handling, naming, performance, and code quality). The problem it targets is that hand-written Apex frequently hits governor limits, skips CRUD/FLS enforcement, or ships tests without assertions; the skill enforces guardrails to catch those before handoff.
Its workflow first gathers context (class type, target objects, whether code is net-new or a refactor), inspects the existing project for trigger frameworks and service/selector conventions, then generates the smallest correct pattern and scores it. It ships a template library (service, selector, batch, queueable, trigger, invocable, test-data-factory), a set of reference guides (anti-patterns, bulkification, security, testing, design patterns, SOLID, naming), and Python hook scripts that run local validation such as Apex LSP checks and Prettier formatting. Guardrails explicitly block SOQL/DML in loops, hardcoded IDs, empty catch blocks, string-built SOQL with user input, and missing sharing declarations, steering toward bind variables, WITH USER_MODE, and with-sharing defaults.
Target users are Salesforce developers, architects, and reviewers who want consistent, secure, testable Apex aligned with community best practices. The skill is security-conscious by design — much of its content is about preventing SOQL injection and enforcing field-level security — and its bundled scripts perform read-only validation and formatting rather than any destructive or network operations.
FAQ
What kinds of Apex can it generate?
Service and selector classes, triggers using the Trigger Actions Framework, batch, queueable and schedulable jobs, invocable methods, and matching test classes with test-data factories.
How does the 150-point scoring work?
Code is evaluated across eight categories — bulkification, security, testing, architecture, error handling, naming, performance, and code quality — with thresholds that flag or block code scoring below 60.
When should I NOT use it?
For LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only work (use sf-soql), or non-Salesforce code. It also hands off deploy and test-execution loops to sibling skills.
How is it installed?
Via the skills CLI, e.g. npx skills add Jaganpro/sf-skills, optionally scoped to just the sf-apex skill.
Does it help with security?
Yes. It explicitly blocks SOQL injection patterns, enforces CRUD/FLS checks and sharing models, and steers toward bind variables and WITH USER_MODE.
All Files
37 filesInstall sf-apex
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
jaganpro/sf-skills