# /unit-testing [Handbook](../../README.md) · [Skill index](README.md) · [Runtime source](../../../.claude/skills/unit-testing/SKILL.md) ## Purpose Create, improve and execute isolated behavior/edge-case/regression tests. ## When to use A unit’s business behavior, boundaries or previously observed bug needs deterministic coverage. ## When not to use Do not use it to prove real HTTP/database/broker integration, end-to-end flows or capacity. ## Invocation ```text /unit-testing Cover the booking overlap calculation. ``` Autocomplete hint: ` [expected cases] [paths]`. Required information can be supplied in context; this is not a shell command or a CLI parser. Use plain-language arguments. See [argument conventions](../../skill-usage.md) for notation and permission boundaries. **Minimal example:** ```text /unit-testing Cover the booking overlap calculation. ``` **With optional context:** ```text /unit-testing Cover the booking overlap calculation, including adjacent ranges and invalid intervals, using the existing runner and validation contract. ``` ## Inputs | Input | Requirement | If omitted | |---|---|---| | unit or behavior | Required | Infer a clear active change; otherwise ask for scope. | | expected behavior | Required before assertions | Inspect actual contracts; clarify material ambiguity. | | paths, cases and runner | Optional | Discover existing layout/tooling; add only meaningful cases. | **No arguments:** Inspect an active change for a clear unit; otherwise ask what behavior needs coverage. Optional inputs are discovered where reliable; recommendations do not become confirmed choices. Conditional requirements must be resolved before their dependent action. Required information is enforced by skill instructions, not by native autocomplete. The detailed procedure is [linked directly from SKILL.md](../../../.claude/skills/unit-testing/references/workflow.md). ## What it does Inspect behavior → choose meaningful happy/failure/boundary cases → implement isolated fixtures/assertions → reproduce regressions where practical → run targeted and relevant suite checks → record coverage and gaps. Read only the selected skill and [testing procedure](../../../.claude/framework/testing.md). Use the [specific plan/evidence template](../../../.claude/framework/templates/unit-test-plan.md) when a written plan helps. ## Outputs and ownership Scoped tests/scripts in the application’s existing layout, fixtures/configuration where required, and actual evidence under docs/project/testing// when warranted. No new runner, agent, service or permission is installed by the skill itself. ## Questions and decisions Ask about materially missing expected behavior or test seams; preserve already confirmed validation choices. Existing stack/runner choices do not need re-approval. ## Permissions and side effects Uses ordinary conversation permissions. The main conversation writes scoped test artifacts and runs reviewed authorized checks. Installation/image pulls, credentials, destructive cleanup/migrations, global changes, shared-service traffic and paid capacity need applicable authorization. Reuse existing authorization for ordinary local work. Plan/script preparation may proceed while required execution approval/input is missing. ## Validation and completion Record exact argv/exits, source/tool/environment versions, actual test/workload/sample counts, safely preserved raw evidence and gaps. Inspect runner output, not merely exit status. Passing isolated tests establishes only their covered behavior; it does not prove real integrations, security or performance. Existing reviewed local gates and iteration-review can capture checks; helper success does not prove semantic coverage. ## Failure and recovery Preserve failing diagnostics and owned fixtures/resources. Do not weaken assertions, change thresholds after seeing results or retry until green. One reasoned retry/two review rounds apply; keep missing tools/access/baselines as BLOCKED/UNVERIFIED. Cleanup only resources owned by this run and report failures. No independent reviewer available means UNVERIFIED. ## Example ```text /unit-testing Add boundary and failure-path tests for the actual pricing function using our existing runner. ``` This is an illustrative invocation, not evidence that a model ran tests for an actual application. Existing template tests qualify packaging/structure only. ## Related components [Testing selection guide](../../testing-guide.md) · [implement-change](implement-change.md) · [iteration-review](iteration-review.md) · [testing helper/gates](../helpers.md)