| name | write-test-plan |
| description | Generate or update change test plan |
| model | sonnet |
| allowed-tools | ["Read","Write","Edit","Glob","Grep","Bash","WebFetch","mcp__*"] |
Create or update a COMPLETE, requirements-driven TEST PLAN for a change.
User invocation: /write-test-plan <workItemRef> [options]
Options: focus=backend, nfr-only, no-manual, etc.
The TEST PLAN:
- Ensures full coverage of capabilities, interfaces, and acceptance criteria
- Aligns with implementation plan phases
- Maps scenarios to test types per
.ai/rules/testing-strategy.md
$ARGUMENTS
- `workItemRef` = first token matching pattern `-` (e.g., `PDEV-123`, `GH-456`)
- Remaining args = options (e.g., `focus=backend`)
- If no valid `workItemRef` found, output NEEDS_INPUT:
```
NEEDS_INPUT: workItemRef required
Usage: /write-test-plan [options]
Example: /write-test-plan PDEV-123 focus=backend
```
<discovery_rules>
Given workItemRef:
- Search for folder:
doc/changes/**/*--<workItemRef>--*/
- Locate spec:
chg-<workItemRef>-spec.md (required)
- Locate plan:
chg-<workItemRef>-plan.md (optional)
- Read:
.ai/rules/testing-strategy.md (required)
Files:
- Spec:
chg-<workItemRef>-spec.md
- Plan:
chg-<workItemRef>-plan.md
- Test Plan:
chg-<workItemRef>-test-plan.md
- Branch:
<change.type>/<workItemRef>/<slug>
</discovery_rules>
1. Parse `workItemRef` and options from $ARGUMENTS
2. Locate change folder, spec, plan per
3. Read `.ai/rules/testing-strategy.md`; FAIL if missing
4. Extract F-#, AC-#, API-#, NFR-# from spec
5. Checkout/create branch
6. Delegate to `@test-plan-writer` agent (it has full template and rules)
7. Report: path to created test plan, next step: `/run-plan `
After successful execution:
- Created/updated file path
- Branch name
- Coverage summary (how many AC-# covered, any TODOs)
- Recommendation: "Run `/run-plan ` to begin execution"
- Spec must exist; fail if not found
- Testing strategy must exist; fail if not found
- Only the test plan file may be written
- Derive all context from spec/plan; do not invent requirements
- Mark uncovered AC-# as TODO with open questions