platform-apex-test-generate

platform-apex-test-generate is a skill for Claude Code from forcedotcom/sf-skills. It costs 135 tokens per session (2,295 once invoked), scanned A, original, Apache-2.0.

A Salesforce tool for creating and improving Apex test classes, including their test data and assertions. Test classes are code that check whether other Salesforce code behaves correctly.

In plain words
What is it for?
Use it to generate test classes, build reusable test data, test batches of records, add mocks, improve assertions, and fix failing tests.
Why use it?
It helps produce tests that cover normal, error, and high-volume cases instead of only checking a small example. This makes failures easier to understand and coverage more meaningful.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the salesforce-development plugin — 37 skills, 13 commands, 2 agents, 3 MCP servers shipped together

Good fit Use it to generate test classes, build reusable test data, test batches of records, add mocks, improve assertions, and fix failing tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/forcedotcom/sf-skills/platform-apex-test-generate
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add forcedotcom/sf-skills --skill platform-apex-test-generate
Clone the repo
git clone --depth 1 https://github.com/forcedotcom/sf-skills

Made for: Claude Code.

Or install salesforce-development, the plugin that ships this one along with the rest of its 37 skills, 13 commands, 2 agents, 3 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for platform-apex-test-generate

README.md
[![agentmods](https://agentmods.dev/badge/skills/forcedotcom/sf-skills/platform-apex-test-generate/github.svg)](https://agentmods.dev/skills/forcedotcom/sf-skills/platform-apex-test-generate)
Your own site
<a href="https://agentmods.dev/skills/forcedotcom/sf-skills/platform-apex-test-generate"><img src="https://agentmods.dev/badge/skills/forcedotcom/sf-skills/platform-apex-test-generate/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for platform-apex-test-generate

Your own site · 80×15
<a href="https://agentmods.dev/skills/forcedotcom/sf-skills/platform-apex-test-generate"><img src="https://agentmods.dev/badge/skills/forcedotcom/sf-skills/platform-apex-test-generate.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 135 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,295 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 19 Aug 2026
  • Snyk pass 19 Aug 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00135 $0.02295
Opus 5 $0.00068 $0.01148
Sonnet 5 $0.00027 $0.00459
Haiku 4.5 $0.00014 $0.00230

Measured 6d ago against content hash 20f28b47d4ed, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

platform-apex-test-generate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/builder/salesforce-development/skills/platform-apex-test-generate/SKILL.md · 210 lines

How it starts

The opening of the file, as written. The whole thing — 210 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generating Apex Tests

Generate production-ready Apex test classes and run disciplined test-fix loops with coverage analysis.

Core Principles

  1. One behavior per method — each test method validates a single scenario. Separate positive, negative, and bulk tests. NEVER combine related-but-distinct inputs (e.g., null and empty) in one method — create _NullInput_ and _EmptyInput_ as separate test methods
  2. Bulkify tests — test with 251+ records to cross the 200-record trigger batch boundary. Batch Apex exception: in test context only one execute() invocation runs, so set batchSize >= testRecordCount. See references/async-testing.md
  3. Isolate test data — every @TestSetup must delegate record creation to a TestDataFactory class. If none exists, create one first. Never build record lists inline in @TestSetup. Never rely on org data (SeeAllData=false) or hardcoded IDs. For duplicate rule handling, see references/test-data-factory.md
  4. Assert meaningfully — use exact expected values computed from test data setup. NEVER use range assertions or approximate counts when the value is deterministic. Always include failure messages. See references/assertion-patterns.md
  5. Use Assert class onlyAssert.areEqual, Assert.isTrue, Assert.fail, etc. Never use legacy System.assert, System.assertEquals, or System.assertNotEquals
  6. Mock external boundaries — use HttpCalloutMock for callouts, Test.setFixedSearchResults for SOSL, DML mock classes for database isolation. Design for testability via constructor injection. See references/mocking-patterns.md
  7. Test negative paths — validate error handling and exception scenarios, not just happy paths
  8. Wrap with start/stop — pair Test.startTest() with Test.stopTest() to reset governor limits and force async execution

Test.startTest() / Test.stopTest()

Read the full file on GitHub · 210 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 210 lines · 135 tokens per session scan A 20f28b47d4ed

Subscribe to this mod's changes

platform-apex-test-generate is a skill published in the GitHub repository forcedotcom/sf-skills (978 stars, last pushed yesterday), licensed Apache-2.0. It adds 135 tokens to every session and 2,295 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories