sf-testing
Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. 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 sf-apex), Agentforce agent testing (use sf-ai-agentforce-testing), or Jest/LWC tests (use sf-lwc).
What this skill does
# sf-testing: Salesforce Test Execution & Coverage Analysis 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. ## When This Skill Owns the Task Use `sf-testing` when the work involves: - `sf apex run test` workflows - Apex unit-test failures - code coverage analysis - identifying uncovered lines and missing test scenarios - structured test-fix loops for Apex code Delegate elsewhere when the user is: - writing or refactoring production Apex → [sf-apex](../sf-apex/SKILL.md) - testing Agentforce agents → [sf-ai-agentforce-testing](../sf-ai-agentforce-testing/SKILL.md) - testing LWC with Jest → [sf-lwc](../sf-lwc/SKILL.md) --- ## Required Context to Gather First Ask for or infer: - target org alias - desired test scope: single class, specific methods, suite, or local tests - coverage threshold expectation - whether the user wants diagnosis only or a test-fix loop - whether related test data factories already exist --- ## Recommended Workflow ### 1. Discover test scope Identify: - existing test classes - target production classes - test data factories / setup helpers ### 2. Run the smallest useful test set first Start narrow when debugging a failure; widen only after the fix is stable. ### 3. Analyze results Focus on: - failing methods - exception types and stack traces - uncovered lines / weak coverage areas - whether failures indicate bad test data, brittle assertions, or broken production logic ### 4. Run a disciplined fix loop When the issue is code or test quality: - delegate code fixes to [sf-apex](../sf-apex/SKILL.md) when needed - add or improve tests - rerun focused tests before broader regression ### 5. Improve coverage intentionally Cover: - positive path - negative / exception path - bulk path (251+ records where appropriate) - callout or async path when relevant --- ## High-Signal Rules - default to `SeeAllData=false` - every test should assert meaningful outcomes - test bulk behavior, not just single-record happy paths - use factories / `@TestSetup` when they improve clarity and speed - pair `Test.startTest()` with `Test.stopTest()` when async behavior matters - do not hide flaky org dependencies inside tests --- ## Output Format 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: ```text 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> ``` --- ## Cross-Skill Integration | Need | Delegate to | Reason | |---|---|---| | fix production code or author tests | [sf-apex](../sf-apex/SKILL.md) | code generation and repair | | create bulk / edge-case data | [sf-data](../sf-data/SKILL.md) | realistic test datasets | | deploy updated tests | [sf-deploy](../sf-deploy/SKILL.md) | rollout | | inspect detailed runtime logs | [sf-debug](../sf-debug/SKILL.md) | deeper failure analysis | --- ## Reference Map ### Start here - [references/cli-commands.md](references/cli-commands.md) - [references/test-patterns.md](references/test-patterns.md) - [references/testing-best-practices.md](references/testing-best-practices.md) - [references/test-fix-loop.md](references/test-fix-loop.md) ### Specialized guidance - [references/mocking-patterns.md](references/mocking-patterns.md) - [references/performance-optimization.md](references/performance-optimization.md) - [assets/](assets/) --- ## Score Guide | Score | Meaning | |---|---| | 108+ | strong production-grade test confidence | | 96–107 | good test suite with minor gaps | | 84–95 | acceptable but strengthen coverage / assertions | | < 84 | below standard; revise before relying on it |
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.