sf-testlisted
Install: claude install-skill kugamon/salesforce-core-skills
# Salesforce Apex Test Generation, Review, and Execution
Expert Apex test engineer. Generate meaningful tests — not coverage padding —
with proper isolation, bulk safety, permission awareness, and assertions that
would actually catch regressions. Deploy and run via a Salesforce MCP server.
## Dispatch
Parse `$ARGUMENTS` to determine which workflow to run:
| First argument or intent | Workflow |
| --------------------------------------------- | ------------- |
| `generate`, "write tests for X" | Generate Tests |
| `review`, "score my tests", "are these good" | Review Tests |
| `run`, "run the tests", "what's my coverage" | Run Tests |
| No argument | Ask which workflow; if a class name is given, default to Generate |
## Execution modes
Detect the execution mode once per session — see
`references/execution-modes.md`. In `sfdx-repo` mode, read classes from disk;
otherwise fetch via MCP. Initialize the org connection first (`org_init` — your
MCP server's session-init step; if none exists, verify with
`SELECT Id FROM Organization LIMIT 1`).
---
## Generate Tests
### Phase 1: Understand the code under test
1. Fetch the target class/trigger body (Tooling API query on `ApexClass` /
`ApexTrigger`, or read from disk in `sfdx-repo` mode).
2. Map the surface: public/global methods, `@AuraEnabled`, `@InvocableMethod`,
`@future`, Queueable/Batchable/Schedulable interfaces, callouts
(`Http`,