5-phase-workflow 1.4.2 → 1.4.4

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.
@@ -41,19 +41,6 @@ Your job is NOT:
41
41
 
42
42
  **After updating the feature spec and informing the user, YOUR JOB IS COMPLETE. EXIT IMMEDIATELY.**
43
43
 
44
- ## ❌ Boundaries: What This Command Does NOT Do
45
-
46
- **CRITICAL:** This command has a LIMITED scope. Do NOT:
47
-
48
- - ❌ **Create new feature specs** - That's /5:plan-feature
49
- - ❌ **Create implementation plans** - That's Phase 2 (/5:plan-implementation)
50
- - ❌ **Start implementation** - That's Phase 3 (/5:implement-feature)
51
- - ❌ **Write any code** - This is planning only
52
- - ❌ **Rewrite entire spec** - Only update sections that changed
53
- - ❌ **Delete previous Q&A** - Append new discussions, keep history
54
-
55
- **If you find yourself creating plans or writing code, STOP IMMEDIATELY. You are exceeding this command's scope.**
56
-
57
44
  ## Use Cases
58
45
 
59
46
  Use this skill when:
@@ -68,7 +55,7 @@ Use this skill when:
68
55
  ## Prerequisites
69
56
 
70
57
  Before invoking this skill, ensure:
71
- 1. Feature spec exists at `.5/{feature-name}/feature.md`
58
+ 1. Feature spec exists at `.5/features/{feature-name}/feature.md`
72
59
  2. You have the feature name or ticket ID ready (e.g., "PROJ-1234-add-feature")
73
60
 
74
61
  ## Discussion Process
@@ -229,22 +216,6 @@ After updating the spec, tell the developer:
229
216
  - "Proceed to implementation planning (run `/clear` followed by `/5:plan-implementation {feature-name}`)"
230
217
  - "Review the updated spec first"
231
218
 
232
- ## Instructions Summary
233
-
234
- Follow these steps **IN ORDER** and **STOP after step 9**:
235
-
236
- 1. **Extract feature name** - From user input or by matching ticket ID
237
- 2. **Read feature spec** - Load current state from `.5/features/{feature-name}/feature.md`
238
- 3. **Ask initial question** - What do they want to discuss?
239
- 4. **Explore if needed** - Understand codebase context
240
- 5. **Interactive Q&A** - Multiple rounds of clarifying questions
241
- 6. **Iterate** - Allow continued discussion until user is satisfied
242
- 7. **Update feature spec** - Modify only the relevant sections that changed
243
- 8. **Track changes** - Document discussion history
244
- 9. **Inform developer** - Summarize changes and ask: "Discuss more or run `/clear` followed by `/5:plan-implementation {feature-name}`?"
245
-
246
- **🛑 STOP HERE. YOUR JOB IS COMPLETE. DO NOT CREATE IMPLEMENTATION PLANS.**
247
-
248
219
  ## Key Principles
249
220
 
250
221
  1. **User-driven** - Follow user's focus areas, don't prescribe
@@ -256,167 +227,31 @@ Follow these steps **IN ORDER** and **STOP after step 9**:
256
227
  7. **Clear next steps** - Guide user on what to do next
257
228
 
258
229
 
259
- ## Discussion Patterns
260
-
261
- ### Pattern 1: Scope Reduction
262
- User: "This is too complex, can we simplify?"
263
- Skill:
264
- 1. Ask: "What's the minimum viable version?"
265
- 2. Ask: "Which requirements are must-have vs nice-to-have?"
266
- 3. Present options for phased approach
267
- 4. Update spec with reduced scope
268
-
269
- ### Pattern 2: Requirement Addition
270
- User: "We need to also handle X scenario"
271
- Skill:
272
- 1. Ask: "How should X scenario work?"
273
- 2. Ask: "How does X interact with existing requirement Y?"
274
- 3. Ask: "Should X be in this feature or separate?"
275
- 4. Update requirements section
276
-
277
- ### Pattern 3: Technical Feasibility
278
- User: "Can we reuse existing component Z?"
279
- Skill:
280
- 1. Explore: Find component Z implementation
281
- 2. Ask: "Does Z fully meet the need or need extension?"
282
- 3. Present trade-offs: reuse vs custom
283
- 4. Update affected domains and approach
284
-
285
- ### Pattern 4: Acceptance Criteria
286
- User: "How do we verify this works?"
287
- Skill:
288
- 1. Ask: "What's the happy path test?"
289
- 2. Ask: "What edge cases should we test?"
290
- 3. Ask: "What does failure look like?"
291
- 4. Update acceptance criteria section
292
-
293
- ### Pattern 5: Alternative Evaluation
294
- User: "Should we use approach A or B?"
295
- Skill:
296
- 1. Ask: "What's the goal: simplicity, performance, flexibility?"
297
- 2. Present pros/cons of each approach
298
- 3. Ask: "What constraints matter most?"
299
- 4. Update alternatives considered section
300
-
301
230
  ## Example Workflow
302
231
 
303
- ### Example 1: Scope Clarification
304
-
305
232
  ```
306
233
  User: /discuss-feature PROJ-1234-add-feature
307
234
 
308
235
  Skill: [Reads feature spec]
309
236
  Skill: "What would you like to discuss or change about this feature?"
310
-
311
237
  User: "Clarify existing requirements"
312
238
 
313
- Skill: "The current spec mentions 'emergency schedule window'. Should this support:
314
- - Single time window per product?
315
- - Multiple overlapping windows?
316
- - Recurring schedules?
317
- What level of complexity do you need?"
318
-
239
+ Skill: "The current spec mentions 'emergency schedule window'. Should this support single or multiple windows? Recurring schedules?"
319
240
  User: "Just single window per product for now"
320
241
 
321
242
  Skill: "Should we support updating/deleting the window after it's set?"
322
-
323
243
  User: "Yes, full CRUD"
324
244
 
325
- Skill: "Would you like to discuss anything else about this feature?"
326
-
327
- User: "No, update the spec"
328
-
329
- Skill: [Updates Requirements and Acceptance Criteria sections]
330
- Skill: "Feature specification updated. Changes:
331
- - Clarified: Single emergency window per product (not multiple)
332
- - Added: Full CRUD operations for emergency windows
333
- Would you like to proceed to implementation planning? Run `/clear` followed by `/5:plan-implementation PROJ-1234-add-feature`"
334
- ```
335
-
336
- ### Example 2: Adding Requirements
337
-
338
- ```
339
- User: /discuss-feature PROJ-1234
340
-
341
- Skill: [Finds PROJ-1234-add-feature.md]
342
- Skill: "What would you like to discuss or change about this feature?"
343
-
344
- User: "Add new requirements"
345
-
346
- Skill: "What new requirement would you like to add?"
347
-
348
- User: "We need to notify customers when emergency schedule is activated"
349
-
350
- Skill: "How should notifications be delivered?
351
- - Email only
352
- - SMS only
353
- - Both email and SMS
354
- - Configurable per customer"
355
-
356
- User: "Email only for now"
357
-
358
- Skill: "Should notification be:
359
- - Immediate when emergency schedule is created?
360
- - When emergency window starts?
361
- - Both?"
362
-
363
- User: "When emergency window starts"
364
-
365
245
  Skill: "Would you like to discuss anything else?"
366
-
367
246
  User: "No, update the spec"
368
247
 
369
- Skill: [Updates Requirements, adds email notification requirement]
370
- Skill: [Updates Affected Domains, adds email service integration]
371
- Skill: [Updates Acceptance Criteria, adds notification verification]
372
- Skill: "Feature specification updated. Changes:
373
- - Added: Email notification when emergency window starts
374
- - Added: Integration with email service
375
- Review the changes and run `/clear` followed by `/5:plan-implementation PROJ-1234-add-feature` when ready"
376
- ```
377
-
378
- ### Example 3: Simplification
379
-
380
- ```
381
- User: /discuss-feature PROJ-1234-add-feature
382
-
383
- Skill: "What would you like to discuss or change about this feature?"
384
-
385
- User: "Remove or simplify requirements"
386
-
387
- Skill: "Current requirements include:
388
- 1. Emergency schedule CRUD
389
- 2. Email notifications
390
- 3. Audit logging
391
- 4. Analytics tracking
392
- Which are critical for MVP?"
393
-
394
- User: "Just #1 and #3. We can add notifications and analytics later"
395
-
396
- Skill: "So we'll keep emergency schedule CRUD and audit logging, defer notifications and analytics to future work?"
397
-
398
- User: "Correct"
399
-
400
- Skill: [Updates Requirements, moves #2 and #4 to "Future Enhancements" section]
401
- Skill: [Updates Affected Domains, removes email and analytics integrations]
402
- Skill: "Feature specification updated. Changes:
403
- - Removed: Email notifications (moved to future enhancements)
404
- - Removed: Analytics tracking (moved to future enhancements)
405
- - Kept: Core CRUD and audit logging
406
- The simplified scope should reduce implementation complexity significantly."
248
+ Skill: [Updates Requirements and Acceptance Criteria sections]
249
+ Skill: "Feature spec updated. Changes:
250
+ - Clarified: Single emergency window per product
251
+ - Added: Full CRUD operations
252
+ Next: /clear then /5:plan-implementation PROJ-1234-add-feature"
407
253
  ```
408
254
 
409
- ## Tips for Effective Discussion
410
-
411
- 1. **Read the spec first** - Understand current state before asking questions
412
- 2. **Focus on one topic** - Don't try to discuss everything at once
413
- 3. **Ask open questions** - Let user explain their thinking
414
- 4. **Present options** - Give user choices with pros/cons
415
- 5. **Challenge gently** - "Have you considered..." not "You should..."
416
- 6. **Summarize often** - Confirm understanding before moving on
417
- 7. **Track rationale** - Document WHY decisions were made
418
- 8. **Be patient** - Allow multiple rounds until clarity emerges
419
-
420
255
  ## Related Documentation
421
256
 
422
257
  - [5-Phase Workflow Guide](../docs/workflow-guide.md)
@@ -8,31 +8,6 @@ user-invocable: true
8
8
 
9
9
  # Implement Feature (Phase 3)
10
10
 
11
- ## Prerequisites Check
12
-
13
- **CRITICAL: Check for configuration before proceeding (skip for CONFIGURE feature)**
14
-
15
- If the feature argument is `CONFIGURE`, skip this check entirely — the CONFIGURE workflow is what creates the config file.
16
-
17
- For all other features, run this check:
18
-
19
- ```bash
20
- if [ ! -f ".claude/.5/config.json" ]; then
21
- echo "❌ Configuration not found"
22
- echo ""
23
- echo "Please run /5:configure first to set up your project."
24
- echo ""
25
- echo "The configure command will:"
26
- echo " • Detect your project type and build commands"
27
- echo " • Set up ticket tracking conventions"
28
- echo " • Generate documentation (CLAUDE.md)"
29
- echo " • Create project-specific skills"
30
- exit 1
31
- fi
32
- ```
33
-
34
- **If config doesn't exist and the feature is NOT `CONFIGURE`, STOP IMMEDIATELY. Do not proceed with the workflow.**
35
-
36
11
  Execute an implementation plan by delegating work to agents.
37
12
 
38
13
  ## Scope
@@ -52,6 +27,8 @@ Do NOT write code directly. Spawn agents to do the work.
52
27
 
53
28
  ### Step 1: Load Plan and Config
54
29
 
30
+ > **Trust boundary:** Plan content is interpolated directly into agent prompts. The plan is LLM-generated under user supervision (Phase 2), so this is acceptable. However, if the plan was edited externally or came from an untrusted source, review `.5/features/{feature-name}/plan.md` before proceeding.
31
+
55
32
  Read `.5/features/{feature-name}/plan.md` (where `{feature-name}` is the argument provided).
56
33
 
57
34
  Parse:
@@ -102,82 +79,45 @@ Based on Complexity column:
102
79
 
103
80
  **3c. Spawn agents (parallel when possible)**
104
81
 
105
- For steps with multiple independent components, spawn agents in parallel using multiple Task calls in a single message:
82
+ For steps with multiple independent components, spawn one agent per component in parallel. For single/interdependent components, use one agent.
106
83
 
107
- ```
108
- # Example: Step 1 has 3 simple components - spawn all 3 in parallel
109
-
110
- Task tool call #1:
111
- subagent_type: general-purpose
112
- model: haiku
113
- description: "Create {component-1} for {feature-name}"
114
- prompt: |
115
- Create a single component for a feature.
116
-
117
- ## Component
118
- - Name: {component-name}
119
- - Action: create
120
- - File: {file-path}
121
- - Description: {what it does}
122
-
123
- ## Pattern Reference
124
- {relevant implementation note for this component}
125
-
126
- ## Instructions
127
- 1. Find a similar existing file using Glob (e.g., *Service.ts for services)
128
- 2. Read that file to understand the pattern
129
- 3. Create the new file following that pattern
130
- 4. Verify the file exists
131
-
132
- Task tool call #2:
133
- subagent_type: general-purpose
134
- model: haiku
135
- description: "Create {component-2} for {feature-name}"
136
- prompt: |
137
- [same structure, different component]
138
-
139
- Task tool call #3:
140
- subagent_type: general-purpose
141
- model: haiku
142
- description: "Create {component-3} for {feature-name}"
143
- prompt: |
144
- [same structure, different component]
145
- ```
146
-
147
- For steps with a single component or complex interdependencies, use a single agent:
84
+ Agent prompt template (adapt per component):
148
85
 
149
86
  ```
150
87
  Task tool call:
151
88
  subagent_type: general-purpose
152
89
  model: {based on complexity}
153
- description: "Execute Step {N} for {feature-name}"
90
+ description: "{Action} {component-name} for {feature-name}"
154
91
  prompt: |
155
- You are implementing components for a feature.
92
+ Implement component(s) for a feature.
156
93
 
157
- ## Feature Context
158
- {feature-name}: {one-line summary from plan}
159
-
160
- ## Components to Create/Modify
161
- {components for this step from the plan table}
94
+ ## Feature: {feature-name}
95
+ ## Components
96
+ {component(s) from plan table: name, action, file, description}
162
97
 
163
98
  ## Implementation Notes
164
- {implementation notes section from plan}
99
+ {relevant notes from plan}
165
100
 
166
- ## Instructions
167
- 1. For each component:
168
- - If creating a file: find a similar existing file, understand the pattern, create the new file following that pattern
169
- - If modifying a file: read the file, make the described change
170
- 2. After creating/modifying each file, verify it exists
171
- 3. Report what you created/modified
101
+ ## Process
102
+ - Creating: Find similar file via Glob, read pattern, create new file following it
103
+ - Modifying: Read file, apply described change via Edit
104
+ - Verify each file exists after changes
172
105
 
173
- Use Glob to find similar files. Use Read to understand patterns. Use Write/Edit to create/modify files.
106
+ ## Output
107
+ ---RESULT---
108
+ STATUS: success | failed
109
+ FILES_CREATED: [comma-separated paths]
110
+ FILES_MODIFIED: [comma-separated paths]
111
+ ERROR: none | {error description}
112
+ ---END---
174
113
  ```
175
114
 
176
115
  **3d. Process results**
177
116
 
178
- Collect results from all agents (parallel or sequential). For each:
179
- - Components completed successfully
180
- - Components that failed
117
+ Collect results from all agents (parallel or sequential). Parse the `---RESULT---` block from each agent's response. For each:
118
+ - If `STATUS: success` → mark components as completed, note files from `FILES_CREATED`/`FILES_MODIFIED`
119
+ - If `STATUS: failed` → mark components as failed, log the `ERROR` message
120
+ - If no `---RESULT---` block found → treat the response as success if the agent reported creating/modifying files, otherwise treat as failed
181
121
 
182
122
  Update state.json:
183
123
  ```json
@@ -190,35 +130,7 @@ Update state.json:
190
130
 
191
131
  **3e. Auto-Commit Step (if enabled)**
192
132
 
193
- Only fires if `git.autoCommit: true` AND at least one component in the step succeeded.
194
-
195
- 1. Stage **only** the specific files from the plan's components table for this step (never `git add .`)
196
- 2. Commit using the configured `git.commitMessage.pattern`:
197
- - `{ticket-id}` → ticket ID from plan frontmatter
198
- - `{short-description}` → auto-generated summary of the step (imperative mood, max 50 chars for the full first line)
199
- - Body: one bullet per completed component
200
-
201
- ```bash
202
- # Stage only specific files from this step's components
203
- git add {file-1} {file-2} ...
204
-
205
- # Commit with configured pattern + body
206
- git commit -m "{ticket-id} {short-description}
207
-
208
- - {concise change 1}
209
- - {concise change 2}"
210
- ```
211
-
212
- 3. If commit fails → log warning, record in `state.json` under `commitResults` array, continue
213
- 4. If all components in the step failed → skip commit entirely
214
-
215
- **Example commit:**
216
- ```
217
- PROJ-1234 add schedule model and types
218
-
219
- - Create Schedule.ts entity model
220
- - Create schedule.ts type definitions
221
- ```
133
+ Only fires if `git.autoCommit: true` AND at least one component succeeded. Stage only the step's specific files (never `git add .`), commit with configured `git.commitMessage.pattern` (body: one bullet per component). If commit fails, log warning in `state.json` `commitResults` and continue.
222
134
 
223
135
  **3f. Handle failures**
224
136
 
@@ -276,46 +188,16 @@ Next steps:
276
188
 
277
189
  If implementation is interrupted, the state file allows resuming:
278
190
  - Read state.json
279
- - Skip steps where all components are in `completed`
191
+ - For each step marked as completed, verify the output files still exist on disk using Glob
192
+ - If any completed files are missing, move those components back to pending and re-run them
193
+ - Skip steps where all components are in `completed` AND their files verified to exist
280
194
  - Resume from `currentStep`
281
195
 
282
196
  ## Example Flow
283
197
 
284
198
  ```
285
- User: /implement-feature PROJ-1234-add-emergency-schedule
286
-
287
- [You read plan.md]
288
- [You create state.json]
289
-
290
- [Step 1: Foundation - 2 simple components → PARALLEL]
291
- Spawn 2 agents in single message:
292
- - Agent A creates: Schedule.ts (model)
293
- - Agent B creates: schedule.ts (types)
294
- Both complete → update state
295
-
296
- [Step 2: Logic - 2 moderate components → PARALLEL]
297
- Spawn 2 agents in single message:
298
- - Agent A creates: ScheduleService.ts
299
- - Agent B creates: ScheduleRepository.ts
300
- Both complete → update state
301
-
302
- [Step 3: Integration - mixed complexity → SEQUENTIAL or grouped]
303
- Option A: Single sonnet agent handles both
304
- Option B: Parallel if truly independent
305
- - Agent creates: ScheduleController.ts
306
- - Agent modifies: routes/index.ts
307
- Complete → update state
308
-
309
- [Step 4: Tests - 1 component → SINGLE agent]
310
- Agent creates: ScheduleService.test.ts
311
- Complete → update state
312
-
313
- [Verification]
314
- Run: npm run build → successful
315
- Run: npm test → passing
316
-
317
- [Update state: completed]
318
- [Report to user]
199
+ Step 1: 2 simple components → 2 parallel haiku agents → update state
200
+ Step 2: 2 moderate components → 2 parallel agents → update state
201
+ Step 3: 1 complex component → 1 sonnet agent → update state
202
+ Step 4: Verify (build + test) → update state → report
319
203
  ```
320
-
321
- **Performance gain:** Steps 1 and 2 run in half the time by parallelizing components.
@@ -16,14 +16,6 @@ After creating the spec, you are DONE.
16
16
 
17
17
  # Plan Feature (Phase 1)
18
18
 
19
- ## Prerequisites
20
-
21
- Read `.claude/.5/config.json`. If the file does not exist, STOP immediately and tell the user:
22
-
23
- "Configuration not found. Please run `/5:configure` first to set up your project."
24
-
25
- Do NOT proceed without configuration.
26
-
27
19
  ## Common Feature Types
28
20
 
29
21
  - **New Component/Module** — Core logic, data structures, tests. Questions: Validation rules? Business logic? API design?
@@ -63,6 +55,8 @@ Extract the ticket ID from the current git branch:
63
55
  - Ask the developer to confirm the ticket ID
64
56
  - If not found, ask for it
65
57
 
58
+ **Sanitize the ticket ID:** The ticket ID is used in directory paths (`.5/features/{TICKET-ID}-{desc}/`). Only allow alphanumeric characters, dashes (`-`), and underscores (`_`). Reject or strip any other characters (especially `/`, `..`, `~`, spaces). If the sanitized result is empty, ask the user for a valid ticket ID.
59
+
66
60
  ### Step 3: Spawn Explore Agent for Codebase Analysis
67
61
 
68
62
  Spawn a Task with `subagent_type=Explore`:
@@ -16,16 +16,6 @@ After creating the plan, you are DONE.
16
16
 
17
17
  # Plan Implementation (Phase 2)
18
18
 
19
- ## Prerequisites
20
-
21
- If the feature argument is `CONFIGURE`, skip this check — the CONFIGURE workflow creates the config file.
22
-
23
- For all other features: Read `.claude/.5/config.json`. If the file does not exist, STOP immediately and tell the user:
24
-
25
- "Configuration not found. Please run `/5:configure` first to set up your project."
26
-
27
- Do NOT proceed without configuration.
28
-
29
19
  ## Example Workflow
30
20
 
31
21
  1. User runs `/5:plan-implementation PROJ-1234-add-emergency-schedule`