| name | test |
| compatibility | Built for Claude Code (subagents, interactive questions). Installs on any Agent Skills client. |
| allowed-tools | Bash, Read, Grep, Glob, Write, Edit, Task, AskUserQuestion |
| description | Write a test suite for code just built or changed. Run /test after implementing a feature, component, API route, or fix; it targets the changed-and-uncommitted files (working tree + staged + untracked), classifies each, and writes the right kind of test (unit, component, integration, E2E candidate) via a subagent, honoring the project's test tooling and preferences. |
Read ../conventions.md first (once per session). It carries the session start gate, model routing (this skill: mid tier; on a premium model suggest /model sonnet in one line), panel rules, subagent rules, and output style. Apply the start gate before anything below.
What this skill does
The test writer. Scopes to what actually changed, classifies each file, and has a subagent write real tests to the project's conventions: assertions on behavior, mocked only at the boundary (DB, network, external SDKs), no snapshot spam, no testing implementation details. It writes and runs the suite; it does not build features (/develop), root-cause failures (/debug), or stress production scenarios (/harden).
Owns: test files and test-preferences.json. Touches: the roadmap only to tick the feature's Test it box. Never: rewrites app code beyond what a test needs exposed (flag anything bigger).
Execution
1. Scope from git (first; empty scope = nothing to do)
Changed-but-uncommitted files: git diff --name-only --diff-filter=ACMR HEAD + git ls-files --others --exclude-standard (no commits yet: --cached variant). De-duplicate, then filter out non-testables: test files themselves, config, lockfiles, generated output, pure styling, *.d.ts, docs/ADRs/design.md/test-preferences.json. Empty after filtering → report "no changed source to test" and stop.
1b. Classify each file (from path alone, never read contents in the main thread)
component (*.tsx/*.jsx/*.vue/*.svelte, not a route) → component test · page/flow (app/**/page.*, pages/**, *Screen.*) → E2E candidate + component pieces · api/server (app/**/route.*, pages/api/**, actions.*, *.controller.*) → integration test at the handler, mocked at the boundary · logic (plain source: utils, hooks, services) → unit test (inputs → outputs, edges, errors) · cli (bin/**, cmd/**) → integration invoking the command. Ambiguous → tag logic, the subagent re-tags on read. E2E_RELEVANT = yes if any page/flow file. Large diff guard (>15 files): panel: Logic & API first (recommended) · Everything in batches · Let me narrow it. Monorepo: group files by nearest package.json root; install and spawn per group.
2. Preferences, stack, installation
Read test-preferences.json at the root. Found: load tool, e2eTool, testDir, filePattern, packageManager, skip to installation. Missing: detect the stack (framework, existing test setup) and ask the first-run questions as one batched panel (runner, E2E tool if relevant, file placement), then write test-preferences.json so no future run re-asks. Installation check: ensure the chosen runner and libs are installed and configured (install just what is needed); a broken existing setup is fixed, not duplicated.
3. Spawn the test-writing subagent
Read agent-prompt.md (lazy), fill it with: the scoped file list with classes and package roots · the preferences · the relevant ADR's ## Requirements ACs when the change maps to a feature (tests assert the ACs) · the conventions from the nearest AGENTS.md. Subagent (mid-tier model, Read/Bash/Write/Edit) writes the tests per writing-guide.md, runs the suite, iterates to green or reports honestly why not, and returns: files written, suite result, coverage of the scope (per file: covered / partial / skipped and why), anything it had to expose or refactor minimally.
4. Relay
Report the subagent's summary (never re-derive it): suite command and result, what is covered, what is not and why, follow-ups. Suite not green after honest effort → hand to /debug with the failure. Tick the roadmap's Test it box when the feature's tests land green. Close: "Next: /clear, then /harden <feature> (medium/full tier) or /sync (feature done)."
Reference files (lazy)
agent-prompt.md (test-writing subagent prompt) · writing-guide.md (what good tests look like per class; mocking rules; naming).