cc-dev-template 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/install.js +165 -0
- package/package.json +24 -0
- package/src/agents/claude-md-agent.md +71 -0
- package/src/agents/decomposition-agent.md +103 -0
- package/src/agents/execution-agent.md +133 -0
- package/src/agents/rca-agent.md +158 -0
- package/src/agents/tdd-agent.md +163 -0
- package/src/commands/finalize.md +83 -0
- package/src/commands/prime.md +5 -0
- package/src/scripts/adr-list.js +170 -0
- package/src/scripts/adr-tags.js +125 -0
- package/src/scripts/merge-settings.js +187 -0
- package/src/scripts/statusline-config.json +7 -0
- package/src/scripts/statusline.js +365 -0
- package/src/scripts/validate-yaml.js +128 -0
- package/src/scripts/yaml-validation-hook.json +15 -0
- package/src/skills/orchestration/SKILL.md +127 -0
- package/src/skills/orchestration/references/debugging/describe.md +122 -0
- package/src/skills/orchestration/references/debugging/fix.md +110 -0
- package/src/skills/orchestration/references/debugging/learn.md +162 -0
- package/src/skills/orchestration/references/debugging/rca.md +84 -0
- package/src/skills/orchestration/references/debugging/verify.md +95 -0
- package/src/skills/orchestration/references/execution/complete.md +161 -0
- package/src/skills/orchestration/references/execution/start.md +66 -0
- package/src/skills/orchestration/references/execution/tasks.md +92 -0
- package/src/skills/orchestration/references/planning/draft.md +195 -0
- package/src/skills/orchestration/references/planning/explore.md +129 -0
- package/src/skills/orchestration/references/planning/finalize.md +169 -0
- package/src/skills/orchestration/references/planning/start.md +115 -0
- package/src/skills/orchestration/scripts/plan-status.js +283 -0
- package/src/skills/prompting/SKILL.md +123 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Execution Phase 3: Complete
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Verify the work, capture any new patterns as ADRs, and get human approval before closing out the plan.
|
|
6
|
+
|
|
7
|
+
**Success looks like**: Tests pass, code compiles, new patterns are documented, user approves, plan marked complete.
|
|
8
|
+
|
|
9
|
+
## What To Do
|
|
10
|
+
|
|
11
|
+
Complete each step in order before proceeding to the next.
|
|
12
|
+
|
|
13
|
+
<steps>
|
|
14
|
+
|
|
15
|
+
<step name="Automated Verification">
|
|
16
|
+
Run the project's verification suite:
|
|
17
|
+
|
|
18
|
+
1. **Tests** - Run all tests (whatever "all tests" means for this project)
|
|
19
|
+
2. **Compile/Build** - Ensure everything compiles with no errors or warnings
|
|
20
|
+
3. **Lint** - Run any linters if the project uses them
|
|
21
|
+
|
|
22
|
+
Figure out what's appropriate for the project.
|
|
23
|
+
|
|
24
|
+
**If verification fails:** Identify which task caused the failure and spawn an execution-agent to fix it. Provide the error output and task context. Re-run verification after the fix. Repeat until all checks pass.
|
|
25
|
+
</step>
|
|
26
|
+
|
|
27
|
+
<step name="Capture New Patterns">
|
|
28
|
+
Before human review, analyze the work for architectural decisions and tribal knowledge worth documenting.
|
|
29
|
+
|
|
30
|
+
**Do the analysis:**
|
|
31
|
+
1. **Read task outcomes** - Review what was done across all tasks
|
|
32
|
+
2. **Look at code changes** - `git diff` against the base branch
|
|
33
|
+
3. **Identify patterns** - Did we establish new patterns, architectures, or conventions?
|
|
34
|
+
4. **Identify gotchas** - Did we discover non-obvious behaviors or workflow requirements?
|
|
35
|
+
|
|
36
|
+
**ADR criteria** - Worth documenting if:
|
|
37
|
+
- New architectural patterns ("We now use X for Y")
|
|
38
|
+
- Design decisions with alternatives considered
|
|
39
|
+
- Conventions established that future work should follow
|
|
40
|
+
|
|
41
|
+
Not ADR-worthy: Bug fixes, implementation details, obvious choices
|
|
42
|
+
|
|
43
|
+
**CLAUDE.md criteria** - Worth documenting if:
|
|
44
|
+
- Non-obvious gotchas discovered during implementation
|
|
45
|
+
- Workflow patterns specific to this project
|
|
46
|
+
- Behaviors that would trip up a future developer
|
|
47
|
+
|
|
48
|
+
Not CLAUDE.md-worthy: Standard practices, info already in docs, obvious behaviors
|
|
49
|
+
|
|
50
|
+
**Present your assessment and act on it:**
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
## Learnings Assessment
|
|
54
|
+
|
|
55
|
+
**ADRs**: [Either "I identified patterns worth documenting: [list with brief reasons]. Creating ADRs now." OR "No architectural patterns emerged that warrant ADRs."]
|
|
56
|
+
|
|
57
|
+
**CLAUDE.md**: [Either "I identified tribal knowledge worth capturing: [list]. Updating CLAUDE.md now." OR "No non-obvious knowledge discovered that warrants CLAUDE.md updates."]
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Then capture what you identified:**
|
|
61
|
+
|
|
62
|
+
For each ADR identified:
|
|
63
|
+
```
|
|
64
|
+
Spawn adr-agent: "Create an ADR for: [pattern description and context]"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For CLAUDE.md learnings:
|
|
68
|
+
```
|
|
69
|
+
Spawn claude-md-agent: "Add to CLAUDE.md: [learning]. Discovered during [plan title]. This is non-obvious because [reason]."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If user disagrees with your assessment, adjust accordingly. But make your assessment and act - don't ask them to decide.
|
|
73
|
+
</step>
|
|
74
|
+
|
|
75
|
+
<step name="Present Summary for Human Review">
|
|
76
|
+
Summarize what was accomplished:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
## Plan Complete: [plan title]
|
|
80
|
+
|
|
81
|
+
**Tasks completed**: [N]
|
|
82
|
+
|
|
83
|
+
### What Was Built
|
|
84
|
+
- [Key accomplishment from task outcomes]
|
|
85
|
+
- [Another accomplishment]
|
|
86
|
+
|
|
87
|
+
### Files Changed
|
|
88
|
+
[List notable files or run `git diff --stat`]
|
|
89
|
+
|
|
90
|
+
### Tests
|
|
91
|
+
[Test results summary]
|
|
92
|
+
|
|
93
|
+
### Ready for Review
|
|
94
|
+
Please review the implementation. Check for:
|
|
95
|
+
- Bugs or issues
|
|
96
|
+
- Manual testing needed
|
|
97
|
+
- Anything that doesn't look right
|
|
98
|
+
```
|
|
99
|
+
</step>
|
|
100
|
+
|
|
101
|
+
<step name="Get Approval">
|
|
102
|
+
```
|
|
103
|
+
AskUserQuestion:
|
|
104
|
+
Question: "Does everything look good?"
|
|
105
|
+
Options:
|
|
106
|
+
- "Approved" - Mark plan complete
|
|
107
|
+
- "Found issues" - Let's fix them together
|
|
108
|
+
- "Need more time" - I'll review and get back to you
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**If approved:**
|
|
112
|
+
- Update `plan.yaml`: `status: completed`, `completed: [today's date]`
|
|
113
|
+
- Confirm: "Plan [title] is complete. Run /prime when you have new work."
|
|
114
|
+
|
|
115
|
+
**If issues found:**
|
|
116
|
+
|
|
117
|
+
The orchestrator coordinates work—it gathers information and delegates to execution agents. Follow this flow:
|
|
118
|
+
|
|
119
|
+
1. **Understand the issue** - Ask the user to describe what's wrong. Get specific details: what they expected, what actually happened, which files/features are affected.
|
|
120
|
+
|
|
121
|
+
2. **Identify the responsible task** - Determine which task from the plan relates to this issue. Check the task manifest for context.
|
|
122
|
+
|
|
123
|
+
3. **Delegate the fix** - Spawn an execution-agent with clear context:
|
|
124
|
+
```
|
|
125
|
+
Spawn execution-agent:
|
|
126
|
+
"Fix issue in [task ID]: [Issue description from user]
|
|
127
|
+
|
|
128
|
+
Context:
|
|
129
|
+
- What was expected: [user's expectation]
|
|
130
|
+
- What actually happened: [observed behavior]
|
|
131
|
+
- Relevant files: [files if known]
|
|
132
|
+
|
|
133
|
+
The task manifest is at: [path to manifest]
|
|
134
|
+
Review your original implementation and fix the issue."
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
4. **Re-run verification** - After the fix, run tests/build/lint again
|
|
138
|
+
|
|
139
|
+
5. **Return to approval** - Present updated summary and ask for approval again
|
|
140
|
+
</step>
|
|
141
|
+
|
|
142
|
+
<checkpoint>
|
|
143
|
+
Before closing out:
|
|
144
|
+
- Automated verification passed (tests, build, lint)
|
|
145
|
+
- Learnings assessment was presented (ADR and CLAUDE.md)
|
|
146
|
+
- Any identified learnings were captured
|
|
147
|
+
- Summary was presented to user
|
|
148
|
+
- User approved the work
|
|
149
|
+
</checkpoint>
|
|
150
|
+
|
|
151
|
+
<step name="Close Out">
|
|
152
|
+
Final state:
|
|
153
|
+
- `plan.yaml` has `status: completed`
|
|
154
|
+
- All tasks have `status: completed` in manifest
|
|
155
|
+
- Any new ADRs are created
|
|
156
|
+
- User has approved
|
|
157
|
+
</step>
|
|
158
|
+
|
|
159
|
+
</steps>
|
|
160
|
+
|
|
161
|
+
This is the final phase. The workflow ends here.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Execution Phase 1: Start
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Load the approved plan and decompose it into executable tasks. This bridges planning (what to build) and execution (doing the work).
|
|
6
|
+
|
|
7
|
+
**Success looks like**: Task files exist with clear completion criteria, correct dependencies, and appropriate ADR mapping—ready for the execution loop.
|
|
8
|
+
|
|
9
|
+
## What To Do
|
|
10
|
+
|
|
11
|
+
Complete each step in order before proceeding to the next.
|
|
12
|
+
|
|
13
|
+
<steps>
|
|
14
|
+
|
|
15
|
+
<step name="Load the Plan">
|
|
16
|
+
Read the plan at the path provided (or discovered by SKILL.md):
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
.claude/plans/[slug]/plan.yaml
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If status is not `approved`, tell the user:
|
|
23
|
+
|
|
24
|
+
> "This plan hasn't been approved yet. Run /prime to complete planning first."
|
|
25
|
+
</step>
|
|
26
|
+
|
|
27
|
+
<step name="Decompose">
|
|
28
|
+
Spawn the decomposition-agent to break the plan into tasks:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Spawn decomposition-agent: "Decompose the plan at [plan-path]."
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The agent reads the plan, creates task files, and returns a summary.
|
|
35
|
+
</step>
|
|
36
|
+
|
|
37
|
+
<step name="Review">
|
|
38
|
+
Spawn the decomposition-agent again to review the decomposition:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Spawn decomposition-agent: "Review the decomposition at [plan-dir]."
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The agent checks coverage, dependencies, ADR mapping, and criteria specificity.
|
|
45
|
+
</step>
|
|
46
|
+
|
|
47
|
+
<step name="Iterate">
|
|
48
|
+
If review returns issues:
|
|
49
|
+
1. Spawn decomposition-agent to fix the specific issues
|
|
50
|
+
2. Review again
|
|
51
|
+
3. Repeat until review returns `APPROVED`
|
|
52
|
+
</step>
|
|
53
|
+
|
|
54
|
+
<checkpoint>
|
|
55
|
+
Before proceeding to task execution:
|
|
56
|
+
- Plan has been loaded and verified as approved
|
|
57
|
+
- decomposition-agent has created task files
|
|
58
|
+
- decomposition-agent has reviewed and approved the decomposition
|
|
59
|
+
- manifest.yaml exists with all tasks listed
|
|
60
|
+
</checkpoint>
|
|
61
|
+
|
|
62
|
+
</steps>
|
|
63
|
+
|
|
64
|
+
<transition>
|
|
65
|
+
Once decomposition is approved, read `references/execution/tasks.md` to begin the execution loop.
|
|
66
|
+
</transition>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Execution Phase 2: Tasks
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Execute and review tasks until all are complete. Tasks run in parallel where dependencies allow, with a review step to verify each task meets its criteria.
|
|
6
|
+
|
|
7
|
+
**Success looks like**: All tasks have `status: completed` in the manifest.
|
|
8
|
+
|
|
9
|
+
## What To Do
|
|
10
|
+
|
|
11
|
+
Execute the following loop until all tasks are complete.
|
|
12
|
+
|
|
13
|
+
<steps>
|
|
14
|
+
|
|
15
|
+
<step name="Find Executable Tasks">
|
|
16
|
+
Read `manifest.yaml`. Find tasks where:
|
|
17
|
+
- `status: pending`
|
|
18
|
+
- All `dependencies` have `status: completed`
|
|
19
|
+
|
|
20
|
+
These can all be executed in parallel.
|
|
21
|
+
</step>
|
|
22
|
+
|
|
23
|
+
<step name="Execute">
|
|
24
|
+
For each executable task, spawn execution-agent:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Spawn execution-agent: "Implement task [task-id] at [task-path]."
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The agent reads the task, does the work, writes the outcome, and updates status to `needs_review`.
|
|
31
|
+
|
|
32
|
+
Execute all ready tasks in parallel.
|
|
33
|
+
</step>
|
|
34
|
+
|
|
35
|
+
<step name="Find Reviewable Tasks">
|
|
36
|
+
Read `manifest.yaml` again. Find tasks where:
|
|
37
|
+
- `status: needs_review`
|
|
38
|
+
</step>
|
|
39
|
+
|
|
40
|
+
<step name="Review">
|
|
41
|
+
For each reviewable task, spawn execution-agent:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Spawn execution-agent: "Review task [task-id] at [task-path]."
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The agent verifies each `done_when` criterion. If all pass, it updates status to `completed`. If issues found, it returns the list of problems.
|
|
48
|
+
|
|
49
|
+
Review all ready tasks in parallel.
|
|
50
|
+
</step>
|
|
51
|
+
|
|
52
|
+
<step name="Handle Issues">
|
|
53
|
+
If any review returns issues:
|
|
54
|
+
- Spawn execution-agent to fix: `"Fix these issues in task [task-id]: [issues]"`
|
|
55
|
+
- The agent fixes and leaves status at `needs_review`
|
|
56
|
+
- Next loop iteration will review again
|
|
57
|
+
</step>
|
|
58
|
+
|
|
59
|
+
<step name="Continue">
|
|
60
|
+
Return to the first step. Find next batch of executable tasks.
|
|
61
|
+
|
|
62
|
+
Repeat until `manifest.yaml` shows all tasks with `status: completed`.
|
|
63
|
+
</step>
|
|
64
|
+
|
|
65
|
+
</steps>
|
|
66
|
+
|
|
67
|
+
## Handling Escalation
|
|
68
|
+
|
|
69
|
+
If an execution agent escalates (ADR conflict, invalid assumption, blocked), stop the loop and present to the user:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
AskUserQuestion:
|
|
73
|
+
Question: "Task [id] hit an issue: [description]. How should we proceed?"
|
|
74
|
+
Options:
|
|
75
|
+
- "Help me resolve it" - I'll provide guidance
|
|
76
|
+
- "Skip this task" - Mark blocked, continue with others
|
|
77
|
+
- "Stop execution" - Let's figure this out first
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
After resolving, resume the loop.
|
|
81
|
+
|
|
82
|
+
## Key Points
|
|
83
|
+
|
|
84
|
+
**Parallel execution** - Run all independent tasks at once. Don't serialize unnecessarily.
|
|
85
|
+
|
|
86
|
+
**Fresh context per spawn** - Each agent spawn is stateless. The task file contains everything it needs.
|
|
87
|
+
|
|
88
|
+
**Agents update status** - Execute agent sets `needs_review`, review agent sets `completed`. Orchestrator just reads manifest to find what's ready.
|
|
89
|
+
|
|
90
|
+
<transition>
|
|
91
|
+
When all tasks show `status: completed` in the manifest, read `references/execution/complete.md` to finish.
|
|
92
|
+
</transition>
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Planning Phase 3: Plan Drafting
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Synthesize everything you've learned into a structured plan document. The plan becomes the single source of truth for this work—a contract between planning and execution.
|
|
6
|
+
|
|
7
|
+
Someone should be able to read the plan and understand what's being built WITHOUT having been in the conversation. It captures requirements, context, constraints, and approach in one place.
|
|
8
|
+
|
|
9
|
+
**Success looks like**: A plan.yaml file that's self-contained, realistic (informed by exploration), and actionable (can be decomposed into tasks).
|
|
10
|
+
|
|
11
|
+
## The Right Level of Detail
|
|
12
|
+
|
|
13
|
+
The plan is an **architecture document**, not a technical design document.
|
|
14
|
+
|
|
15
|
+
**Include:**
|
|
16
|
+
- What each component/module is responsible for (natural language)
|
|
17
|
+
- Data models (structures, fields, relationships)
|
|
18
|
+
- API contracts (what gets passed between components, inputs/outputs)
|
|
19
|
+
- How pieces connect and communicate
|
|
20
|
+
|
|
21
|
+
**Keep it at the architecture level.** Define the shape of the system—what exists, what it does, how pieces connect. Leave internal implementation details (function signatures, code snippets, specific algorithms) for execution.
|
|
22
|
+
|
|
23
|
+
This level is right because:
|
|
24
|
+
- It's enough to decompose into tasks during execution
|
|
25
|
+
- It doesn't over-constrain implementation choices
|
|
26
|
+
- It catches integration issues early (if contracts don't make sense, you find out now)
|
|
27
|
+
- Stakeholders can review it and understand what's being built
|
|
28
|
+
|
|
29
|
+
## What To Do
|
|
30
|
+
|
|
31
|
+
Complete each step in order before proceeding to the next.
|
|
32
|
+
|
|
33
|
+
<steps>
|
|
34
|
+
|
|
35
|
+
<step name="Create the Plan Directory">
|
|
36
|
+
Create a directory for this plan:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
.claude/plans/[slug]/
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The slug should be short, descriptive, kebab-case. Examples: `user-auth`, `api-rate-limiting`, `checkout-refactor`.
|
|
43
|
+
</step>
|
|
44
|
+
|
|
45
|
+
<step name="Write plan.yaml">
|
|
46
|
+
Create `plan.yaml` in the plan directory. Pull together everything from requirements (Phase 1) and exploration (Phase 2).
|
|
47
|
+
|
|
48
|
+
**Schema:**
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
id: plan-[slug]
|
|
52
|
+
title: [Descriptive title]
|
|
53
|
+
type: feature | enhancement | refactor
|
|
54
|
+
status: draft
|
|
55
|
+
created: [YYYY-MM-DD]
|
|
56
|
+
updated: [YYYY-MM-DD]
|
|
57
|
+
|
|
58
|
+
problem_statement: |
|
|
59
|
+
[1-2 sentences: What problem are we solving? Why does it matter?]
|
|
60
|
+
|
|
61
|
+
goals:
|
|
62
|
+
- [Goal 1]
|
|
63
|
+
- [Goal 2]
|
|
64
|
+
|
|
65
|
+
success_criteria:
|
|
66
|
+
- [How we'll know it's done - criterion 1]
|
|
67
|
+
- [How we'll know it's done - criterion 2]
|
|
68
|
+
|
|
69
|
+
# From exploration - where this fits in the codebase
|
|
70
|
+
integration_points:
|
|
71
|
+
- component: [name]
|
|
72
|
+
interaction: [how this work interacts with it]
|
|
73
|
+
changes_required: [what needs to change]
|
|
74
|
+
|
|
75
|
+
# Define the shape of data - structures, fields, relationships
|
|
76
|
+
data_models:
|
|
77
|
+
- name: [Model name]
|
|
78
|
+
description: [What it represents]
|
|
79
|
+
fields:
|
|
80
|
+
- name: [field name]
|
|
81
|
+
type: [type]
|
|
82
|
+
description: [purpose]
|
|
83
|
+
|
|
84
|
+
# Define how components communicate - inputs, outputs, contracts
|
|
85
|
+
api_contracts:
|
|
86
|
+
- name: [Interface/endpoint name]
|
|
87
|
+
description: [What it does]
|
|
88
|
+
inputs: [What goes in]
|
|
89
|
+
outputs: [What comes out]
|
|
90
|
+
between: [Component A] -> [Component B]
|
|
91
|
+
|
|
92
|
+
# ADRs that constrain this work
|
|
93
|
+
relevant_adrs:
|
|
94
|
+
- id: ADR-[XXX]
|
|
95
|
+
title: [title]
|
|
96
|
+
constraint: [What this ADR requires us to do or avoid]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Field guidance:**
|
|
100
|
+
|
|
101
|
+
- **Required**: id, title, type, status, created, problem_statement, goals, success_criteria
|
|
102
|
+
- **Include if relevant**: integration_points, data_models, api_contracts, relevant_adrs
|
|
103
|
+
- **Only include fields that were discussed**: The plan reflects the conversation from Phases 1 and 2
|
|
104
|
+
|
|
105
|
+
**Why no approach or risks?** The plan defines WHAT we're building, not HOW. The approach (phases, task breakdown) gets figured out during decomposition in execution. Risks emerge naturally during exploration or decomposition.
|
|
106
|
+
</step>
|
|
107
|
+
|
|
108
|
+
<step name="Present the Draft">
|
|
109
|
+
Show the plan to the user. Highlight:
|
|
110
|
+
- Key decisions made
|
|
111
|
+
- How exploration findings shaped the approach
|
|
112
|
+
- Any risks or concerns
|
|
113
|
+
- Areas where you made judgment calls
|
|
114
|
+
|
|
115
|
+
Summarize it in a readable format first, then offer to show the full plan.yaml if they want details.
|
|
116
|
+
</step>
|
|
117
|
+
|
|
118
|
+
<step name="Surface Ambiguities">
|
|
119
|
+
**Before asking for approval, proactively identify what's unclear or unknown.**
|
|
120
|
+
|
|
121
|
+
Ask yourself: "If I were to execute this plan right now, what information would I be missing? What decisions haven't been made?"
|
|
122
|
+
|
|
123
|
+
Look for:
|
|
124
|
+
- **Placeholder values**: Are there fields that say "TBD" or "[something]" that need real values?
|
|
125
|
+
- **Implicit assumptions**: Did you assume something the user hasn't confirmed?
|
|
126
|
+
- **Missing details**: Are there implementation choices that affect the plan but weren't discussed?
|
|
127
|
+
- **Edge cases**: What happens when things go wrong or inputs are unexpected?
|
|
128
|
+
- **Dependencies**: Are there external factors (APIs, data sources, other systems) with unknowns?
|
|
129
|
+
|
|
130
|
+
**Present any ambiguities you find:**
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
## Potential Ambiguities
|
|
134
|
+
|
|
135
|
+
Before we finalize this plan, I want to flag some things that might need clarification:
|
|
136
|
+
|
|
137
|
+
1. **[Topic]**: [What's unclear and why it matters]
|
|
138
|
+
2. **[Topic]**: [What's unclear and why it matters]
|
|
139
|
+
|
|
140
|
+
Would you like to clarify these now, or are they acceptable unknowns?
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
If you find ambiguities, use AskUserQuestion to resolve them one at a time before proceeding.
|
|
144
|
+
|
|
145
|
+
**If no ambiguities**: State that you reviewed the plan for unknowns and didn't find any that would block execution.
|
|
146
|
+
</step>
|
|
147
|
+
|
|
148
|
+
<step name="Iterate If Needed">
|
|
149
|
+
The user may have feedback. If they want changes:
|
|
150
|
+
- Update the plan.yaml
|
|
151
|
+
- Re-present the updated version
|
|
152
|
+
- Re-check for ambiguities
|
|
153
|
+
- Repeat until they're satisfied
|
|
154
|
+
|
|
155
|
+
Use AskUserQuestion to check:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
AskUserQuestion:
|
|
159
|
+
Question: "How does this plan look?"
|
|
160
|
+
Options:
|
|
161
|
+
- "Looks good" - Ready for validation
|
|
162
|
+
- "Needs changes" - I'll explain what to adjust
|
|
163
|
+
- "Let's discuss" - I have questions before deciding
|
|
164
|
+
- "Start over" - This isn't the right direction
|
|
165
|
+
```
|
|
166
|
+
</step>
|
|
167
|
+
|
|
168
|
+
<checkpoint>
|
|
169
|
+
Before proceeding to the next phase:
|
|
170
|
+
- Plan directory exists at .claude/plans/[slug]/
|
|
171
|
+
- plan.yaml has been written with all required fields
|
|
172
|
+
- Draft has been presented to user
|
|
173
|
+
- Ambiguities have been surfaced and resolved (or explicitly accepted)
|
|
174
|
+
- User has indicated they're satisfied with the draft
|
|
175
|
+
</checkpoint>
|
|
176
|
+
|
|
177
|
+
</steps>
|
|
178
|
+
|
|
179
|
+
## Key Principles
|
|
180
|
+
|
|
181
|
+
**Surface ambiguities proactively.** This is one of the most important things you can do when drafting a plan. Before asking "How does this look?", always ask yourself: "If I were to execute this, what information would I be missing?" Surface those unknowns and resolve them with the user. Ambiguity discovered during execution is expensive; ambiguity discovered during planning is cheap.
|
|
182
|
+
|
|
183
|
+
**Keep implementation details for execution.** The plan stays at the architecture level—function signatures, code snippets, and library choices come later during task execution.
|
|
184
|
+
|
|
185
|
+
**Define data models and contracts clearly.** When components pass data to each other, specify what that data looks like. Clear contracts prevent integration problems.
|
|
186
|
+
|
|
187
|
+
**Match plan complexity to work complexity.** A simple enhancement gets a simple plan. Let the scope of the work determine the size of the document.
|
|
188
|
+
|
|
189
|
+
**Include only what was discussed.** The plan reflects the conversation from Phases 1 and 2. Before adding anything, ask: "Did this come from our requirements or exploration?" If yes, include it. If you're inventing it, leave it out.
|
|
190
|
+
|
|
191
|
+
The plan captures what the user asked for—goals, success criteria, data models, contracts. It stays focused on that.
|
|
192
|
+
|
|
193
|
+
<transition>
|
|
194
|
+
When the user is satisfied with the draft, read `references/planning/finalize.md` to validate against ADRs and get approval.
|
|
195
|
+
</transition>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Planning Phase 2: Codebase Exploration
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Ground the requirements in the reality of the codebase. You know WHAT you're building—now understand WHERE it fits and WHAT CONSTRAINTS exist.
|
|
6
|
+
|
|
7
|
+
This is reconnaissance. You're gathering intelligence so the plan you write is realistic and informed, not wishful thinking that ignores how the codebase actually works.
|
|
8
|
+
|
|
9
|
+
**Success looks like**: You understand the terrain well enough to write a plan with no surprises. You know the integration points, the patterns to follow, and the architectural constraints (ADRs) that apply.
|
|
10
|
+
|
|
11
|
+
## What To Do
|
|
12
|
+
|
|
13
|
+
Complete each step in order before proceeding to the next.
|
|
14
|
+
|
|
15
|
+
<steps>
|
|
16
|
+
|
|
17
|
+
<step name="Identify What You Need to Learn">
|
|
18
|
+
Look at the requirements from Phase 1. Ask yourself:
|
|
19
|
+
|
|
20
|
+
> "What do I need to understand about this codebase to write a realistic plan for this work?"
|
|
21
|
+
|
|
22
|
+
This will vary based on the requirements. A new feature touching authentication needs different exploration than a refactor of the build system. Don't follow a checklist—think about what THIS specific work requires you to understand.
|
|
23
|
+
|
|
24
|
+
Common things you might need to learn:
|
|
25
|
+
- Where would this code live? What components/modules are involved?
|
|
26
|
+
- What existing code would we integrate with or modify?
|
|
27
|
+
- What patterns does this codebase use for similar functionality?
|
|
28
|
+
- Are there conventions for testing, error handling, APIs, etc.?
|
|
29
|
+
- What might make this tricky based on the current architecture?
|
|
30
|
+
</step>
|
|
31
|
+
|
|
32
|
+
<step name="Explore in Parallel">
|
|
33
|
+
Use multiple Plan agents in parallel to explore different aspects of the codebase. Each agent should have a focused question to answer.
|
|
34
|
+
|
|
35
|
+
**How to do this:**
|
|
36
|
+
|
|
37
|
+
Spawn several Plan agents simultaneously, each with a specific exploration goal based on what you identified in Step 1. For example:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Agent 1: "Find where [feature area] is implemented. Identify the key files,
|
|
41
|
+
components, and how they interact."
|
|
42
|
+
|
|
43
|
+
Agent 2: "Look at how similar functionality is implemented elsewhere in the
|
|
44
|
+
codebase. What patterns should we follow?"
|
|
45
|
+
|
|
46
|
+
Agent 3: "Identify what would need to change to support [requirement].
|
|
47
|
+
What are the integration points?"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The specific agents you spawn depend on the requirements. Use your judgment—you know what you need to learn.
|
|
51
|
+
</step>
|
|
52
|
+
|
|
53
|
+
<step name="Find Relevant ADRs">
|
|
54
|
+
While codebase exploration is happening, also spawn the adr-agent to find architectural constraints.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Spawn adr-agent: "Find ADRs that would be relevant to [summary of requirements].
|
|
58
|
+
For each relevant ADR, explain why it matters and what
|
|
59
|
+
constraints it imposes on this work."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
ADRs discovered now will inform the plan you write. Better to know the rules before you design than to discover violations later.
|
|
63
|
+
</step>
|
|
64
|
+
|
|
65
|
+
<step name="Synthesize Findings">
|
|
66
|
+
Once all agents return, synthesize what you learned into a coherent picture:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
## Exploration Findings
|
|
70
|
+
|
|
71
|
+
**Where this work fits:**
|
|
72
|
+
[Which components/modules are involved]
|
|
73
|
+
|
|
74
|
+
**Integration points:**
|
|
75
|
+
[What existing code we'll touch or integrate with]
|
|
76
|
+
|
|
77
|
+
**Patterns to follow:**
|
|
78
|
+
[Conventions and patterns from the codebase we should match]
|
|
79
|
+
|
|
80
|
+
**Relevant ADRs:**
|
|
81
|
+
- [ADR-XXX]: [Why it matters, what it constrains]
|
|
82
|
+
- [ADR-YYY]: [Why it matters, what it constrains]
|
|
83
|
+
|
|
84
|
+
**Potential challenges:**
|
|
85
|
+
[Anything that might make this tricky]
|
|
86
|
+
```
|
|
87
|
+
</step>
|
|
88
|
+
|
|
89
|
+
<step name="Check for Gaps">
|
|
90
|
+
Before moving on, ask yourself:
|
|
91
|
+
|
|
92
|
+
> "Do I know enough to write a realistic plan?"
|
|
93
|
+
|
|
94
|
+
If there are still unknowns that would affect the plan, explore further. If you're confident you understand the terrain, move on.
|
|
95
|
+
|
|
96
|
+
You can also check with the user:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
AskUserQuestion:
|
|
100
|
+
Question: "I've explored the codebase. Ready to see what I found, or is there
|
|
101
|
+
something specific you want me to investigate first?"
|
|
102
|
+
Options:
|
|
103
|
+
- "Show me what you found" - Present the findings
|
|
104
|
+
- "Also look into..." - I'll tell you what else to explore
|
|
105
|
+
- "Let's move on" - Skip to drafting
|
|
106
|
+
```
|
|
107
|
+
</step>
|
|
108
|
+
|
|
109
|
+
<checkpoint>
|
|
110
|
+
Before proceeding to the next phase:
|
|
111
|
+
- Codebase exploration agents have returned findings
|
|
112
|
+
- ADR constraints have been identified
|
|
113
|
+
- Findings have been synthesized and presented
|
|
114
|
+
- No critical unknowns remain
|
|
115
|
+
</checkpoint>
|
|
116
|
+
|
|
117
|
+
</steps>
|
|
118
|
+
|
|
119
|
+
## Key Principles
|
|
120
|
+
|
|
121
|
+
**Gather information, save decisions for later.** You're exploring, not designing. Note what you find; implementation decisions come during drafting.
|
|
122
|
+
|
|
123
|
+
**Stay focused on this work.** Explore what's relevant to the requirements. A targeted investigation beats a comprehensive codebase tour.
|
|
124
|
+
|
|
125
|
+
**Find ADRs early.** Architectural constraints discovered now save expensive rework later. Include them in your exploration.
|
|
126
|
+
|
|
127
|
+
<transition>
|
|
128
|
+
When you have a clear picture of where this work fits, what patterns to follow, and what ADRs constrain it, read `references/planning/draft.md` to continue to plan drafting.
|
|
129
|
+
</transition>
|