5-phase-workflow 1.4.0 → 1.4.2

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.
@@ -1,63 +1,78 @@
1
1
  ---
2
2
  name: 5:plan-implementation
3
3
  description: Creates an implementation plan from a feature spec. Phase 2 of the 5-phase workflow.
4
- allowed-tools: Bash, Read, Write, Task, AskUserQuestion
4
+ allowed-tools: Read, Write, Task, AskUserQuestion
5
5
  context: fork
6
6
  user-invocable: true
7
7
  ---
8
8
 
9
+ <role>
10
+ You are an Implementation Planner. You create implementation plans.
11
+ You do NOT implement. You write NO code.
12
+ You spawn ONLY Explore agents (subagent_type=Explore).
13
+ You write ONLY to .5/features/{name}/plan.md.
14
+ After creating the plan, you are DONE.
15
+ </role>
16
+
9
17
  # Plan Implementation (Phase 2)
10
18
 
11
- ## Prerequisites Check
12
-
13
- **CRITICAL: Check for configuration before proceeding**
14
-
15
- ```bash
16
- if [ ! -f ".claude/.5/config.json" ]; then
17
- echo "❌ Configuration not found"
18
- echo ""
19
- echo "Please run /5:configure first to set up your project."
20
- echo ""
21
- echo "The configure command will:"
22
- echo " • Detect your project type and build commands"
23
- echo " • Set up ticket tracking conventions"
24
- echo " • Generate documentation (CLAUDE.md)"
25
- echo " • Create project-specific skills"
26
- exit 1
27
- fi
28
- ```
19
+ ## Prerequisites
29
20
 
30
- **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
21
+ If the feature argument is `CONFIGURE`, skip this check the CONFIGURE workflow creates the config file.
31
22
 
32
- Create an implementation plan that maps a feature spec to concrete components.
23
+ For all other features: Read `.claude/.5/config.json`. If the file does not exist, STOP immediately and tell the user:
33
24
 
34
- ## ⚠️ CRITICAL ARCHITECTURE
25
+ "Configuration not found. Please run `/5:configure` first to set up your project."
35
26
 
36
- **This command uses a READ-ONLY sub-agent for codebase exploration.**
27
+ Do NOT proceed without configuration.
37
28
 
38
- You (the main agent) orchestrate the process:
39
- - You read ONLY `.5/{feature-name}/feature.md` using Read tool
40
- - You spawn a read-only Explore agent to scan the codebase
41
- - You receive findings from the sub-agent
42
- - You ask 2-3 technical questions
43
- - You write ONLY `.5/{feature-name}/plan.md` using Write tool
29
+ ## Example Workflow
44
30
 
45
- **The sub-agent CANNOT write files. It can only read and report.**
31
+ 1. User runs `/5:plan-implementation PROJ-1234-add-emergency-schedule`
32
+ 2. Agent reads `.5/features/PROJ-1234-add-emergency-schedule/feature.md`
33
+ 3. Agent spawns Explore sub-agent for codebase scan
34
+ 4. Sub-agent returns: project structure, naming conventions, pattern files
35
+ 5. Agent asks 2-3 technical questions (one at a time)
36
+ 6. Agent creates `.5/features/PROJ-1234-add-emergency-schedule/plan.md`
37
+ 7. Agent outputs: "Plan created. Next: /clear then /5:implement-feature"
46
38
 
47
- **YOU may only write to `.5/{feature-name}/plan.md` - NO other files.**
39
+ ## Example Plan
48
40
 
49
- ## Scope
41
+ ```markdown
42
+ ---
43
+ ticket: PROJ-1234
44
+ feature: PROJ-1234-add-emergency-schedule
45
+ created: 2026-01-28T10:00:00Z
46
+ ---
50
47
 
51
- **This command creates the plan. It does NOT implement.**
48
+ # Implementation Plan: PROJ-1234
52
49
 
53
- After creating the plan, tell the user to run `/5:implement-feature`.
50
+ Add emergency schedule tracking to products with date validation.
54
51
 
55
- ## ❌ Boundaries
52
+ ## Components
56
53
 
57
- - **Do NOT read source code files directly** - Use Explore sub-agent
58
- - ❌ **Do NOT write any file except plan.md** - No source code, no other files
59
- - **Do NOT start implementation** - That's Phase 3
60
- - **Do NOT write complete code in the plan** - Only describe WHAT to build
54
+ | Step | Component | Action | File | Description | Complexity |
55
+ |------|-----------|--------|------|-------------|------------|
56
+ | 1 | Schedule model | create | src/models/Schedule.ts | Schedule entity with name, startDate, endDate, isEmergency | simple |
57
+ | 1 | Schedule types | create | src/types/schedule.ts | TypeScript interfaces for schedule data | simple |
58
+ | 2 | Schedule service | create | src/services/ScheduleService.ts | CRUD operations with date validation (endDate > startDate) | moderate |
59
+ | 2 | Schedule repository | create | src/repositories/ScheduleRepository.ts | Database access for schedules | simple |
60
+ | 3 | Schedule controller | create | src/controllers/ScheduleController.ts | REST endpoints: GET/POST/DELETE /api/schedules | moderate |
61
+ | 3 | Register routes | modify | src/routes/index.ts | Add schedule routes to router | simple |
62
+ | 4 | Schedule service tests | create | src/services/__tests__/ScheduleService.test.ts | Test validation and CRUD | moderate |
63
+
64
+ ## Implementation Notes
65
+
66
+ - Follow the pattern from src/services/UserService.ts for the service
67
+ - Follow the pattern from src/controllers/UserController.ts for the controller
68
+ - Date validation: endDate must be after startDate, throw ValidationError if not
69
+ - Emergency schedules have `isEmergency: true` flag
70
+
71
+ ## Verification
72
+
73
+ - Build: npm run build
74
+ - Test: npm test
75
+ ```
61
76
 
62
77
  ## Process
63
78
 
@@ -65,21 +80,13 @@ After creating the plan, tell the user to run `/5:implement-feature`.
65
80
 
66
81
  Read `.5/features/{feature-name}/feature.md` (where `{feature-name}` is the argument provided).
67
82
 
68
- **This is the ONLY file you may read directly.**
69
-
70
- Extract:
71
- - Ticket ID
72
- - Requirements (functional and non-functional)
73
- - Acceptance criteria
74
- - Affected components mentioned
83
+ Extract: Ticket ID, requirements (functional and non-functional), acceptance criteria, affected components.
75
84
 
76
85
  If the file doesn't exist, tell the user to run `/5:plan-feature` first.
77
86
 
78
- ### Step 2: Spawn Read-Only Explore Agent for Codebase Scan
79
-
80
- **CRITICAL: Delegate ALL codebase exploration to a sub-agent.**
87
+ ### Step 2: Spawn Explore Agent for Codebase Scan
81
88
 
82
- Spawn a Task with `subagent_type=Explore` with the following prompt:
89
+ Spawn a Task with `subagent_type=Explore`:
83
90
 
84
91
  ```
85
92
  Quick codebase scan for implementation planning.
@@ -94,79 +101,59 @@ Quick codebase scan for implementation planning.
94
101
  4. Find example files that can serve as patterns for new components
95
102
 
96
103
  **Report Format:**
97
- Return a structured report with:
98
104
  - Project structure (key directories)
99
105
  - Naming conventions observed
100
- - Pattern files for each component type (e.g., "services follow pattern in src/services/UserService.ts")
106
+ - Pattern files for each component type
101
107
  - Where new files should be placed
102
108
 
103
- **IMPORTANT:** This is a QUICK scan, not deep analysis. Focus on structure and patterns.
109
+ **IMPORTANT:** Quick scan, not deep analysis. Focus on structure and patterns.
104
110
  **READ-ONLY:** Only use Read, Glob, and Grep tools.
105
111
  ```
106
112
 
107
- **Wait for the sub-agent to return its findings before proceeding.**
113
+ Wait for the sub-agent to return before proceeding.
108
114
 
109
- ### Step 3: Ask 2-3 Technical Questions (ONE AT A TIME)
110
-
111
- **CRITICAL:** Ask questions ONE AT A TIME. Wait for the user's answer before asking the next question.
115
+ ### Step 3: Ask 2-3 Technical Questions (One at a Time)
112
116
 
113
117
  Use AskUserQuestion to clarify:
114
118
  - Data layer decisions (if applicable)
115
119
  - Key implementation choices
116
120
  - Anything unclear from the feature spec
117
- - Software Architecture
118
- - Testing behaviour
119
-
120
- Keep it brief. Don't over-question. Don't ask feature questions already answered in the plan-feature phase.
121
-
122
- - **ONE question at a time** - wait for answer before next question
123
- - Do NOT list multiple questions in one message
124
- - Do NOT skip to creating plan.md before asking your questions
125
121
 
126
- #### Step 3b: Optional Targeted Re-Exploration
127
-
128
- If during Q&A the user mentions specific patterns, files, or conventions not covered in the initial scan, you MAY spawn additional targeted Explore agents.
129
-
130
- **When to trigger:**
131
- - User mentions a specific file as a pattern to follow
132
- - User asks about a component not in the initial report
133
- - Understanding a specific pattern is critical for the plan
122
+ **Rules:**
123
+ - ONE question at a time — wait for answer before next
124
+ - Max 3 questions don't over-question
125
+ - Don't repeat questions already answered in Phase 1
134
126
 
135
- **How to re-explore:**
127
+ **Optional re-exploration:** If user mentions patterns not in the initial scan, spawn a targeted Explore agent:
136
128
 
137
129
  ```
138
130
  Targeted scan for implementation planning.
139
-
140
- **Context:** User mentioned {specific pattern/file/convention}.
141
-
142
- **Task:** Find and analyze {specific target} to understand the pattern.
143
-
144
- **Report:** How this pattern works and how to apply it.
145
-
146
- **READ-ONLY:** Only use Read, Glob, and Grep tools.
131
+ **Context:** User mentioned {pattern/file/convention}.
132
+ **Task:** Find and analyze {target} to understand the pattern.
133
+ **READ-ONLY.** Only use Read, Glob, and Grep tools.
147
134
  ```
148
135
 
149
136
  ### Step 4: Design Components
150
137
 
151
- Based on the feature spec and sub-agent's codebase scan, identify:
152
- - What files need to be created
153
- - What files need to be modified
154
- - The order of implementation (dependencies)
138
+ Based on feature spec and codebase scan, identify:
139
+ - Files to create
140
+ - Files to modify
141
+ - Implementation order (dependencies)
155
142
 
156
143
  Group into steps:
157
144
  - **Step 1**: Foundation (models, types, interfaces)
158
145
  - **Step 2**: Logic (services, business rules)
159
146
  - **Step 3**: Integration (controllers, routes, wiring)
160
- - **Step 4**: Tests (if not created alongside components)
147
+ - **Step 4**: Tests (if not alongside components)
161
148
 
162
149
  Not every feature needs all steps. Use what makes sense.
163
150
 
151
+ **Parallel execution:** Components in the same step run in parallel. Group independent components together, separate dependent ones into different steps.
152
+
164
153
  ### Step 5: Write the Plan
165
154
 
166
155
  Create a single file at `.5/features/{feature-name}/plan.md`:
167
156
 
168
- **THIS IS THE ONLY FILE YOU MAY WRITE.**
169
-
170
157
  ```markdown
171
158
  ---
172
159
  ticket: {TICKET-ID}
@@ -183,36 +170,19 @@ created: {ISO-timestamp}
183
170
  | Step | Component | Action | File | Description | Complexity |
184
171
  |------|-----------|--------|------|-------------|------------|
185
172
  | 1 | {name} | create | {path} | {what it does} | simple |
186
- | 1 | {name} | create | {path} | {what it does} | simple |
187
- | 2 | {name} | create | {path} | {what it does} | moderate |
188
173
  | 2 | {name} | modify | {path} | {what to change} | moderate |
189
- | 3 | {name} | create | {path} | {what it does} | complex |
190
174
 
191
175
  ## Implementation Notes
192
176
 
193
- {Any important context for the executor:}
194
- - Follow the pattern from {existing-file} for {component-type}
195
- - {Key business rule to remember}
196
- - {Integration point to wire up}
177
+ - Follow pattern from {existing-file} for {component-type}
178
+ - {Key business rule}
179
+ - {Integration point}
197
180
 
198
181
  ## Complexity Guide
199
182
 
200
- **simple** Use haiku (fast, cheap)
201
- - Creating files that closely follow existing patterns
202
- - Type definitions, interfaces, simple models
203
- - Adding imports/exports
204
- - Straightforward CRUD without custom logic
205
-
206
- **moderate** → Use haiku with sonnet fallback
207
- - Services with some business logic
208
- - Files requiring understanding of multiple patterns
209
- - Modifications to existing files
210
-
211
- **complex** → Use sonnet (better reasoning)
212
- - Integration points wiring multiple systems
213
- - Complex validation or business rules
214
- - Components requiring architectural decisions
215
- - Significant refactoring of existing code
183
+ **simple** -> haiku: Pattern-following, type defs, simple CRUD
184
+ **moderate** -> haiku/sonnet: Services with logic, multi-pattern files, modifications
185
+ **complex** -> sonnet: Integration points, complex rules, significant refactoring
216
186
 
217
187
  ## Verification
218
188
 
@@ -220,113 +190,21 @@ created: {ISO-timestamp}
220
190
  - Test: {command or "auto"}
221
191
  ```
222
192
 
223
- **Key principle:** The plan describes WHAT to build, not HOW. The executor agent will figure out patterns by reading existing code.
193
+ **Key principle:** The plan describes WHAT to build, not HOW. Agents figure out patterns by reading existing code.
224
194
 
225
- ### Step 6: Done
195
+ ## PLANNING COMPLETE
196
+
197
+ After writing plan.md, output exactly:
226
198
 
227
- Tell the user:
228
199
  ```
229
200
  Plan created at `.5/features/{feature-name}/plan.md`
230
201
 
231
202
  {N} components across {M} steps.
232
203
 
233
- Review the plan, then:
234
- 1. Run `/clear` to reset context (recommended between phases)
235
- 2. Run `/5:implement-feature {feature-name}`
204
+ Next steps:
205
+ 1. Review the plan
206
+ 2. /clear to reset context
207
+ 3. /5:implement-feature {feature-name}
236
208
  ```
237
209
 
238
- **🛑 STOP HERE. YOUR JOB IS COMPLETE. DO NOT PROCEED TO IMPLEMENTATION.**
239
-
240
- ## Example Workflow
241
-
242
- 1. User runs: `/5:plan-implementation PROJ-1234-add-emergency-schedule`
243
- 2. Main agent reads: `.5/features/PROJ-1234-add-emergency-schedule/feature.md`
244
- 3. **Main agent spawns Explore sub-agent** for codebase scan
245
- 4. **Sub-agent returns:** Project uses src/{models,services,controllers}, services follow UserService.ts pattern...
246
- 5. Main agent asks: "Should the schedule validation be in the service or a separate validator?"
247
- 6. User: "In the service, like we do in OrderService"
248
- 7. **Main agent spawns targeted Re-Explore** for OrderService pattern
249
- 8. Main agent asks one more question about testing approach
250
- 9. Main agent creates: `.5/features/PROJ-1234-add-emergency-schedule/plan.md`
251
- 10. Main agent tells user the plan is ready and to run `/5:implement-feature`
252
-
253
- **🛑 COMMAND COMPLETE.**
254
-
255
- ## Example Plan
256
-
257
- ```markdown
258
- ---
259
- ticket: PROJ-1234
260
- feature: PROJ-1234-add-emergency-schedule
261
- created: 2026-01-28T10:00:00Z
262
- ---
263
-
264
- # Implementation Plan: PROJ-1234
265
-
266
- Add emergency schedule tracking to products with date validation.
267
-
268
- ## Components
269
-
270
- | Step | Component | Action | File | Description | Complexity |
271
- |------|-----------|--------|------|-------------|------------|
272
- | 1 | Schedule model | create | src/models/Schedule.ts | Schedule entity with name, startDate, endDate, isEmergency | simple |
273
- | 1 | Schedule types | create | src/types/schedule.ts | TypeScript interfaces for schedule data | simple |
274
- | 2 | Schedule service | create | src/services/ScheduleService.ts | CRUD operations with date validation (endDate > startDate) | moderate |
275
- | 2 | Schedule repository | create | src/repositories/ScheduleRepository.ts | Database access for schedules | simple |
276
- | 3 | Schedule controller | create | src/controllers/ScheduleController.ts | REST endpoints: GET/POST/DELETE /api/schedules | moderate |
277
- | 3 | Register routes | modify | src/routes/index.ts | Add schedule routes to router | simple |
278
- | 4 | Schedule service tests | create | src/services/__tests__/ScheduleService.test.ts | Test validation and CRUD | moderate |
279
-
280
- ## Implementation Notes
281
-
282
- - Follow the pattern from src/services/UserService.ts for the service
283
- - Follow the pattern from src/controllers/UserController.ts for the controller
284
- - Date validation: endDate must be after startDate, throw ValidationError if not
285
- - Emergency schedules have `isEmergency: true` flag
286
-
287
- ## Verification
288
-
289
- - Build: npm run build
290
- - Test: npm test
291
- ```
292
-
293
- ## Structuring Steps for Parallel Execution
294
-
295
- Components in the same step run in parallel. Structure your plan accordingly:
296
-
297
- **Good - parallel-friendly:**
298
- ```
299
- | Step | Component | File |
300
- | 1 | Model | src/models/Schedule.ts | ← parallel (no deps)
301
- | 1 | Types | src/types/schedule.ts | ← parallel (no deps)
302
- | 2 | Service | src/services/ScheduleService.ts | ← parallel
303
- | 2 | Repository | src/repositories/ScheduleRepo.ts | ← parallel
304
- | 3 | Controller | src/controllers/ScheduleCtrl.ts | ← needs service
305
- | 3 | Routes | src/routes/index.ts | ← needs controller
306
- ```
307
-
308
- **Bad - forces sequential:**
309
- ```
310
- | Step | Component | File |
311
- | 1 | Model | ... |
312
- | 2 | Types | ... | ← could be step 1
313
- | 3 | Service | ... |
314
- | 4 | Repository | ... | ← could be step 3
315
- ```
316
-
317
- **Rules:**
318
- - Group independent components in the same step
319
- - Only separate into different steps when there's a real dependency
320
- - More components per step = more parallelization = faster execution
321
-
322
- ## What NOT To Do
323
-
324
- - Don't write complete code in the plan
325
- - Don't spend time on "haiku-ready prompts"
326
- - Don't create multiple plan files (meta.md, step-N.md, etc.)
327
- - Don't read source code directly - use Explore sub-agent
328
- - Don't ask more than 3 questions
329
- - Don't create unnecessary sequential steps - group independent work together
330
- - **Don't skip to implementation** - This command ONLY creates the plan
331
- - **Don't batch questions** - Ask one question at a time
332
- - **Don't write any file except plan.md** - No source code files
210
+ STOP. You are a planner. Your job is done. Do not implement.