forcedotcom avatar

Generating Apex Test

This generates complete Apex test classes with proper structure and runs test-fix loops until coverage targets are met. It enforces TestDataFactory patterns, bulkifies to 251+ records to cross governor boundaries, and uses modern Assert syntax with meaningful failure messages. The workflow is systematic: gather context, generate both .cls and .cls-meta.xml files, run tests narrow to wide, analyze failures, fix in max 3 iterations. Most useful when you need to hit 75% deploy coverage or debug failing tests without manual back-and-forth. The skill won't touch production Apex code or LWC tests, just test class generation and the disciplined loop to get them green.

skills.sh installs
4.2K
GitHub stars
1.2K
last updated
Aug 21, 2026

Install

$ npx -y skills add forcedotcom/sf-skills --skill generating-apex-test --agent claude-code

Installs into .claude/skills of the current project.

Files

This generates complete Apex test classes with proper structure and runs test-fix loops until coverage targets are met. It enforces TestDataFactory patterns, bulkifies to 251+ records to cross governor boundaries, and uses modern Assert syntax with meaningful failure messages. The workflow is systematic: gather context, generate both .cls and .cls-meta.xml files, run tests narrow to wide, analyze failures, fix in max 3 iterations. Most useful when you need to hit 75% deploy coverage or debug failing tests without manual back-and-forth. The skill won't touch production Apex code or LWC tests, just test class generation and the disciplined loop to get them green.

Browse the repository on GitHub

Sponsors

Details

Repository
github.com/forcedotcom/sf-skills
Categories
Testing & QA, Debugging, Automation & Workflows
First seen
Jun 3, 2026

More from forcedotcom/sf-skills

All 158
1dotnet avatartest-smell-detectiondotnet/skillsDeep-dive audit using the full testsmells.org 19-smell academic catalog for tests in any language. Every finding maps to a named, citable smell from the researc4.1Kskills.sh installs
2dotnet avatartest-taggingdotnet/skillsAnalyzes test suites in any language and tags each test with standardized traits (positive, negative, critical-path, boundary, smoke, regression, integration, p4Kskills.sh installs
3giuseppe-trisciuoglio avatarlangchain4j-testing-strategiesgiuseppe-trisciuoglio/developer-kitProvides unit test, integration test, and mock AI patterns for LangChain4j applications. Creates mock LLM responses, tests retrieval chains, validates RAG workf3.8Kskills.sh installs
4langgenius avatarfrontend-testinglanggenius/difyUse when writing or changing Vitest or React Testing Library tests under `web/` or `packages/dify-ui/`, or when the user explicitly requests frontend test strat3.8Kskills.sh installs
5forcedotcom avatartesting-agentforceforcedotcom/sf-skillsWrite, run, and analyze structured test suites for Agentforce agents. TRIGGER when: user writes or modifies test spec YAML (AiEvaluationDefinition); runs sf age3.6Kskills.sh installs
6onmax avatarvitestonmax/nuxt-skillsUse when writing unit/integration tests for Vite projects - configure vitest.config.ts, write test suites with describe/it, create mock implementations with vi.3.2Kskills.sh installs