agentforce-architectur…
Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA…
Primary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract,
Claude Code
$ npx -y skills add forcedotcom/sf-skills --skill platform-apex-generate --agent claude-code
Codex
$ npx skills add forcedotcom/sf-skills --skill platform-apex-generate -a codex -y
Cursor
$ npx skills add forcedotcom/sf-skills --skill platform-apex-generate -a cursor -y
Gemini CLI
$ npx skills add forcedotcom/sf-skills --skill platform-apex-generate -a gemini-cli -y
GitHub Copilot
$ npx skills add forcedotcom/sf-skills --skill platform-apex-generate -a github-copilot -y
OpenCode
$ npx skills add forcedotcom/sf-skills --skill platform-apex-generate -a opencode -y
Windsurf
$ npx skills add forcedotcom/sf-skills --skill platform-apex-generate -a windsurf -y
name: platform-apex-generate
description: "Primary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract, exception, REST resource). Use this skill for requests involving SObject CRUD, mapping collections, fetching related records, scheduled jobs, batch jobs, trigger design, @AuraEnabled controllers, @RestResource endpoints, custom REST APIs, or code review of existing Apex."
metadata:
version: "1.1"
domains: ["Platform"]
minApiVersion: "66.0"
relatedSkills:
- "platform-apex-test-generate"
- "dx-code-analyzer-run"
- "integration-apex-symbol-table-query"
cliTools:
- tool: ["sf"]
semver: ">=2.0.0"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`.
Gather or infer before authoring:
Defaults unless specified:
If the user provides a clear, complete request, generate immediately without unnecessary back-and-forth.
---
All steps are sequential. Do not skip, merge, or reorder. If blocked, stop and ask for missing context. If not applicable, mark `N/A` with a one-line justification in the report.
1. **Discover project conventions**
2. **Choose the smallest correct pattern** (see Type-Specific Guidance below)
3. **Review templates and assets**
4. **Author with guardrails** -- apply every rule in the Rules section below
5. **Generate test classes** -- Load the skill `platform-apex-test-generate` to create `{ClassName}Test.cls` and `{ClassName}Test.cls-meta.xml`. Apex tests are required to deploy; never create or edit test files without loading it.
Steps 6 and 7 each require a tool invocation and produce output that must appear in the Step 8 report. Do not present the report until both have run and their output is captured.
6. **Run code analyzer**
7. **Execute Apex tests**
8. **Report** -- use the output format at the bottom of this file.
---
If any constraint would be violated in generated code, **stop and explain the problem** before proceeding:
| Constraint | Rationale | |---|---| | Place all SOQL outside loops | Avoid query governor limits (100 queries) | | Place all DML outside loops | Avoid DML governor limits (150 statements) | | Declare a sharing keyword on every class | Prevent unintended `without sharing` defaults and data exposure | | Use Custom Metadata/Labels/describe calls instead of hardcoded IDs | Ensure portability across orgs | | Always handle exceptions (log, rethrow, or recover) | Prevent silent failures | | Use bind variables for all dynamic SOQL with user input | Prevent SOQL injection | | Use Apex-native collections (`List`, `Map`, `Set`) rather than Java types | Prevent compile errors | | Verify methods exist in Apex before use | Prevent reliance on non-existent APIs | | Avoid `System.debug()` in main code paths | Debug statements evaluate even when loggign is not active and consume CPU. Use a logging framework if required on main code paths | | Never use `@future` methods | Use Queueable with `System.Finalizer`; `@future` cannot chain, cannot be called from Batch, and cannot accept non-primitive types |
###
This repository provides Salesforce agent skills, plugins, and sample apps for building applications.
Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA…
Use this skill to Upgrade Einstein Bots into Agentforce agents end-to-end in a single pass, orchestrating per-bot Agent Spec…
Data Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific…
Build, modify, audit, repair, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates,…
Analyze production Agentforce agent behavior using session traces and Data Cloud, and manage Agent Health Monitoring (AHM)…
Use to design an AI agent persona — identity, voice, tone, behavioral style, guardrails — and encode it into Agent Script (.agent…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.