commerce-b2b-open-code…
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. Use when the user needs to run Apex tests, check code coverage, fix failing tests, or work with *Test.cls / *_Test.cls files. TRIGGER when: user runs Apex tests, checks code coverage, fixes
$ npx -y skills add forcedotcom/sf-skills --skill platform-apex-test-run --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/platform-apex-test-runContext preview
The summary Claude sees to decide when to auto-load this skill.
Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. Use when the user needs to run Apex tests, check code coverage, fix failing tests, or work with *Test.cls / *_Test.cls files. TRIGGER when: user runs Apex tests, checks code coverage, fixes
name: platform-apex-test-run
description: "Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. Use when the user needs to run Apex tests, check code coverage, fix failing tests, or work with *Test.cls / *_Test.cls files. TRIGGER when: user runs Apex tests, checks code coverage, fixes failing tests, or touches *Test.cls / *_Test.cls files. DO NOT TRIGGER when: writing Apex production code (use platform-apex-generate), Agentforce agent testing (use agentforce-test), or Jest/LWC tests (use experience-lwc-generate)."
metadata:
version: "1.2"
domains: ["Platform"]
relatedSkills:
- "agentforce-test"
- "experience-lwc-generate"
- "platform-apex-generate"
- "platform-apex-logs-debug"
- "platform-data-manage"
- "platform-metadata-deploy"
cliTools:
- tool: ["jq"]
semver: ">=1.6.0"
- tool: ["python3"]
semver: ">=3.10.0"
- tool: ["sf"]
semver: ">=2.0.0"Use this skill when the user needs **Apex test execution and failure analysis**: running tests, checking coverage, interpreting failures, improving coverage, and managing a disciplined test-fix loop for Salesforce code.
Use `platform-apex-test-run` when the work involves:
Delegate elsewhere when the user is:
---
Ask for or infer:
---
Identify:
Start narrow when debugging a failure; widen only after the fix is stable.
Focus on:
When the issue is code or test quality:
Cover:
---
| Rule | Rationale | |------|-----------| | Default to `SeeAllData=false` | Ensures test isolation; prevents reliance on org-specific data | | Every test must assert meaningful outcomes | Tests with no assertions prove nothing and give false confidence | | Test bulk behavior with 251+ records | Triggers process in batches of 200; 251 records crosses the boundary | | Use factories / `@TestSetup` when they improve clarity | Consistent data creation in one place; rolled back between test methods | | Pair `Test.startTest()` with `Test.stopTest()` for async | Ensures async operations (queueable, future) complete before assertions | | Do not hide flaky org dependencies inside tests | Prevents intermittent failures tied to org state |
---
| Issue | Resolution | |-------|------------| | Test passes locally but fails in CI org | Check for `SeeAllData=true` or undeclared dependencies on org-specific records | | Coverage drops unexpectedly after refactor | Run focused class-level tests first, then widen to `RunLocalTests` to confirm | | "Uncommitted work pending" error in callout test | DML and HTTP callouts cannot be mixed in the same test context without `Test.startTest()` wrapping | | Mock not taking effect in test | Ensure `Test.setMock()` is called before the code that makes the callout | | `@TestSetup` data missing in test method | `@TestSetup` data is committed per test method — re-query it; do not store in static variables | | API version 67.0 and higher without necessary access level checks | Check failing SOQL/DML stack traces for CRUD/FLS access errors, using System.runAs with an assigned permission set when user-mode behavior is intended, or documenting a justified `SYSTEM_MODE` path when system access is required |
---
When finishing, report in this order: 1. **What tests were run** 2. **Pass/fail summary** 3. **Coverage result** 4. **Root-cause findings** 5. **Fix or next-run recommendation**
Suggested shape:
Test run: <scope> Org: <alias> Result: <passed / partial / failed> Coverage: <percent / key classes> Issues: <highest-signal failures> Next step: <fix class, add test, rerun scope, or widen regression>
---
| Need | Delegate to | Reason | |------|-------------|--------| | Fix production code or author test classes | `platform-apex-generate` skill | Code generation and repair | | Create bulk / edge-case test data | [platform-data-manage](../platform-data-manage/SKILL.md) | Realistic test datasets | | Deploy updated tests to org | [platform-metadata-deploy](../platform-metadata-deploy/SKILL.md) | Deployment workflows | | Inspect detailed runtime logs | [platform-apex-logs-debug](../platform-apex-logs-debug/SKILL.md) | Deeper failure analysis |
---
| File | When to read | |------|-------------| | `references/cli-commands.md` | All `sf apex run test` command flags, output formats, async execution, and coverage commands | | `references/test-patterns.md` |
This repository provides a curated collection of Salesforce agent skills for building applications.
Repo: forcedotcom/sf-skills
Integrate Salesforce B2B Commerce open source components from GitHub into B2B Commerce stores. Use when users mention \"integrate open code components\",…
Replace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code…
Use this skill to diagnose and resolve what blocks a DevOps Center promotion of a work item's feature branch: Git merge conflicts and deployment failures.…
Use this skill to manage the full lifecycle of a DevOps Center pipeline — list all pipelines, get a single pipeline's details, create a new pipeline linked to…
Analyzes DevOps Center test failures and Code Analyzer violations in plain language — failure category, offending file/class/method/line, rule violated, fix…
Configures DevOps Center pipeline testing infrastructure: enables a test provider so its suites become available, re-syncs a configured provider to pull in new…