5-phase-workflow 1.0.0
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/README.md +332 -0
- package/bin/install.js +408 -0
- package/docs/workflow-guide.md +1024 -0
- package/package.json +34 -0
- package/src/agents/integration-agent.md +219 -0
- package/src/agents/review-processor.md +160 -0
- package/src/agents/step-executor.md +108 -0
- package/src/agents/step-fixer.md +132 -0
- package/src/agents/step-verifier.md +125 -0
- package/src/agents/verification-agent.md +411 -0
- package/src/commands/5/configure.md +309 -0
- package/src/commands/5/discuss-feature.md +393 -0
- package/src/commands/5/implement-feature.md +502 -0
- package/src/commands/5/plan-feature.md +285 -0
- package/src/commands/5/plan-implementation.md +376 -0
- package/src/commands/5/quick-implement.md +263 -0
- package/src/commands/5/review-code.md +583 -0
- package/src/commands/5/verify-implementation.md +277 -0
- package/src/hooks/statusline.js +53 -0
- package/src/settings.json +6 -0
- package/src/skills/build-project/SKILL.md +277 -0
- package/src/skills/configure-project/SKILL.md +355 -0
- package/src/skills/generate-readme/EXAMPLES.md +168 -0
- package/src/skills/generate-readme/SKILL.md +123 -0
- package/src/skills/generate-readme/TEMPLATE.md +141 -0
- package/src/skills/run-tests/SKILL.md +365 -0
- package/src/templates/ARCHITECTURE.md +64 -0
- package/src/templates/CONCERNS.md +75 -0
- package/src/templates/CONVENTIONS.md +75 -0
- package/src/templates/INTEGRATIONS.md +65 -0
- package/src/templates/STACK.md +60 -0
- package/src/templates/STRUCTURE.md +60 -0
- package/src/templates/TESTING.md +107 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 5:plan-feature
|
|
3
|
+
description: Plans feature implementation by analyzing requirements, identifying affected modules, and creating a structured feature specification. Use at the start of any new feature to ensure systematic implementation. This is Phase 1 of the 5-phase workflow.
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Task, AskUserQuestion
|
|
5
|
+
context: fork
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Plan Feature Implementation (Phase 1)
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
This skill is the **first phase** of the 5-phase workflow:
|
|
14
|
+
1. **Feature Planning** (this skill) - Understand requirements, create feature spec
|
|
15
|
+
2. **Implementation Planning** - Map to technical components and skills
|
|
16
|
+
3. **Orchestrated Implementation** - Execute with state tracking
|
|
17
|
+
4. **Verify Implementation** - Check completeness and correctness
|
|
18
|
+
5. **Code Review** - Apply automated quality improvements
|
|
19
|
+
|
|
20
|
+
This skill guides intensive collaboration with the developer to understand requirements, challenge assumptions, and create a comprehensive feature specification.
|
|
21
|
+
|
|
22
|
+
## Planning Process
|
|
23
|
+
|
|
24
|
+
### Step 1: Gather Feature Description
|
|
25
|
+
|
|
26
|
+
**FIRST ACTION:** Ask the developer for the feature description using AskUserQuestion.
|
|
27
|
+
|
|
28
|
+
- Expect a **free-text answer**
|
|
29
|
+
- Do NOT provide options
|
|
30
|
+
- Do NOT ask follow-up questions yet
|
|
31
|
+
- This input may be multiple paragraphs
|
|
32
|
+
|
|
33
|
+
Prompt to use:
|
|
34
|
+
|
|
35
|
+
"Please describe the feature you want to develop. Paste the full ticket description or explain it in your own words."
|
|
36
|
+
|
|
37
|
+
Do NOT ask for ticket ID - it will be extracted from the branch name automatically.
|
|
38
|
+
|
|
39
|
+
### Step 2: Extract Ticket ID from Branch Name
|
|
40
|
+
|
|
41
|
+
Automatically extract the ticket ID from the current git branch:
|
|
42
|
+
- Branch format: `{TICKET-ID}-description` (ticket is prefix)
|
|
43
|
+
- Use `git branch --show-current` to get branch name
|
|
44
|
+
- Extract ticket ID using configurable pattern from config (e.g., `PROJ-\d+` or `\d+`)
|
|
45
|
+
- Ask the developer if the ticket ID is correct
|
|
46
|
+
- If no ticket ID found, ask developer for it
|
|
47
|
+
|
|
48
|
+
### Step 3: Analyze Existing Codebase
|
|
49
|
+
|
|
50
|
+
Explore the codebase to understand existing patterns and identify affected modules:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
1. Explore the project structure to identify modules/components
|
|
54
|
+
- Use Glob to discover relevant directories
|
|
55
|
+
- Look for patterns that indicate module organization
|
|
56
|
+
|
|
57
|
+
2. Check existing implementations in relevant modules
|
|
58
|
+
- Search for similar features or components
|
|
59
|
+
- Identify coding patterns and conventions
|
|
60
|
+
|
|
61
|
+
3. Check for similar patterns across the codebase
|
|
62
|
+
- Search for class/function patterns that might be reusable
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Use Task tool with subagent_type=Explore for complex exploration.
|
|
66
|
+
|
|
67
|
+
**Goal:** Understand what already exists so you can ask informed questions.
|
|
68
|
+
|
|
69
|
+
### Step 4: Intensive Collaboration (5-10 Questions)
|
|
70
|
+
|
|
71
|
+
**CRITICAL:** After exploring the codebase, engage in intensive Q&A using the AskUserQuestion tool. Ask 5-10 clarifying questions based on your findings. This is NOT optional.
|
|
72
|
+
|
|
73
|
+
**Question categories to explore:**
|
|
74
|
+
|
|
75
|
+
1. **Requirements Clarity**
|
|
76
|
+
- What exactly should this feature do?
|
|
77
|
+
- What is the expected user experience?
|
|
78
|
+
- What are the inputs and outputs?
|
|
79
|
+
|
|
80
|
+
2. **Scope Boundaries**
|
|
81
|
+
- What is explicitly IN scope?
|
|
82
|
+
- What is explicitly OUT of scope?
|
|
83
|
+
- Are there any constraints or limitations?
|
|
84
|
+
|
|
85
|
+
3. **Edge Cases**
|
|
86
|
+
- What happens when X fails?
|
|
87
|
+
- How should the system handle invalid inputs?
|
|
88
|
+
- What are the boundary conditions?
|
|
89
|
+
|
|
90
|
+
4. **Performance Expectations**
|
|
91
|
+
- Are there performance requirements?
|
|
92
|
+
- How much data needs to be handled?
|
|
93
|
+
- Are there concurrency concerns?
|
|
94
|
+
|
|
95
|
+
5. **Testing Strategy**
|
|
96
|
+
- How will we verify this works?
|
|
97
|
+
- What are the acceptance criteria?
|
|
98
|
+
- What test scenarios should be covered?
|
|
99
|
+
|
|
100
|
+
6. **Integration Points**
|
|
101
|
+
- Which existing components/modules are affected?
|
|
102
|
+
- Are there API changes?
|
|
103
|
+
- How does this interact with existing features?
|
|
104
|
+
|
|
105
|
+
7. **Alternative Approaches**
|
|
106
|
+
- Have you considered approach X instead?
|
|
107
|
+
- Is this the simplest solution?
|
|
108
|
+
- Could we reuse existing components?
|
|
109
|
+
|
|
110
|
+
8. **Complexity Trade-offs**
|
|
111
|
+
- What is the complexity vs value trade-off?
|
|
112
|
+
- Should this be broken into smaller features?
|
|
113
|
+
- Are there simpler alternatives?
|
|
114
|
+
|
|
115
|
+
**Challenge assumptions:**
|
|
116
|
+
- "Is this the simplest solution?"
|
|
117
|
+
- "Have you considered X alternative?"
|
|
118
|
+
- "What happens when Y fails?"
|
|
119
|
+
- "Could we use existing Z component instead?"
|
|
120
|
+
- "Is a full factory needed or just simple creation?"
|
|
121
|
+
|
|
122
|
+
Use AskUserQuestion to present options and trade-offs. Multiple questions can be asked in batches.
|
|
123
|
+
|
|
124
|
+
### Step 5: Determine Feature Name
|
|
125
|
+
|
|
126
|
+
Based on the feature description and discussion:
|
|
127
|
+
- Create a short, kebab-case description (e.g., "add-emergency-schedule")
|
|
128
|
+
- This will be used for the feature spec filename: `{TICKET-ID}-{description}.md`
|
|
129
|
+
|
|
130
|
+
### Step 6: Create Feature Specification
|
|
131
|
+
|
|
132
|
+
Write a comprehensive feature spec to `.5/{TICKET-ID}-{description}/feature.md` with the following structure:
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
# Feature: {TICKET-ID} - {Title}
|
|
136
|
+
|
|
137
|
+
## Ticket ID
|
|
138
|
+
{TICKET-ID}
|
|
139
|
+
|
|
140
|
+
## Summary
|
|
141
|
+
{1-2 sentence overview of what will be implemented}
|
|
142
|
+
|
|
143
|
+
## Problem Statement
|
|
144
|
+
{Why is this feature needed? What problem does it solve?}
|
|
145
|
+
|
|
146
|
+
## Requirements
|
|
147
|
+
|
|
148
|
+
### Functional Requirements
|
|
149
|
+
- {Requirement 1}
|
|
150
|
+
- {Requirement 2}
|
|
151
|
+
- ...
|
|
152
|
+
|
|
153
|
+
### Non-Functional Requirements
|
|
154
|
+
- {Performance requirements}
|
|
155
|
+
- {Compatibility requirements}
|
|
156
|
+
- ...
|
|
157
|
+
|
|
158
|
+
## Constraints
|
|
159
|
+
- {Business constraints}
|
|
160
|
+
- {Technical constraints}
|
|
161
|
+
- {Time/resource constraints}
|
|
162
|
+
|
|
163
|
+
## Affected Components
|
|
164
|
+
- **{component/module-1}** - {What changes here}
|
|
165
|
+
- **{component/module-2}** - {What changes here}
|
|
166
|
+
- **{component/module-3}** - {What changes here}
|
|
167
|
+
- ...
|
|
168
|
+
|
|
169
|
+
## Entity/Component Definitions
|
|
170
|
+
|
|
171
|
+
### {EntityName} (if applicable)
|
|
172
|
+
| Field | Type | Required | Description |
|
|
173
|
+
|-------|------|----------|-------------|
|
|
174
|
+
| id | {Entity}Id | Yes | Unique identifier |
|
|
175
|
+
| name | String | Yes | Entity name |
|
|
176
|
+
| ... | ... | ... | ... |
|
|
177
|
+
|
|
178
|
+
### Business Rules
|
|
179
|
+
- {Rule 1}
|
|
180
|
+
- {Rule 2}
|
|
181
|
+
- ...
|
|
182
|
+
|
|
183
|
+
## Acceptance Criteria
|
|
184
|
+
- [ ] {Criterion 1 - how to verify success}
|
|
185
|
+
- [ ] {Criterion 2}
|
|
186
|
+
- [ ] {Criterion 3}
|
|
187
|
+
- ...
|
|
188
|
+
|
|
189
|
+
## Alternatives Considered
|
|
190
|
+
|
|
191
|
+
### Option 1: {Alternative approach}
|
|
192
|
+
**Pros:** {Benefits}
|
|
193
|
+
**Cons:** {Drawbacks}
|
|
194
|
+
**Decision:** Rejected because {reason}
|
|
195
|
+
|
|
196
|
+
### Option 2: {Another alternative}
|
|
197
|
+
**Pros:** {Benefits}
|
|
198
|
+
**Cons:** {Drawbacks}
|
|
199
|
+
**Decision:** Rejected because {reason}
|
|
200
|
+
|
|
201
|
+
### Chosen Approach: {Selected approach}
|
|
202
|
+
**Rationale:** {Why this approach was chosen}
|
|
203
|
+
|
|
204
|
+
## Questions & Answers
|
|
205
|
+
|
|
206
|
+
### Q1: {Question from collaboration phase}
|
|
207
|
+
**A:** {Answer from developer}
|
|
208
|
+
|
|
209
|
+
### Q2: {Question}
|
|
210
|
+
**A:** {Answer}
|
|
211
|
+
|
|
212
|
+
...
|
|
213
|
+
|
|
214
|
+
## Next Steps
|
|
215
|
+
After approval, run: `/plan-implementation {TICKET-ID}-{description}`
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Instructions
|
|
219
|
+
|
|
220
|
+
1. **Ask for feature description** - Request task description and additional information from developer
|
|
221
|
+
2. **Extract Ticket ID** - Get current branch name and extract ticket ID using configured pattern
|
|
222
|
+
3. **Explore the codebase** - Understand existing patterns and affected modules
|
|
223
|
+
4. **Ask 5-10 clarifying questions** - Based on findings, ask informed questions using AskUserQuestion - This is MANDATORY
|
|
224
|
+
5. **Challenge assumptions** - Present alternatives, question complexity
|
|
225
|
+
6. **Determine feature name** - Create short kebab-case description
|
|
226
|
+
7. **Create feature specification** in `.5/{TICKET-ID}-{description}/feature.md`
|
|
227
|
+
8. **Inform the developer** to review the spec and then run `/plan-implementation {TICKET-ID}-{description}`
|
|
228
|
+
|
|
229
|
+
## Key Principles
|
|
230
|
+
|
|
231
|
+
1. **Feature description first** - Get context before asking detailed questions
|
|
232
|
+
2. **Auto-extract ticket ID** - Parse from branch name automatically
|
|
233
|
+
3. **Explore before questioning** - Understand codebase to ask informed questions
|
|
234
|
+
4. **Challenge assumptions** - Don't accept requirements at face value
|
|
235
|
+
5. **Explore alternatives** - Present options and trade-offs
|
|
236
|
+
6. **Document decisions** - Capture why choices were made
|
|
237
|
+
7. **Structured output** - Use the feature spec template consistently
|
|
238
|
+
8. **Clear handoff** - Tell developer what to do next
|
|
239
|
+
|
|
240
|
+
## DO NOT in This Skill
|
|
241
|
+
|
|
242
|
+
- DO NOT ask for ticket ID (extract from branch name automatically)
|
|
243
|
+
- DO NOT skip asking for feature description first
|
|
244
|
+
- DO NOT ask questions before exploring the codebase
|
|
245
|
+
- DO NOT create TodoWrite task lists (that's Phase 2's job)
|
|
246
|
+
- DO NOT map components to skills (that's Phase 2's job)
|
|
247
|
+
- DO NOT start implementation (that's Phase 3's job)
|
|
248
|
+
- DO NOT skip the intensive Q&A phase
|
|
249
|
+
- DO NOT accept vague requirements
|
|
250
|
+
|
|
251
|
+
## Common Feature Types
|
|
252
|
+
|
|
253
|
+
### New Component/Module
|
|
254
|
+
- Requires: Core logic, data structures, tests
|
|
255
|
+
- Questions: Validation rules? Business logic? API design?
|
|
256
|
+
|
|
257
|
+
### Extend Existing Component
|
|
258
|
+
- Requires: Update existing code, maintain compatibility
|
|
259
|
+
- Questions: Breaking change? Migration needed? Impact on existing functionality?
|
|
260
|
+
|
|
261
|
+
### Add Business Rule
|
|
262
|
+
- Requires: Logic implementation, validation
|
|
263
|
+
- Questions: When is rule enforced? What are edge cases?
|
|
264
|
+
|
|
265
|
+
### API Endpoint
|
|
266
|
+
- Requires: Endpoint implementation, request/response handling
|
|
267
|
+
- Questions: API design? Error handling? Authentication?
|
|
268
|
+
|
|
269
|
+
## Example Workflow
|
|
270
|
+
|
|
271
|
+
1. User runs: `/plan-feature`
|
|
272
|
+
2. Skill asks: "Please describe the feature you want to develop"
|
|
273
|
+
3. User: "I want to add emergency schedule tracking to products. It should allow marking products as emergency and setting a schedule window."
|
|
274
|
+
4. Skill extracts: Ticket ID `PROJ-1234` from branch `PROJ-1234-add-emergency-schedule`
|
|
275
|
+
5. Skill explores: Checks Product model, related components, existing scheduling infrastructure
|
|
276
|
+
6. Skill asks 8 informed questions about requirements, scope, validation, API, etc.
|
|
277
|
+
7. Skill challenges: "Could we reuse existing scheduling infrastructure instead of creating new one?"
|
|
278
|
+
8. Skill determines: Feature name `add-emergency-schedule`
|
|
279
|
+
9. Skill creates: `.5/PROJ-1234-add-emergency-schedule/feature.md`
|
|
280
|
+
10. Skill tells user: "Feature spec created. Please review and then run `/plan-implementation PROJ-1234-add-emergency-schedule`"
|
|
281
|
+
11. Skill tells user: "If the feature needs refinements, run `/discuss-feature PROJ-1234-add-emergency-schedule`"
|
|
282
|
+
|
|
283
|
+
## Related Documentation
|
|
284
|
+
|
|
285
|
+
- [5-Phase Workflow Guide](../docs/workflow-guide.md)
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 5:plan-implementation
|
|
3
|
+
description: Creates a precise, AI-executable implementation plan. Performs all codebase analysis upfront and produces self-contained component prompts that can be executed by haiku without exploration. Phase 2 of the 5-phase workflow.
|
|
4
|
+
allowed-tools: Read, Glob, Grep, Task, AskUserQuestion, Write
|
|
5
|
+
context: fork
|
|
6
|
+
user-invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Plan Implementation (Phase 2)
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
This skill is the **second phase** of the 5-phase workflow:
|
|
14
|
+
1. **Feature Planning** - Understand requirements, create feature spec (completed)
|
|
15
|
+
2. **Implementation Planning** (this skill) - Analyze codebase, produce AI-executable plan
|
|
16
|
+
3. **Orchestrated Implementation** - Execute plan with haiku agents
|
|
17
|
+
4. **Verify Implementation** - Check completeness and correctness
|
|
18
|
+
5. **Code Review** - Apply automated quality improvements
|
|
19
|
+
|
|
20
|
+
**Critical design constraint:** The plan must be executable by haiku-model agents without any codebase exploration. This means YOU must do all analysis upfront and embed everything into the plan: exact file paths, exact code patterns, reference snippets, imports, and complete instructions.
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
Before invoking this skill, ensure:
|
|
25
|
+
1. Feature spec exists at `.5/{TICKET-ID}-{description}/feature.md`
|
|
26
|
+
2. Feature spec has been reviewed and approved by developer
|
|
27
|
+
3. You have the feature name/ticket ID ready
|
|
28
|
+
|
|
29
|
+
## Planning Process
|
|
30
|
+
|
|
31
|
+
### Step 1: Read Feature Specification
|
|
32
|
+
|
|
33
|
+
Read the feature spec from `.5/{feature-name}/feature.md`.
|
|
34
|
+
|
|
35
|
+
Extract:
|
|
36
|
+
- Ticket ID
|
|
37
|
+
- Summary
|
|
38
|
+
- Requirements (functional and non-functional)
|
|
39
|
+
- Affected domains
|
|
40
|
+
- Entity definitions
|
|
41
|
+
- Business rules
|
|
42
|
+
- Acceptance criteria
|
|
43
|
+
|
|
44
|
+
### Step 2: Deep Codebase Analysis
|
|
45
|
+
|
|
46
|
+
**This is the most important step.** You must gather all context that the executor agents will need, because they cannot explore the codebase themselves.
|
|
47
|
+
|
|
48
|
+
**2a. Project structure:**
|
|
49
|
+
- Use Glob to map the directory structure
|
|
50
|
+
- Identify source directories, test directories, config locations
|
|
51
|
+
- Understand module/package organization
|
|
52
|
+
|
|
53
|
+
**2b. Existing patterns (read actual files):**
|
|
54
|
+
- Find 1-2 existing examples of each component type needed (e.g., an existing service, model, controller)
|
|
55
|
+
- Read them fully to extract:
|
|
56
|
+
- Import statements and patterns
|
|
57
|
+
- Class/function structure
|
|
58
|
+
- Naming conventions (file names, variable names, export style)
|
|
59
|
+
- Error handling patterns
|
|
60
|
+
- Test patterns
|
|
61
|
+
|
|
62
|
+
**2c. Dependencies and integration points:**
|
|
63
|
+
- Read registration files, route files, module declarations
|
|
64
|
+
- Understand how new components get wired in
|
|
65
|
+
- Identify exact locations where modifications are needed (file path + line context)
|
|
66
|
+
|
|
67
|
+
**2d. Build/test configuration:**
|
|
68
|
+
- Read `.claude/.5/config.json` for build commands
|
|
69
|
+
- Read available skills from `.claude/skills/`
|
|
70
|
+
|
|
71
|
+
### Step 3: Technical Collaboration (3-5 Questions)
|
|
72
|
+
|
|
73
|
+
Ask targeted technical questions using AskUserQuestion:
|
|
74
|
+
- Data layer decisions (persistence, query patterns)
|
|
75
|
+
- Validation requirements
|
|
76
|
+
- API design choices
|
|
77
|
+
- Whether to create new vs extend existing components
|
|
78
|
+
- Challenge the approach: suggest simpler alternatives
|
|
79
|
+
|
|
80
|
+
### Step 4: Map Components to Skills
|
|
81
|
+
|
|
82
|
+
For each component, determine:
|
|
83
|
+
- Which skill creates it (from `.claude/skills/`)
|
|
84
|
+
- Or `null` if no matching skill exists (component will be created directly via Write/Edit)
|
|
85
|
+
|
|
86
|
+
### Step 5: Determine Dependency Steps
|
|
87
|
+
|
|
88
|
+
Group components by dependencies:
|
|
89
|
+
1. Components with no dependencies → first step (parallel)
|
|
90
|
+
2. Components depending on step 1 → second step
|
|
91
|
+
3. Continue until all assigned
|
|
92
|
+
4. Name steps based on content
|
|
93
|
+
|
|
94
|
+
### Step 6: Build Component Prompts
|
|
95
|
+
|
|
96
|
+
**For each component, create a complete, self-contained execution prompt.** This prompt must contain everything a haiku agent needs to create the file without exploring anything.
|
|
97
|
+
|
|
98
|
+
**For `action: create` components, the prompt must include:**
|
|
99
|
+
- The complete file content to write, OR
|
|
100
|
+
- A reference snippet from an existing file + clear instructions on what to change
|
|
101
|
+
- All import statements
|
|
102
|
+
- All type definitions needed
|
|
103
|
+
- Exact file path
|
|
104
|
+
|
|
105
|
+
**For `action: modify` components, the prompt must include:**
|
|
106
|
+
- The exact file path
|
|
107
|
+
- The exact `old_string` to find (copied from the actual file)
|
|
108
|
+
- The exact `new_string` to replace it with
|
|
109
|
+
- Context about what's above/below to ensure uniqueness
|
|
110
|
+
|
|
111
|
+
**Prompt quality checklist:**
|
|
112
|
+
- Could a developer who has never seen this codebase execute this prompt? If no, add more context.
|
|
113
|
+
- Are all imports specified? If the component imports from other new components in this plan, are those paths correct?
|
|
114
|
+
- Is the file path correct relative to the project root?
|
|
115
|
+
- For modifications: is the old_string unique in the file?
|
|
116
|
+
|
|
117
|
+
### Step 7: Write Implementation Plan
|
|
118
|
+
|
|
119
|
+
Write the plan to `.5/{feature-name}/plan.md` using this exact format:
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
# Plan: {TICKET-ID} - {Title}
|
|
123
|
+
|
|
124
|
+
## Meta
|
|
125
|
+
feature: {feature-name}
|
|
126
|
+
ticket: {ticket-id}
|
|
127
|
+
total_steps: {N}
|
|
128
|
+
total_components: {N}
|
|
129
|
+
new_files: {N}
|
|
130
|
+
modified_files: {N}
|
|
131
|
+
|
|
132
|
+
## Summary
|
|
133
|
+
{1-2 sentences: what this plan builds and why}
|
|
134
|
+
|
|
135
|
+
## Steps
|
|
136
|
+
|
|
137
|
+
### step: 1
|
|
138
|
+
name: "{descriptive name}"
|
|
139
|
+
mode: parallel | sequential
|
|
140
|
+
|
|
141
|
+
#### component: {component-id}
|
|
142
|
+
action: create | modify
|
|
143
|
+
file: "{exact/path/to/file.ext}"
|
|
144
|
+
skill: "{skill-name}" | null
|
|
145
|
+
depends_on: []
|
|
146
|
+
prompt: |
|
|
147
|
+
{Complete, self-contained execution instructions.
|
|
148
|
+
For create: include full file content or reference snippet + modifications.
|
|
149
|
+
For modify: include exact old_string and new_string.
|
|
150
|
+
Include all imports. Include all types.
|
|
151
|
+
This prompt is passed directly to a haiku agent that cannot explore the codebase.}
|
|
152
|
+
|
|
153
|
+
#### component: {component-id-2}
|
|
154
|
+
action: create | modify
|
|
155
|
+
file: "{exact/path/to/file.ext}"
|
|
156
|
+
skill: "{skill-name}" | null
|
|
157
|
+
depends_on: []
|
|
158
|
+
prompt: |
|
|
159
|
+
{Complete instructions}
|
|
160
|
+
|
|
161
|
+
### step: 2
|
|
162
|
+
name: "{descriptive name}"
|
|
163
|
+
mode: parallel | sequential
|
|
164
|
+
|
|
165
|
+
#### component: {component-id-3}
|
|
166
|
+
action: create | modify
|
|
167
|
+
file: "{exact/path/to/file.ext}"
|
|
168
|
+
skill: null
|
|
169
|
+
depends_on: ["{component-id}", "{component-id-2}"]
|
|
170
|
+
prompt: |
|
|
171
|
+
{Complete instructions}
|
|
172
|
+
|
|
173
|
+
## Verification
|
|
174
|
+
build_command: "{from config}"
|
|
175
|
+
test_command: "{from config}"
|
|
176
|
+
expected_new_files:
|
|
177
|
+
- "{path1}"
|
|
178
|
+
- "{path2}"
|
|
179
|
+
expected_modified_files:
|
|
180
|
+
- "{path3}"
|
|
181
|
+
|
|
182
|
+
## Risks
|
|
183
|
+
- "{risk 1}: {mitigation}"
|
|
184
|
+
- "{risk 2}: {mitigation}"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Step 8: Inform Developer
|
|
188
|
+
|
|
189
|
+
After creating the implementation plan, tell the developer:
|
|
190
|
+
|
|
191
|
+
1. "Implementation plan created at `.5/{feature-name}/plan.md`"
|
|
192
|
+
2. "{N} components across {M} steps"
|
|
193
|
+
3. "Each component has a self-contained execution prompt for haiku agents"
|
|
194
|
+
4. "Please review, then run: `/5:implement-feature {feature-name}`"
|
|
195
|
+
|
|
196
|
+
## Component Prompt Examples
|
|
197
|
+
|
|
198
|
+
### Example: Create a new TypeScript service
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
#### component: schedule-service
|
|
202
|
+
action: create
|
|
203
|
+
file: "src/services/ScheduleService.ts"
|
|
204
|
+
skill: null
|
|
205
|
+
depends_on: ["schedule-model"]
|
|
206
|
+
prompt: |
|
|
207
|
+
Create file `src/services/ScheduleService.ts` with this content:
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { Schedule } from '../models/Schedule';
|
|
211
|
+
import { ScheduleRepository } from '../repositories/ScheduleRepository';
|
|
212
|
+
import { ValidationError } from '../errors/ValidationError';
|
|
213
|
+
|
|
214
|
+
export class ScheduleService {
|
|
215
|
+
constructor(private readonly repo: ScheduleRepository) {}
|
|
216
|
+
|
|
217
|
+
async create(data: { name: string; startDate: Date; endDate: Date }): Promise<Schedule> {
|
|
218
|
+
if (data.endDate <= data.startDate) {
|
|
219
|
+
throw new ValidationError('endDate must be after startDate');
|
|
220
|
+
}
|
|
221
|
+
return this.repo.save(new Schedule(data));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
async findById(id: string): Promise<Schedule | null> {
|
|
225
|
+
return this.repo.findById(id);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async delete(id: string): Promise<void> {
|
|
229
|
+
return this.repo.delete(id);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
This follows the pattern from `src/services/UserService.ts`.
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Example: Modify an existing router file
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
#### component: register-schedule-routes
|
|
241
|
+
action: modify
|
|
242
|
+
file: "src/routes/index.ts"
|
|
243
|
+
skill: null
|
|
244
|
+
depends_on: ["schedule-controller"]
|
|
245
|
+
prompt: |
|
|
246
|
+
Modify file `src/routes/index.ts`.
|
|
247
|
+
|
|
248
|
+
Find this exact string:
|
|
249
|
+
```
|
|
250
|
+
// Route registrations
|
|
251
|
+
app.use('/api/users', userRoutes);
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Replace with:
|
|
255
|
+
```
|
|
256
|
+
// Route registrations
|
|
257
|
+
app.use('/api/users', userRoutes);
|
|
258
|
+
app.use('/api/schedules', scheduleRoutes);
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Also add this import at the top of the file, after the existing imports:
|
|
262
|
+
Find: `import { userRoutes } from './userRoutes';`
|
|
263
|
+
Replace with:
|
|
264
|
+
```
|
|
265
|
+
import { userRoutes } from './userRoutes';
|
|
266
|
+
import { scheduleRoutes } from './scheduleRoutes';
|
|
267
|
+
```
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Example: Create a test file
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
#### component: schedule-service-test
|
|
274
|
+
action: create
|
|
275
|
+
file: "src/services/__tests__/ScheduleService.test.ts"
|
|
276
|
+
skill: null
|
|
277
|
+
depends_on: ["schedule-service"]
|
|
278
|
+
prompt: |
|
|
279
|
+
Create file `src/services/__tests__/ScheduleService.test.ts` with this content:
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
import { ScheduleService } from '../ScheduleService';
|
|
283
|
+
import { ScheduleRepository } from '../../repositories/ScheduleRepository';
|
|
284
|
+
import { ValidationError } from '../../errors/ValidationError';
|
|
285
|
+
|
|
286
|
+
describe('ScheduleService', () => {
|
|
287
|
+
let service: ScheduleService;
|
|
288
|
+
let mockRepo: jest.Mocked<ScheduleRepository>;
|
|
289
|
+
|
|
290
|
+
beforeEach(() => {
|
|
291
|
+
mockRepo = {
|
|
292
|
+
save: jest.fn(),
|
|
293
|
+
findById: jest.fn(),
|
|
294
|
+
delete: jest.fn(),
|
|
295
|
+
} as any;
|
|
296
|
+
service = new ScheduleService(mockRepo);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
describe('create', () => {
|
|
300
|
+
it('creates a schedule with valid dates', async () => {
|
|
301
|
+
const data = {
|
|
302
|
+
name: 'Test',
|
|
303
|
+
startDate: new Date('2026-01-01'),
|
|
304
|
+
endDate: new Date('2026-01-31'),
|
|
305
|
+
};
|
|
306
|
+
mockRepo.save.mockResolvedValue({ id: '1', ...data } as any);
|
|
307
|
+
const result = await service.create(data);
|
|
308
|
+
expect(mockRepo.save).toHaveBeenCalled();
|
|
309
|
+
expect(result).toBeDefined();
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('throws if endDate <= startDate', async () => {
|
|
313
|
+
const data = {
|
|
314
|
+
name: 'Test',
|
|
315
|
+
startDate: new Date('2026-01-31'),
|
|
316
|
+
endDate: new Date('2026-01-01'),
|
|
317
|
+
};
|
|
318
|
+
await expect(service.create(data)).rejects.toThrow(ValidationError);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
This follows the test pattern from `src/services/__tests__/UserService.test.ts`.
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Instructions Summary
|
|
328
|
+
|
|
329
|
+
1. **Read feature spec** from `.5/{feature-name}/feature.md`
|
|
330
|
+
2. **Deep codebase analysis** - Read actual files, extract patterns, imports, conventions. This is the critical step.
|
|
331
|
+
3. **Ask 3-5 technical questions** - Clarify implementation details
|
|
332
|
+
4. **Map components to skills** - Check `.claude/skills/` for available skills
|
|
333
|
+
5. **Group into dependency steps** - Based on component dependencies
|
|
334
|
+
6. **Build self-contained prompts** - Each prompt must be executable by haiku without exploration
|
|
335
|
+
7. **Write plan** to `.5/{feature-name}/plan.md` in the structured format
|
|
336
|
+
8. **Inform developer** to review and run `/5:implement-feature`
|
|
337
|
+
|
|
338
|
+
## Key Principles
|
|
339
|
+
|
|
340
|
+
1. **Haiku-ready prompts** - Every component prompt is self-contained with all context baked in
|
|
341
|
+
2. **No exploration by executors** - All codebase analysis happens here in Phase 2
|
|
342
|
+
3. **Exact file paths** - No guessing, no pattern matching needed
|
|
343
|
+
4. **Reference code inline** - Include actual snippets, not "look at file X"
|
|
344
|
+
5. **Dependency-driven steps** - Step grouping from component dependencies
|
|
345
|
+
6. **Verify prompt quality** - Could someone with no codebase knowledge execute it?
|
|
346
|
+
|
|
347
|
+
## DO NOT
|
|
348
|
+
|
|
349
|
+
- DO NOT start implementation (that's Phase 3's job)
|
|
350
|
+
- DO NOT create state files (that's `/implement-feature`'s job)
|
|
351
|
+
- DO NOT write vague prompts like "follow existing patterns" without including the pattern
|
|
352
|
+
- DO NOT skip codebase analysis - reading actual files is mandatory
|
|
353
|
+
- DO NOT leave file paths ambiguous
|
|
354
|
+
- DO NOT write prompts that require the executor to read other files to understand what to do
|
|
355
|
+
- DO NOT assume the executor can figure things out - be explicit
|
|
356
|
+
|
|
357
|
+
## Example Usage
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
User: /plan-implementation PROJ-1234-add-emergency-schedule
|
|
361
|
+
|
|
362
|
+
Skill:
|
|
363
|
+
1. Reads .5/PROJ-1234-add-emergency-schedule/feature.md
|
|
364
|
+
2. Explores codebase: reads existing models, services, routes, tests
|
|
365
|
+
3. Extracts patterns: import style, naming, structure, test framework
|
|
366
|
+
4. Asks technical questions about validation, persistence, API
|
|
367
|
+
5. Maps components to skills (or null for direct execution)
|
|
368
|
+
6. Groups into steps by dependencies
|
|
369
|
+
7. Builds self-contained prompts with inline code and exact paths
|
|
370
|
+
8. Creates .5/PROJ-1234-add-emergency-schedule/plan.md
|
|
371
|
+
9. Tells user: "Plan created with 7 components across 3 steps. Review and run /5:implement-feature"
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Related Documentation
|
|
375
|
+
|
|
376
|
+
- [5-Phase Workflow Guide](../docs/workflow-guide.md)
|