sf-apex

sf-apex is a skill for Claude Code from Clientell-Ai/salesforce-skills. It costs 87 tokens per session (1,735 once invoked), scanned A, original, Apache-2.0.

A guide for writing and reviewing Apex, Salesforce’s programming language for custom business logic.

In plain words
What is it for?
Use it when creating or reviewing Apex classes, triggers, batch jobs, or queueable jobs.
Why use it?
It helps avoid Salesforce limits, inefficient database work, and code that ignores users’ data permissions.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions Claude Code.

Good fit Use it when creating or reviewing Apex classes, triggers, batch jobs, or queueable jobs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/clientell-ai/salesforce-skills/sf-apex
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Clientell-Ai/salesforce-skills --skill sf-apex
Clone the repo
git clone --depth 1 https://github.com/Clientell-Ai/salesforce-skills

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sf-apex

README.md
[![agentmods](https://agentmods.dev/badge/skills/clientell-ai/salesforce-skills/sf-apex/github.svg)](https://agentmods.dev/skills/clientell-ai/salesforce-skills/sf-apex)
Your own site
<a href="https://agentmods.dev/skills/clientell-ai/salesforce-skills/sf-apex"><img src="https://agentmods.dev/badge/skills/clientell-ai/salesforce-skills/sf-apex/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sf-apex

Your own site · 80×15
<a href="https://agentmods.dev/skills/clientell-ai/salesforce-skills/sf-apex"><img src="https://agentmods.dev/badge/skills/clientell-ai/salesforce-skills/sf-apex.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,735 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00087 $0.01735
Opus 5 $0.00044 $0.00868
Sonnet 5 $0.00017 $0.00347
Haiku 4.5 $0.00009 $0.00173

Measured 12d ago against content hash 8153a5336546, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

sf-apex scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/sf-apex/SKILL.md · 162 lines

How it starts

The opening of the file, as written. The whole thing — 162 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Apex Code Generator & Reviewer

You are a Salesforce Apex specialist. Generate production-ready Apex code following all Salesforce best practices.

Code Generation Rules

Governor Limits Awareness

  • NEVER put SOQL queries inside loops — bulkify by querying before the loop
  • NEVER put DML statements inside loops — collect records in a List, then perform DML once
  • Use Limits.getQueries() and Limits.getLimitQueries() for monitoring
  • Prefer Database.query() with bind variables over hardcoded SOQL strings
  • Use System.Queueable or Database.Batchable for large data operations

Security (CRUD/FLS)

  • Always use WITH USER_MODE in SOQL queries
  • Use Security.stripInaccessible(AccessType.READABLE, records) before returning data
  • Use Security.stripInaccessible(AccessType.CREATABLE, records) before insert
  • Use Security.stripInaccessible(AccessType.UPDATABLE, records) before update
  • Always declare classes with with sharing unless there's an explicit reason not to
  • NEVER use string concatenation for dynamic SOQL — use bind variables

Bulkification Patterns

  • All code must handle 200+ records per transaction (trigger batch size)
  • Use Map<Id, SObject> for efficient lookups
  • Use Set<Id> to collect unique IDs before querying related records
  • Use Trigger.newMap and Trigger.oldMap for efficient field change detection

Trigger Pattern

  • One trigger per object, maximum
  • Trigger contains NO logic — delegates to a handler class
  • Handler class implements the logic with proper bulkification
// Trigger
trigger AccountTrigger on Account (before insert, before update, after insert, after update) {
    AccountTriggerHandler handler = new AccountTriggerHandler();
    handler.run();
}

// Handler
public with sharing class AccountTriggerHandler extends TriggerHandler {
    public override void beforeInsert() {
        // logic here
    }
}

Naming Conventions

  • Classes: PascalCase (e.g., AccountService, OpportunityTriggerHandler)
  • Methods: camelCase (e.g., getAccountsByIds, calculateDiscount)
  • Variables: camelCase (e.g., accountList, totalAmount)
  • Constants: UPPER_SNAKE_CASE (e.g., MAX_RETRY_COUNT, DEFAULT_PAGE_SIZE)
  • Test classes: ClassNameTest (e.g., AccountServiceTest)

Read the full file on GitHub · 162 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 162 lines · 87 tokens per session scan A 8153a5336546

Subscribe to this mod's changes

sf-apex is a skill published in the GitHub repository Clientell-Ai/salesforce-skills (15 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 87 tokens to every session and 1,735 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

sdd-apply

Skill "sdd-apply" from Gentleman-Programming/gentle-ai, covering execution role, language domain contract, purpose, what you receive and execution and persistence contract.

Gentleman-Programming/gentle-ai · 0 tokens

backend-api

Builds server-side endpoints and data access: REST or GraphQL routes, input validation, auth flows, queries, and error contracts, contract-first and framework-agnostic. Use when adding an endpoint or API surface, wiring login, session, token, or permission logic, or writing server-side business logic that persists…

Ozzeron/prompt-pack · 89 tokens

analyze-codebase-for-mcp

Analyze an arbitrary codebase to identify functions, APIs, and data sources suitable for exposure as MCP tools, producing a tool specification document. Use when planning an MCP server for an existing project, auditing a codebase before wrapping it as an AI-accessible tool surface, comparing what a codebase can do…

KunanonJ/ai-skills-hub · 90 tokens

agent-java-reviewer

Expert Java code reviewer for Spring Boot and Quarkus projects. Automatically detects the framework and applies the appropriate review rules. Covers layered architecture, JPA/Panache, MongoDB, security, and concurrency. MUST BE USED for all Java code changes.

KunanonJ/ai-skills-hub · 56 tokens

agent-django-build-resolver

Django/Python build, migration, and dependency error resolution specialist. Fixes pip/Poetry errors, migration conflicts, import errors, Django configuration issues, and collectstatic failures with minimal changes. Use when Django setup or startup fails.

KunanonJ/ai-skills-hub · 55 tokens

agent-django-reviewer

Expert Django code reviewer specializing in ORM correctness, DRF patterns, migration safety, security misconfigurations, and production-grade Django practices. Use for all Django code changes. MUST BE USED for Django projects.

KunanonJ/ai-skills-hub · 47 tokens