Skip to content
forcedotcom avatar

Platform Apex Generate

Generates Apex classes, triggers, and refactors with bulkification, SOQL/DML guardrails, and sharing defaults baked in.

CCM score
71 of 100
skills.sh installs
7.8K
GitHub stars
1.2K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers class authoring for services, selectors, domains, batch, queueable, schedulable, invocable, triggers, DTOs, and REST resources, plus code review of existing .cls and .trigger files
  • Includes ApexDoc-commented class and -meta.xml output, with templates read from assets/ and style examples from references/
  • Enforces hard stops for SOQL or DML inside loops, missing sharing keywords, hardcoded IDs, bare @future methods, and System.debug() on main paths
  • Runs dx-code-analyzer-run and sf apex run test before reporting, delegating test creation to platform-apex-test-generate

Install

$ npx -y skills add forcedotcom/sf-skills --skill platform-apex-generate -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Generating Apex

Use this skill for production-grade Apex: new classes, selectors, services, async jobs, invocable methods, and triggers; and for evidence-based review of existing .cls OR .trigger.

Required Inputs

Gather or infer before authoring:

  • Class type (service, selector, domain, batch, queueable, schedulable, invocable, trigger, trigger action, DTO, utility, interface, abstract, exception, REST resource)
  • Target object(s) and business goal
  • Class name (derive using the naming table below)
  • Net-new vs refactor/fix; any org/API constraints
  • Deployment targets (default to runSpecifiedTests and use generated tests where applicable)

Defaults unless specified:

  • Sharing: with sharing (see sharing rules per type below)
  • Access: public (use global only when required by managed packages or @RestResource)
  • API version: 66.0 (minimum version)
  • ApexDoc comments: yes

If the user provides a clear, complete request, generate immediately without unnecessary back-and-forth.


Workflow

Details

Repository
github.com/forcedotcom/sf-skills
Category
Backend & APIs
First seen
Jul 14, 2026

More from forcedotcom/sf-skills

All 78

Similar to Platform Apex Generate

More Backend & APIs