/unit-testing:unit-testingfrom unit-testing
Writes, updates and runs focused unit or regression tests for changed behavior or a confirmed bug, in any language, including test-first (red-green) work. Also answers test-strategy questions: what belongs in a unit test versus a broader one, testing private helpers or a real database. Use for "add a test for this", "write a regression test for this fix", "do this TDD" or "what counts as a unit test here?". Not for auditing coverage or missing tests (test-gap-audit).
Ships in unit-testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Produce the smallest reliable unit or regression evidence for a code change. A test is an executable statement of an observable contract, not a branch-coverage exercise.
Not for E2E or browser suites (e2e-testing), auditing a codebase's or diff's test gaps (test-gap-audit), running a whole suite and fixing its failures (test-run), coverage chasing, test-framework setup, fuzz or property testing, or broad suite refactors. If one of those tasks also changes behavior that needs a focused unit or regression test, use this workflow for that part.
Establish the change and its contract. Read the requirement or defect report, the changed code, and the closest relevant tests. Identify the public input, the observable result or effect, and one scenario that proves the intended behavior. Learn the runner, test location, naming, and prerequisites from local docs, config, scripts, and nearby tests. Don't copy an elaborate existing pattern just because it exists.
Decide whether to add a test.
references/tdd.md before the first test. It also covers seams, mocking, and the anti-patterns below in depth.Choose the smallest proving level. Prefer a direct unit test of the public contract. Move to a component, database, or service test only when a lower level can't establish the behavior. Don't test mocks, fixtures, or helpers for their own sake. When a fake or sandbox path and the real path must return the same shape, one parity test that runs the same assertions against both catches drift that mocks hide.
Write a discriminating test.
references/pytest.md (Python) or references/vitest.md (JavaScript or TypeScript, including Jest).Make prerequisites explicit and safe. Record the exact targeted command and, when discoverable, the runner version and where it came from. Record required config, local services, ports, OS or network constraints, and test-data setup. Use disposable data and never require real credentials or a production service.
references/framework-runners.md before choosing a command when the runner or its targeting syntax is unfamiliar (pytest, Vitest/Jest, Go, Cargo, or unknown).references/database-and-service-tests.md before writing any test that needs a database, container, or local service.Run proportionately. Run the narrowest target that reaches the new test first. Rerun it after relevant code or test changes. Run a broader group only when project policy, shared code, config, or dependencies make it necessary. Treat coverage as a diagnostic for unexpected gaps, never a quota. Don't count your own review of code you just wrote as evidence that its tests are sufficient, because the same blind spots that produced a bug tend to miss it in review. A check that runs can disagree with you.
Diagnose failures before widening scope. Classify the failure as a product defect, wrong expectation, unstable or order-dependent test, runner or config issue, or missing infrastructure. Keep the failure output. Don't add retries or broaden scenarios to make a failure disappear. If prerequisites can't be met safely, report the test as blocked with the missing requirement. For a failure whose cause is unknown, use problem-solving.
Report only what you actually obtained:
Stop when the changed contract has focused evidence and any required regression is covered.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub adminhead/claude-plugins --plugin unit-testing