sf-apex

Generates and reviews Salesforce Apex classes, triggers, and tests with 150-point scoring.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-apex-amanpraaj
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sf-apex
Source: https://github.com/amanpraaj/sf-skill-hub/tree/main/skills/salesforce/sf-apex
Command: npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-apex-amanpraaj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing production-quality Apex requires avoiding governor-limit failures, security gaps, and untested code, and this Skill generates and reviews Apex classes, triggers, and test classes against a structured 150-point rubric so defects are caught before deployment. ## Core Features & Use Cases - Apex Code Generation: Create service classes, selectors, triggers using the Trigger Actions Framework, batch jobs, queueables, schedulables, and @InvocableMethod classes from stated requirements. - Evidence-Based Code Review: Score existing .cls and .trigger files across 8 categories including bulkification, security, testing, and architecture, with concrete fixes for anti-patterns like SOQL in loops and missing sharing keywords. - Test Class Authoring: Generate test classes following the Positive/Negative/Bulk pattern with test data factories and 251-record bulk coverage. - Use Case: Ask for an AccountService class with CRUD methods and receive a bulk-safe, sharing-aware class plus a corresponding test class, then hand off to deployment or test-execution workflows. ## Quick Start Ask the agent to create an AccountService Apex class with CRUD methods and a matching test class using the sf-apex skill.

Frequently Asked Questions about sf-apex

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a bulk-safe Apex trigger with a handler framework?▼

Request a trigger for your target object and the skill generates one trigger per object delegating to a handler, extending the Trigger Actions Framework if it is already installed. Logic is placed in action classes rather than the trigger body to keep execution ordered and testable.

How do I review existing Apex code for governor limit violations?▼

Provide the .cls or .trigger files and the skill scores them against a 150-point rubric across 8 categories including bulkification, security, and testing. It flags critical anti-patterns like SOQL or DML in loops, missing sharing keywords, and tests without assertions, with concrete fixes.

When should I use Queueable vs Batch Apex for async processing?▼

Use Queueable as the default for standard async work since it supports complex types and job chaining. Choose Batch Apex when processing very large datasets, and use Scheduled Flow or Schedulable for recurring jobs.

Does this skill handle LWC JavaScript or Flow XML?▼

No, it explicitly delegates those tasks. LWC JavaScript, HTML, and CSS go to sf-lwc, Flow XML and orchestration go to sf-flow, SOQL-only work goes to sf-soql, and org deployment goes to sf-deploy.

What test coverage patterns does the skill enforce?▼

Every feature gets Positive, Negative, and Bulk test paths, with bulk tests using 251 or more records to span trigger batches. Tests must use Assert.* methods, avoid SeeAllData=true, and use a centralized test data factory.

Why does my Apex code fail when processing more than 100 records?▼

The usual cause is SOQL queries inside loops, which hit the 100-query synchronous limit. The fix is to collect IDs first, query once with an IN clause, build a Map for lookups, and perform DML once after the loop.