Plan
Purpose
Implementation planning skill. Takes an approved spec (from /ai-brainstorm or manual creation) and produces a phased execution plan with bite-sized tasks, agent assignments, and gate criteria. The plan is the contract that /ai-dispatch executes.
HARD GATE: user must approve the plan before /ai-dispatch can run.
When to Use
- After
/ai-brainstorm produces an approved spec
- When a spec exists but plan.md has placeholder content
- When re-planning is needed (plan failed, scope changed)
Process
- Read spec -- load
specs/spec.md
- Read context --
docs/solution-intent.md section 7 (roadmap), decision-store.json (constraints)
- Explore codebase -- understand current architecture, patterns, and affected files
- Classify pipeline -- select full/standard/hotfix/trivial based on change scope
- Decompose into tasks -- bite-sized (2-5 min each), single-agent, single-concern
- Assign agents -- capability-match each task to the right agent
- Order phases -- define phase boundaries and gate criteria
- Review plan -- self-review with spec-reviewer pattern (max 2 iterations)
- Write artifacts -- persist plan.md via Write tool to
specs/plan.md
- STOP -- present plan. User runs
/ai-dispatch to execute.
Pipeline Classification
| Pipeline |
Trigger |
Steps |
full |
New feature, refactor, >5 files |
discover, architecture, risk, test-plan, spec, dispatch |
standard |
Enhancement, 3-5 files |
discover, risk, spec, dispatch |
hotfix |
Bug fix, security patch, <3 files |
discover, risk, spec, dispatch |
trivial |
Typo, comment, single-line |
spec, dispatch |
Override: /ai-plan --pipeline=hotfix.
Task Decomposition Rules
Each task MUST be:
- Bite-sized: completable in 2-5 minutes by an agent
- Single-agent: assigned to exactly one agent (build, verify, guard)
- Single-concern: does one thing (not "implement feature AND write tests")
- Verifiable: has a clear done condition (test passes, lint clean, file exists)
- Ordered: dependencies are explicit (T-3 blocked by T-2)
TDD enforcement: for features needing tests, always produce paired tasks:
T-N: Write failing tests for [feature] (RED) -- assigned to build/test mode
T-N+1: Implement [feature] to pass tests (GREEN, blocked by T-N) -- assigned to build/code mode, constraint: "DO NOT modify test files from T-N"
Agent Assignment
| Agent |
Capabilities |
Assign when... |
build |
Code read-write, tests, debug |
Implementation, test writing, bug fixes |
verify |
Read-only scanning, 7 modes |
Quality checks, security scans, gap analysis |
guard |
Advisory, drift detection |
Pre-dispatch governance checks |
Plan Artifacts
plan.md
# Plan: spec-NNN [title]
## Pipeline: [full|standard|hotfix|trivial]
## Phases: N
## Tasks: N (build: N, verify: N, guard: N)
### Phase 1: [name]
**Gate**: [what must be true before Phase 2 starts]
- T-1.1: [task description] (agent: build)
- T-1.2: [task description] (agent: build)
### Phase 2: [name]
**Gate**: [what must be true before Phase 3 starts]
...
Common Mistakes
- Tasks too large (> 5 min). Split them.
- Missing dependencies between tasks.
- Assigning code-write tasks to verify (verify is read-only).
- Not pairing RED/GREEN tasks for TDD.
- Planning implementation details (plan says WHAT, code says HOW).
- Skipping the review step.
No-Execution Protocol
/ai-plan is planning-only. It MUST NOT:
- Invoke
ai-build agent or /ai-dispatch for task execution
- Modify source code
- Check off implementation tasks as completed
It MAY:
- Write plan.md via Write tool to
specs/plan.md
- Run codebase exploration (read-only)
Integration
- Called by: user directly, or after
/ai-brainstorm approval
- Calls:
/ai-explore (codebase context), Write tool (artifact creation)
- Transitions to:
/ai-dispatch (ONLY -- user must invoke explicitly)
$ARGUMENTS
1---2name: ai-plan3description: Use when an approved spec exists and needs to be broken into executable tasks with agent assignments. Creates the implementation plan that /ai-dispatch executes.4---5
6
7# Plan
8
9## Purpose
10
11Implementation planning skill. Takes an approved spec (from `/ai-brainstorm` or manual creation) and produces a phased execution plan with bite-sized tasks, agent assignments, and gate criteria. The plan is the contract that `/ai-dispatch` executes.
12
13HARD GATE: user must approve the plan before `/ai-dispatch` can run.
14
15## When to Use
16
17- After `/ai-brainstorm` produces an approved spec
18- When a spec exists but plan.md has placeholder content
19- When re-planning is needed (plan failed, scope changed)
20
21## Process
22
231. **Read spec** -- load `specs/spec.md`
242. **Read context** -- `docs/solution-intent.md` section 7 (roadmap), `decision-store.json` (constraints)
253. **Explore codebase** -- understand current architecture, patterns, and affected files
264. **Classify pipeline** -- select full/standard/hotfix/trivial based on change scope
275. **Decompose into tasks** -- bite-sized (2-5 min each), single-agent, single-concern
286. **Assign agents** -- capability-match each task to the right agent
297. **Order phases** -- define phase boundaries and gate criteria
308. **Review plan** -- self-review with spec-reviewer pattern (max 2 iterations)
319. **Write artifacts** -- persist plan.md via Write tool to `specs/plan.md`
3210. **STOP** -- present plan. User runs `/ai-dispatch` to execute.
33
34## Pipeline Classification
35
36| Pipeline | Trigger | Steps |
37|----------|---------|-------|
38| `full` | New feature, refactor, >5 files | discover, architecture, risk, test-plan, spec, dispatch |
39| `standard` | Enhancement, 3-5 files | discover, risk, spec, dispatch |
40| `hotfix` | Bug fix, security patch, <3 files | discover, risk, spec, dispatch |
41| `trivial` | Typo, comment, single-line | spec, dispatch |
42
43Override: `/ai-plan --pipeline=hotfix`.
44
45## Task Decomposition Rules
46
47Each task MUST be:
48
49- **Bite-sized**: completable in 2-5 minutes by an agent
50- **Single-agent**: assigned to exactly one agent (build, verify, guard)
51- **Single-concern**: does one thing (not "implement feature AND write tests")
52- **Verifiable**: has a clear done condition (test passes, lint clean, file exists)
53- **Ordered**: dependencies are explicit (T-3 blocked by T-2)
54
55**TDD enforcement**: for features needing tests, always produce paired tasks:
56- `T-N: Write failing tests for [feature]` (RED) -- assigned to build/test mode
57- `T-N+1: Implement [feature] to pass tests` (GREEN, blocked by T-N) -- assigned to build/code mode, constraint: "DO NOT modify test files from T-N"
58
59## Agent Assignment
60
61| Agent | Capabilities | Assign when... |
62|-------|-------------|----------------|
63| `build` | Code read-write, tests, debug | Implementation, test writing, bug fixes |
64| `verify` | Read-only scanning, 7 modes | Quality checks, security scans, gap analysis |
65| `guard` | Advisory, drift detection | Pre-dispatch governance checks |
66
67## Plan Artifacts
68
69### plan.md
70
71```markdown
72# Plan: spec-NNN [title]
73
74## Pipeline: [full|standard|hotfix|trivial]
75## Phases: N
76## Tasks: N (build: N, verify: N, guard: N)
77
78### Phase 1: [name]
79**Gate**: [what must be true before Phase 2 starts]
80- T-1.1: [task description] (agent: build)
81- T-1.2: [task description] (agent: build)
82
83### Phase 2: [name]
84**Gate**: [what must be true before Phase 3 starts]
85...
86```
87
88## Common Mistakes
89
90- Tasks too large (> 5 min). Split them.
91- Missing dependencies between tasks.
92- Assigning code-write tasks to verify (verify is read-only).
93- Not pairing RED/GREEN tasks for TDD.
94- Planning implementation details (plan says WHAT, code says HOW).
95- Skipping the review step.
96
97## No-Execution Protocol
98
99`/ai-plan` is planning-only. It MUST NOT:
100- Invoke `ai-build agent` or `/ai-dispatch` for task execution
101- Modify source code
102- Check off implementation tasks as completed
103
104It MAY:
105- Write plan.md via Write tool to `specs/plan.md`
106- Run codebase exploration (read-only)
107
108## Integration
109
110- **Called by**: user directly, or after `/ai-brainstorm` approval
111- **Calls**: `/ai-explore` (codebase context), Write tool (artifact creation)
112- **Transitions to**: `/ai-dispatch` (ONLY -- user must invoke explicitly)
113
114$ARGUMENTS