Agent skill

Sf Apex

by Jaganpro in Jaganpro/sf-skills

Generates and reviews Salesforce Apex code with 150-point scoring.

MITAuto-check passedSales & Support

Install Sf Apex

skills CLI
$ npx skills add Jaganpro/sf-skills --skill sf-apex -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Jaganpro/sf-skills sf-apex --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Jaganpro/sf-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/sf-apex .claude/skills/sf-apex && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sf-apex
GitHub stars
424
Token cost
~2k tokens
SKILL.md length
703 words
Files
38 (incl. references, assets)
Skills in repo
36
Repo updated
First seen
Licence
MIT

At a glance

Generates and reviews Salesforce Apex code with 150-point scoring.

  • Works in 5 steps: Discover local architecture → Choose the smallest correct pattern → Author with guardrails → …
  • Fixes Apex classes
  • SKILL.md covers When This Skill Owns the Task, Required Context to Gather First, Recommended Workflow and Generation Guardrails, plus 6 more sections
  • Runs Python scripts from its folder

What it does

Sf Apex is an agent skill from 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/.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.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 40 other files, including reference files and assets (for example `CREDITS.md`, `README.md` and `hooks/scripts/apex-lsp-validate.py`).

It sits in Sales & Support, covering CRM management. It works with Salesforce and JavaScript. The repository describes itself as: [ARCHIVED — migrated to forcedotcom/afv-library] Salesforce Skills for Agentic Coding Tools — Apex, Flow, LWC, SOQL, Agentforce, Data Cloud, OmniStudio. Read-only archive; active… The licence is MIT.

When your agent uses it

  • Fixes Apex classes
  • Batch/queueable/schedulable jobs
  • Touches .cls/.trigger files
  • : LWC JavaScript (use sf-lwc)

Example prompts

  • “Use the sf-apex skill to generate and reviews Salesforce Apex code with 150-point scoring”
  • “/sf-apex”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Discover local architecture
  2. Choose the smallest correct pattern
  3. Author with guardrails
  4. Validate and score
  5. Hand off deploy/test next steps

What it can do on your machine

Read from SKILL.md and the folder at commit 53c9956. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python, from the files we listed), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sf Apex loads about 2k tokens when it runs, and up to ~75k if it reads all its reference files. Until then it costs about 89 tokens; SKILL.md has 703 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~89
When it runs · the whole SKILL.md, loaded when a task matches
~2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~75k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Jaganpro/sf-skills at commit 53c9956, republished under its MIT licence (© Jaganpro). 703 words, ~1,988 tokens.

Download SKILL.mdSave it as .claude/skills/sf-apex/SKILL.md (or your agent's skills folder). This skill also uses 37 other files; get the full folder from GitHub.
name
sf-apex
description
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.
license
MIT
metadata.version
1.1.0
metadata.author
Jag Valaiyapathy
metadata.scoring
150 points across 8 categories

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

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:


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.
Show full SKILL.md (264 more words)Show less
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:

text
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
High-signal checklists
Specialized patterns
Troubleshooting / validation

Score Guide

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

© Jaganpro, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 37 other files (references, assets) in skills/sf-apex of Jaganpro/sf-skills.

  • SKILL.md
  • CREDITS.md
  • README.md
  • assets/apex-class.cls
  • assets/batch.cls
  • assets/invocable-method.cls
  • assets/queueable.cls
  • assets/selector.cls
  • assets/service.cls
  • assets/test-class.cls
  • assets/test-data-factory.cls
  • assets/trigger-action.cls
  • assets/trigger.trigger
  • hooks/scripts/apex-lsp-validate.py
  • hooks/scripts/llm_pattern_validator.py
  • hooks/scripts/post-tool-validate.py
  • hooks/scripts/prettier-format.py
  • hooks/scripts/validate_apex.py
  • … and 20 more

Open the folder on GitHubat commit 53c9956

Compare with similar skills

Sf Apex next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sf Apex compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sf Apex this skillJaganpro/sf-skills424—~2kAutomated safety check: PassMIT
Experience UI Bundle Mfa Configureforcedotcom/sf-skills1.1k—~4.8kAutomated safety check: PassApache-2.0
Platform Apex Logs Debugforcedotcom/sf-skills1.1k—~2kAutomated safety check: PassApache-2.0
Experience Lwr Site Generateforcedotcom/sf-skills1.1k—~3.5kAutomated safety check: PassApache-2.0
Experience UI Bundle 2gp Deployforcedotcom/sf-skills1.1k—~5.5kAutomated safety check: PassApache-2.0
Experience UI Bundle Site Generateforcedotcom/sf-skills1.1k—~3.1kAutomated safety check: PassApache-2.0

Similar skills

  • Configure Multi-Factor Authentication (MFA) for Salesforce Experience Site users.

    1.1k GitHub stars~4.8k tokensUpdated today
    Sales & SupportAuto-check passed
  • Platform Apex Logs Debug

    forcedotcom/sf-skills

    Salesforce debug log analysis and troubleshooting with 100-point scoring.

    1.1k GitHub stars~2k tokensUpdated today
    Sales & SupportAuto-check passed
  • Experience Lwr Site Generate

    forcedotcom/sf-skills

    Creates, modifies, or manages Salesforce Experience Cloud LWR sites via DigitalExperience metadata.

    1.1k GitHub stars~3.5k tokensUpdated today
    Sales & SupportAuto-check passed
  • Experience UI Bundle 2gp Deploy

    forcedotcom/sf-skills

    MUST activate when the user wants to package, distribute, or install/upgrade/uninstall/promote a UI Bundle as a Salesforce second-generation (2GP) package (project may contain uiBundles/ or…

    1.1k GitHub stars~5.5k tokensUpdated today
    Sales & SupportAuto-check passed
  • MUST activate when the project contains a uiBundles//src/ directory and the task involves creating or configuring site infrastructure.

    1.1k GitHub stars~3.1k tokensUpdated today
    Sales & SupportAuto-check passed
  • Custom Apex adapter generation for Salesforce Connect — connects any external REST API to Salesforce as live, queryable External Objects without ETL or copying.

    1.1k GitHub stars~4.9k tokensUpdated today
    Sales & SupportAuto-check passed

More from Jaganpro/sf-skills

All 36 skills in this repo
  • Agentforce session tracing extraction and analysis. An agent skill from Jaganpro/sf-skills.

    424 GitHub stars~1.8k tokensUpdated 5 mo ago
    Auto-check passed
  • Sf AI Agentscript

    Jaganpro/sf-skills

    Agent Script DSL for deterministic Agentforce agents. An agent skill from Jaganpro/sf-skills.

    424 GitHub stars~3.8k tokensUpdated 5 mo ago
    Auto-check passed
  • Sf Datacloud

    Jaganpro/sf-skills

    Salesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows.

    424 GitHub stars~2.7k tokensUpdated 5 mo ago
    Auto-check passed
  • Sf Diagram Mermaid

    Jaganpro/sf-skills

    Salesforce architecture diagrams using Mermaid with ASCII fallback.

    424 GitHub stars~1.4k tokensUpdated 5 mo ago
    Auto-check passed
  • Sf Diagram Nanobananapro

    Jaganpro/sf-skills

    AI-powered image generation for Salesforce visuals via Nano Banana Pro.

    424 GitHub stars~1.6k tokensUpdated 5 mo ago
    Auto-check passed
  • Sf Flow

    Jaganpro/sf-skills

    Creates and validates Salesforce Flows with 110-point scoring.

    424 GitHub stars~1.8k tokensUpdated 5 mo ago
    Auto-check passed

Categories

Questions about Sf Apex

What does Sf Apex do?

Generates and reviews Salesforce Apex code with 150-point scoring. Sf Apex is an agent skill from Jaganpro/sf-skills. Generates and reviews Salesforce Apex code with 150-point scoring.

When should I use Sf Apex?

Sf Apex fits situations like: fixes Apex classes; batch/queueable/schedulable jobs; touches .cls/.trigger files; : LWC JavaScript (use sf-lwc).

How do I install Sf Apex in Claude Code?

Run `npx skills add Jaganpro/sf-skills --skill sf-apex -a claude-code`. Or copy the skill folder (skills/sf-apex in Jaganpro/sf-skills) into .claude/skills/sf-apex in your project. Claude Code loads it when a task matches its description.

How do I install Sf Apex in Codex?

Run `npx skills add Jaganpro/sf-skills --skill sf-apex -a codex`. Or copy the skill folder (skills/sf-apex in Jaganpro/sf-skills) into .agents/skills/sf-apex in your project. Codex loads it when a task matches its description.

Can I use Sf Apex in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Jaganpro/sf-skills --skill sf-apex -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sf-apex, .gemini/skills/sf-apex, .github/skills/sf-apex and .opencode/skills/sf-apex in your project.

What does Sf Apex need to run?

Going by SKILL.md and its folder, Sf Apex needs Python for the scripts in its folder. Our summary lists: Python 3.

Does Sf Apex access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Sf Apex safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sf Apex use?

Sf Apex is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sf Apex use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 73k tokens, read only when the agent opens those files.

What are the alternatives to Sf Apex?

Skills that share tags, products or a category with Sf Apex: Experience UI Bundle Mfa Configure (forcedotcom/sf-skills, 1.1k stars), Platform Apex Logs Debug (forcedotcom/sf-skills, 1.1k stars), Experience Lwr Site Generate (forcedotcom/sf-skills, 1.1k stars) and Experience UI Bundle 2gp Deploy (forcedotcom/sf-skills, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sf Apex?

Jaganpro (a GitHub user) maintains it in Jaganpro/sf-skills, which has 424 GitHub stars. The repository holds 36 skills in this directory. The repository was last updated on April 27, 2026.

Source: Jaganpro/sf-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.