Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jaganpro avatar

Sf Apex

  • 1.5k installs
  • 423 repo stars
  • Updated April 27, 2026
  • jaganpro/sf-skills

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/

About

The sf apex skill 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. Documentation covers workflows, commands, and guardrails agents should follow when users invoke this capability. Key documented areas include Apex class generation or refactoring; trigger design and trigger-framework decisions; `@InvocableMethod`, Queueable, Batch, Schedulable, or test-class work; review of bulkification, sharing, security, testing, or maintainability. Use when developers or agents need structured guidance for sf apex tasks with evidence grounded in the bundled SKILL.md rather than generic advice. Apex class generation or refactoring trigger design and trigger-framework decisions `@InvocableMethod`, Queueable, Batch, Schedulable, or test-class work review of bulkification, sharing, security, testing, or maintainability editing LWC JavaScript / HTML / CSS → [sf-lwc](../sf-lwc/SKILL.md) building Flow XML or.

  • Apex class generation or refactoring
  • trigger design and trigger-framework decisions
  • `@InvocableMethod`, Queueable, Batch, Schedulable, or test-class work
  • review of bulkification, sharing, security, testing, or maintainability
  • editing LWC JavaScript / HTML / CSS → [sf-lwc](../sf-lwc/SKILL.md)

Sf Apex by the numbers

  • 1,514 all-time installs (skills.sh)
  • +6 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #324 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
At a glance

sf-apex capabilities & compatibility

Capabilities
apex class generation or refactoring · trigger design and trigger framework decisions · `@invocablemethod`, queueable, batch, schedulabl · review of bulkification, sharing, security, test · editing lwc javascript / html / css → [sf lwc](.
npx skills add https://github.com/jaganpro/sf-skills --skill sf-apex

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.5k
repo stars423
Security audit3 / 3 scanners passed
Last updatedApril 27, 2026
Repositoryjaganpro/sf-skills

How do I handle sf apex tasks with agent guidance?

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/

Who is it for?

Teams needing documented sf apex workflows.

Skip if: Developers working only on LWC JavaScript, Flow XML, SOQL-only queries, or non-Salesforce backend codebases.

When should I use this skill?

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/

What you get

Structured workflow from sf apex documentation applied to the user request.

  • Reviewed or generated Apex classes, triggers, and async jobs
  • Test classes with rubric-scored quality feedback

By the numbers

  • MIT-licensed sf-apex metadata version 1.1.0
  • Uses 150-point scoring across 8 Apex review categories

Files

SKILL.mdMarkdownGitHub ↗

sf-apex: Salesforce Apex Code Generation and Review

Use this skill when the user needs production Apex: new classes, triggers, selectors, services, async jobs, invocable methods, test classes, or evidence-based review of existing .cls / .trigger code.

When This Skill Owns the Task

Use sf-apex when the work involves:

  • Apex class generation or refactoring
  • trigger design and trigger-framework decisions
  • @InvocableMethod, Queueable, Batch, Schedulable, or test-class work
  • review of bulkification, sharing, security, testing, or maintainability

Delegate elsewhere when the user is:

  • editing LWC JavaScript / HTML / CSS → sf-lwc
  • building Flow XML or Flow orchestration → sf-flow
  • writing SOQL only → sf-soql
  • deploying or validating metadata to orgs → sf-deploy

---

Required Context to Gather First

Ask for or infer:

  • class type: trigger, service, selector, batch, queueable, schedulable, invocable, test
  • target object(s) and business goal
  • whether code is net-new, refactor, or fix
  • org / API constraints if known
  • expected test coverage or deployment target

Before authoring, inspect the project shape:

  • existing classes / triggers
  • current trigger framework or handler pattern
  • related tests, flows, and selectors
  • whether TAF is already in use

---

Recommended Workflow

1. Discover local architecture

Check for:

  • existing trigger handlers / frameworks
  • service-selector-domain conventions
  • related tests and data factories
  • invocable or async patterns already used in the repo

2. Choose the smallest correct pattern

NeedPreferred pattern
simple reusable logicservice class
query-heavy data accessselector
single object trigger behaviorone trigger + handler / TAF action
Flow needs complex logic@InvocableMethod
background processingQueueable by default
very large datasetsBatch Apex or Database.Cursor patterns
repeatable verificationdedicated test class + test data factory

3. Author with guardrails

Generate code that is:

  • bulk-safe
  • sharing-aware
  • CRUD/FLS-safe where applicable
  • testable in isolation
  • consistent with project naming and layering

4. Validate and score

Evaluate against the 150-point rubric before handoff.

5. Hand off deploy/test next steps

When org validation is needed, hand off to:

  • sf-testing for test execution loops
  • sf-deploy for deploy / dry-run / verification

---

Generation Guardrails

Never generate these without explicitly stopping and explaining the problem:

Anti-patternWhy it blocks
SOQL in loopsgovernor-limit failure
DML in loopsgovernor-limit failure
missing sharing modelsecurity / data exposure risk
hardcoded IDsdeployment and portability failure
empty catch blockssilent failure / poor observability
string-built SOQL with user inputinjection risk
tests without assertionsfalse-positive test suite

Default fix direction:

  • query once, operate on collections
  • use with sharing unless justified otherwise
  • use bind variables and WITH USER_MODE where appropriate
  • create assertions for positive, negative, and bulk cases

See references/anti-patterns.md and references/security-guide.md.

---

High-Signal Build Rules

Trigger architecture

  • Prefer one trigger per object.
  • If TAF is already installed and used, extend it instead of inventing a second trigger pattern.
  • Triggers should delegate logic; avoid heavy business logic directly in trigger bodies.

Async choice

ScenarioDefault
standard async workQueueable
very large record processingBatch Apex
recurring scheduleScheduled Flow or Schedulable
post-job cleanupFinalizer
long-running Lightning calloutsContinuation

Testing minimums

Use the PNB pattern for every feature:

  • Positive path
  • Negative / error path
  • Bulk path (251+ records where relevant)

Modern Apex expectations

Prefer current idioms when available:

  • safe navigation: obj?.Field__c
  • null coalescing: value ?? fallback
  • Assert.* over legacy assertion style
  • WITH USER_MODE and explicit security handling where relevant

---

Output Format

When finishing, report in this order: 1. What was created or reviewed 2. Files changed 3. Key design decisions 4. Risk / guardrail notes 5. Test guidance 6. Deployment guidance

Suggested shape:

Apex work: <summary>
Files: <paths>
Design: <pattern / framework choices>
Risks: <security, bulkification, async, dependency notes>
Tests: <what to run / add>
Deploy: <dry-run or next step>

---

LSP Validation Note

This skill supports an LSP-assisted authoring loop for .cls and .trigger files:

  • syntax issues can be detected immediately after write/edit
  • the skill can auto-fix common syntax errors in a short loop
  • semantic quality still depends on the 150-point review rubric

Full guide: references/troubleshooting.md

---

Cross-Skill Integration

NeedDelegate toReason
describe objects / fields firstsf-metadataavoid coding against wrong schema
seed bulk or edge-case datasf-datacreate realistic test datasets
run Apex tests / fix failing testssf-testingexecute and iterate on failures
deploy to orgsf-deployvalidation and deployment orchestration
build Flow that calls Apexsf-flowdeclarative orchestration
build LWC that calls Apexsf-lwcUI/controller integration

---

Reference Map

Start here

  • references/patterns-deep-dive.md
  • references/security-guide.md
  • references/bulkification-guide.md
  • references/testing-patterns.md

High-signal checklists

  • references/code-review-checklist.md
  • references/anti-patterns.md
  • references/naming-conventions.md

Specialized patterns

  • references/trigger-actions-framework.md
  • references/automation-density-guide.md
  • references/flow-integration.md
  • references/triangle-pattern.md
  • references/design-patterns.md
  • references/solid-principles.md

Troubleshooting / validation

  • references/troubleshooting.md
  • references/llm-anti-patterns.md
  • references/testing-guide.md

---

Score Guide

ScoreMeaning
120+strong production-ready Apex
90–119good implementation, review before deploy
67–89acceptable but needs improvement
< 67block deployment

Related skills

Forks & variants (1)

Sf Apex has 1 known copy in the catalog totaling 34 installs. They canonicalize to this original listing.

How it compares

Pick sf-apex for scored Apex authoring when Flow or LWC skills do not cover server-side logic.

FAQ

What does sf apex do?

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/

When should I invoke 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/

What are key capabilities?

Apex class generation or refactoring

Is Sf Apex safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.