writing-test
The writing-test slash command guides developers through creating comprehensive test suites for new features by consulting matching testing documentation templates, gathering requirements context, and systematically building unit and integration tests with 100% coverage targets. Use this command when adding a new feature to ensure tests align with project standards, design requirements, and existing testing patterns before proceeding to code review.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/codeaholicguy/ai-devkit/HEAD/commands/writing-test.md -o ~/.claude/commands/writing-test.mdwriting-test.md
Review tests using the latest matching `docs/ai/testing/YYYY-MM-DD-feature-{name}.md`. If none exists, use `docs/ai/testing/feature-{name}.md`. Keep it aligned with the base template.
1. **Gather Context** — If not already provided, ask for: feature name/branch, summary of changes (link to design & requirements docs), target environment, existing test suites, and any flaky/slow tests to avoid.
2. **Use Memory for Context** — Search memory for existing testing patterns and prior edge cases: `npx ai-devkit@latest memory search --query "<feature testing strategy>"`.
3. **Analyze Testing Template** — Identify required sections from the selected testing doc. Confirm success criteria and edge cases from requirements & design docs. Note available mocks/stubs/fixtures.
4. **Unit Tests (aim for 100% coverage)** — For each module/function: list behavior scenarios (happy path, edge cases, error handling), generate test cases with assertions using existing utilities/mocks, and highlight missing branches preventing full coverage.
5. **Integration Tests** — Identify critical cross-component flows. Define setup/teardown steps and test cases for interaction boundaries, data contracts, and failure modes.
6. **Coverage Strategy** — Recommend coverage tooling commands. Call out files/functions still needing coverage and suggest additional tests if <100%.
7. **Store Reusable Knowledge** — Save reusable testing patterns or tricky fixtures with `npx ai-devkit@latest memory store ...`.
8. **Update Documentation** — Summarize tests added or still missing. Update the selected testing doc with links to test files and results. Flag deferred tests as follow-up tasks.
9. **Next Command Guidance** — If tests expose design issues, return to `/review-design`; otherwise continue to `/code-review`.AI DevKit · Exchange information with active Codex, Claude Code, and other AI agents using ai-devkit agent list, detail, and send. Use when an agent needs to find another active agent, read its recent context, send it information, or request information back.
AI DevKit · Manage running AI agents with ai-devkit agent commands. Use when an agent needs to identify itself, list agents, start workers, inspect agent detail, assign work, group agents, resume sessions, stop agents, or delegate work to other agents.
AI DevKit · Supervise multi-agent workflows over repeated passes: poll progress, unblock waiting agents, coordinate dependencies, relay outputs, resolve conflicts, and verify completion. Use only for ongoing multi-agent coordination, not one-off list/detail/send/start/kill actions.
AI DevKit · Use when the user asks to brainstorm, ideate, generate ideas, expand options, challenge ideas, pressure-test ideas, compare concepts, narrow choices, name something, plan content angles, explore strategy, evaluate product ideas, technical approaches, experiments, or decisions.
AI DevKit · Compare implementation with design and requirements docs to ensure alignment.
AI DevKit · Pre-push code review against design docs.
AI DevKit · Safe git commit workflow for AI coding agents. Use when the user asks to commit, prepare a commit, stage changes, create a PR-ready checkpoint, or finish work with a conventional commit while avoiding unrelated user changes.
AI DevKit · Design phase guidance for reviewing feature design against requirements. Use when the user wants to validate architecture, review design docs, resolve design trade-offs, or run dev-lifecycle phase 3.