Create an implementation plan from issue analysis or feature concept
Generate a test-first implementation plan. The plan is built in two phases, in the spirit of TDD: the test plan comes first — detailed scenarios exercising code that does not yet exist or will change — and the implementation outline second, serving those tests. TDD is mostly about finding the right design and all edge cases upfront; the test plan is where that happens.
Detect Current Context
feature/42-something → look for .ai/issue-42-*/feature/my-feature → look for .ai/feature-my-feature/Find the Source of Truth
In order of preference:
spec label (or contains Test Scenarios / Expected Behavior
sections per ISSUE_GUIDELINES.md), it is the source of truthanalysis.md (from /analyze-issue) or concept.md (for features) in
the workflow folder/analyze-issue first or
provide contextRead Project Guidelines
Phase 1: Build the Test Plan
This phase comes first and gets the most effort:
Phase 2: Outline the Implementation
Derive the implementation tasks from the test plan — what has to change for those tests to pass:
Write the Plan
Write plan.md in the workflow folder using the template below.
Write to .ai/<folder>/plan.md:
# Implementation Plan: <branch-name>
## Source
- Spec: #<number> (<link>) — or Analysis: `.ai/<folder>/analysis.md`
## Overview
<Brief summary of what will be implemented>
## Test Plan
<This section is authoritative. Tests are written from it before the
implementation, and must not be changed to make the implementation pass —
see /implement.>
### Scenario 1: <name>
- **Test**: `Test<Name>` in `test/cmd/<file>_test.go`
- **Setup**: <repository/config state before the action>
- **Action**: <command or call being exercised>
- **Expected**: <concrete outcome — output, exit code, branch/config state>
### Scenario 2: <name>
...
### Coverage Check
- [ ] Happy path(s) covered
- [ ] Error conditions covered
- [ ] Edge cases from spec/analysis covered
- [ ] Additional edge cases found while double-checking: <list or "none">
## Implementation Tasks
### Task 1: Write failing tests
**Files**: `test/cmd/<file>_test.go`
- [ ] Implement all scenarios from the Test Plan as tests
- [ ] Verify they fail for the right reason (missing behavior, not setup bugs)
### Task 2: <Name>
**Files**: `path/to/file.go`
- [ ] <Specific change>
**Details**: <context or code snippets>
### Task 3: <Name>
**Files**: `path/to/file.go`
- [ ] <Specific change>
**Depends on**: Task 2
## Documentation Updates
- [ ] `docs/<command>.1.md` - <changes needed>
- [ ] `docs/gitflow-config.5.md` - <if config changes>
- [ ] Command help text updates
## Checkpoints
| Checkpoint | After Task | Verification |
|------------|------------|--------------|
| 1 | Task 1 | Tests compile and fail on missing behavior |
| 2 | Task 2 | <which scenarios now pass> |
| 3 | Task N | `go build ./...` and `go test ./...` fully pass |
## Commit Strategy
Plan commits following COMMIT_GUIDELINES.md. Tests are committed first.
## Estimated Scope
- Files to modify: <count>
- New files: <count>
- Tests to add: <count>
## Test Plan Revisions
<Empty initially. /implement appends an entry here whenever the test plan
has to change during implementation — see the revision rule in /implement.>
Validate Plan
Report Completion
/validate-tests — the Codex gate on the test
plan. Implementation must not start before the gate has run.