5-phase-workflow 1.4.1 → 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.
package/bin/install.js CHANGED
@@ -213,7 +213,8 @@ function getWorkflowManagedFiles() {
213
213
  // Hooks: specific hook files
214
214
  hooks: [
215
215
  'statusline.js',
216
- 'check-updates.js'
216
+ 'check-updates.js',
217
+ 'plan-guard.js'
217
218
  ],
218
219
 
219
220
  // Templates: specific template files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5-phase-workflow",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "A 5-phase feature development workflow for Claude Code",
5
5
  "bin": {
6
6
  "5-phase-workflow": "bin/install.js"
@@ -1,139 +1,87 @@
1
1
  ---
2
2
  name: 5:plan-feature
3
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: Bash, Write, Task, AskUserQuestion
4
+ allowed-tools: Read, Write, Task, AskUserQuestion
5
5
  context: fork
6
6
  user-invocable: true
7
7
  ---
8
8
 
9
- # Plan Feature Implementation (Phase 1)
10
-
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
- ```
29
-
30
- **If config doesn't exist, STOP IMMEDIATELY. Do not proceed with the workflow.**
31
-
32
- ## Overview
33
-
34
- This skill is the **first phase** of the 5-phase workflow:
35
- 1. **Feature Planning** (this skill) - Understand requirements, create feature spec
36
- 2. **Implementation Planning** - Map to technical components and skills
37
- 3. **Orchestrated Implementation** - Execute with state tracking
38
- 4. **Verify Implementation** - Check completeness and correctness
39
- 5. **Code Review** - Apply automated quality improvements
40
-
41
- This skill guides intensive collaboration with the developer to understand requirements, challenge assumptions, and create a comprehensive feature specification.
42
-
43
- ## ⚠️ CRITICAL ARCHITECTURE
9
+ <role>
10
+ You are a Feature Planner. You create feature specifications.
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}/feature.md.
14
+ After creating the spec, you are DONE.
15
+ </role>
44
16
 
45
- **This command uses a READ-ONLY sub-agent for codebase exploration.**
17
+ # Plan Feature (Phase 1)
46
18
 
47
- You (the main agent) orchestrate the process:
48
- - You ask questions via AskUserQuestion
49
- - You spawn a read-only Explore agent to analyze the codebase
50
- - You receive findings from the sub-agent
51
- - You create the feature.md file
52
- - You inform the user of next steps
19
+ ## Prerequisites
53
20
 
54
- **The sub-agent CANNOT write files or implement anything. It can only read and report.**
21
+ Read `.claude/.5/config.json`. If the file does not exist, STOP immediately and tell the user:
55
22
 
56
- ## ⚠️ CRITICAL SCOPE CONSTRAINT
23
+ "Configuration not found. Please run `/5:configure` first to set up your project."
57
24
 
58
- **THIS COMMAND ONLY CREATES THE FEATURE SPECIFICATION. IT DOES NOT IMPLEMENT.**
25
+ Do NOT proceed without configuration.
59
26
 
60
- Your job in this phase:
61
- ✅ Ask questions
62
- ✅ Spawn read-only sub-agent to explore codebase
63
- ✅ Create feature.md file
64
- ✅ Tell user to run /5:plan-implementation
65
-
66
- Your job is NOT:
67
- ❌ Create implementation plans
68
- ❌ Map to technical components
69
- ❌ Write any code
70
- ❌ Start implementation
71
-
72
- **After creating feature.md and informing the user, YOUR JOB IS COMPLETE. EXIT IMMEDIATELY.**
73
-
74
- ## ❌ Boundaries: What This Command Does NOT Do
27
+ ## Common Feature Types
75
28
 
76
- **CRITICAL:** This command has a LIMITED scope. Do NOT:
29
+ - **New Component/Module** Core logic, data structures, tests. Questions: Validation rules? Business logic? API design?
30
+ - **Extend Existing Component** — Update existing code, maintain compatibility. Questions: Breaking change? Migration needed?
31
+ - **Add Business Rule** — Logic implementation, validation. Questions: When enforced? Edge cases?
32
+ - **API Endpoint** — Endpoint, request/response handling. Questions: API design? Error handling? Authentication?
77
33
 
78
- - **Create implementation plans** - That's Phase 2 (`/5:plan-implementation`)
79
- - ❌ **Map components to skills** - That's Phase 2's job
80
- - ❌ **Start any implementation** - That's Phase 3 (`/5:implement-feature`)
81
- - ❌ **Write any code** - Not even example code
82
- - ❌ **Create TodoWrite task lists** - Wrong phase
83
- - ❌ Ask for ticket ID (extract from branch name automatically)
84
- - ❌ Skip asking for feature description first
85
- - ❌ Ask questions before exploring the codebase
86
- - ❌ Skip the intensive Q&A phase
87
- - ❌ Accept vague requirements
34
+ ## Example Workflow
88
35
 
89
- **If you find yourself doing any of the above, STOP IMMEDIATELY. You are exceeding this command's scope.**
36
+ 1. User runs `/5:plan-feature`
37
+ 2. Agent asks: "Please describe the feature you want to develop"
38
+ 3. User provides feature description
39
+ 4. Agent extracts Ticket ID from branch name
40
+ 5. Agent spawns Explore sub-agent for codebase analysis
41
+ 6. Sub-agent returns findings
42
+ 7. Agent asks 5-10 clarifying questions (one at a time), informed by findings
43
+ 8. Agent creates `.5/features/{TICKET-ID}-{description}/feature.md`
44
+ 9. Agent outputs: "Feature spec created. Next: /clear then /5:plan-implementation"
90
45
 
91
- ## Planning Process
46
+ ## Process
92
47
 
93
48
  ### Step 1: Gather Feature Description
94
49
 
95
- **FIRST ACTION:** Ask the developer for the feature description using AskUserQuestion.
96
-
97
- - Expect a **free-text answer**
98
- - Do NOT provide options
99
- - Do NOT ask follow-up questions yet
100
- - This input may be multiple paragraphs
101
-
102
- Prompt to use:
50
+ Ask the developer for the feature description using AskUserQuestion:
103
51
 
104
52
  "Please describe the feature you want to develop. Paste the full ticket description or explain it in your own words."
105
53
 
106
- Do NOT ask for ticket ID - it will be extracted from the branch name automatically.
107
-
108
- ### Step 2: Extract Ticket ID from Branch Name
54
+ - Expect free-text answer, do NOT provide options
55
+ - Do NOT ask follow-up questions yet
109
56
 
110
- Automatically extract the ticket ID from the current git branch:
111
- - Branch format: `{TICKET-ID}-description` (ticket is prefix)
112
- - Use `git branch --show-current` to get branch name
113
- - Extract ticket ID using configurable pattern from config (e.g., `PROJ-\d+` or `\d+`)
114
- - Ask the developer if the ticket ID is correct
115
- - If no ticket ID found, ask developer for it
57
+ ### Step 2: Extract Ticket ID
116
58
 
117
- ### Step 3: Spawn Read-Only Explore Agent
59
+ Extract the ticket ID from the current git branch:
60
+ - Use `git branch --show-current` via a Bash-free approach: spawn a quick Explore agent if needed
61
+ - Branch format: `{TICKET-ID}-description`
62
+ - Extract using configurable pattern from config
63
+ - Ask the developer to confirm the ticket ID
64
+ - If not found, ask for it
118
65
 
119
- **CRITICAL: Delegate ALL codebase exploration to a sub-agent.**
66
+ ### Step 3: Spawn Explore Agent for Codebase Analysis
120
67
 
121
- Spawn a Task with `subagent_type=Explore` with the following prompt structure:
68
+ Spawn a Task with `subagent_type=Explore`:
122
69
 
123
70
  ```
124
71
  Analyze the codebase for a feature planning session.
125
72
 
126
- **Feature Description:** {paste the user's feature description here}
73
+ **Feature Description:** {paste the user's feature description}
127
74
 
128
75
  **Your Task:**
129
- 1. Explore the project structure to identify modules/components
76
+ 1. Explore project structure to identify modules/components
130
77
  2. Find existing implementations similar to this feature
131
- 3. Identify coding patterns and conventions used
78
+ 3. Identify coding patterns and conventions
132
79
  4. Find reusable components or patterns
133
- 5. Identify which existing files/modules would be affected
80
+ 5. Identify affected files/modules
81
+ 6. Run `git branch --show-current` to get the current branch name
134
82
 
135
83
  **Report Format:**
136
- Return a structured report with:
84
+ - Current git branch name
137
85
  - Project structure overview
138
86
  - Relevant existing patterns found
139
87
  - Similar implementations discovered
@@ -141,211 +89,61 @@ Return a structured report with:
141
89
  - Reusable components identified
142
90
  - Potential integration points
143
91
 
144
- **IMPORTANT:** You are a READ-ONLY agent. Only use Read, Glob, and Grep tools. Do NOT suggest implementations or write any code.
92
+ **IMPORTANT:** READ-ONLY agent. Only use Read, Glob, Grep, and Bash (for git branch) tools.
145
93
  ```
146
94
 
147
- **Wait for the sub-agent to return its findings before proceeding.**
148
-
149
- ### Step 4: Intensive Collaboration (5-10 Questions, ONE AT A TIME)
150
-
151
- **CRITICAL:** After receiving the exploration report, engage in intensive Q&A. This is NOT optional.
95
+ Wait for the sub-agent to return before proceeding.
152
96
 
153
- - Ask 5-10 clarifying questions using AskUserQuestion
154
- - **ONE question at a time** - wait for answer before next question
155
- - Do NOT list multiple questions in one message
156
- - Do NOT skip to creating feature.md before asking at least 5 questions
157
- - **Use the sub-agent's findings to inform your questions**
97
+ ### Step 4: Intensive Q&A (5-10 Questions, One at a Time)
158
98
 
159
- #### Step 4b: Optional Targeted Re-Exploration
99
+ After receiving the exploration report, ask 5-10 clarifying questions using AskUserQuestion.
160
100
 
161
- During Q&A, the user may mention components, modules, or patterns that weren't covered in the initial exploration. You MAY spawn additional targeted Explore agents to gather more specific information.
101
+ **Rules:**
102
+ - ONE question at a time — wait for answer before next
103
+ - Use sub-agent findings to ask informed questions
104
+ - At least 5 questions before creating the spec
105
+ - Provide 2-4 options where meaningful
162
106
 
163
- **When to trigger re-exploration:**
164
- - User mentions a specific file, module, or service by name that wasn't in the initial report
165
- - User's answer reveals a dependency or integration point not previously identified
166
- - User asks "have you looked at X?" or "what about the Y module?"
167
- - Understanding a specific component is critical for accurate feature specification
107
+ **Question categories:** Requirements clarity, scope boundaries, edge cases, performance expectations, testing strategy, integration points (from findings), alternative approaches (from findings), complexity trade-offs.
168
108
 
169
- **How to re-explore:**
109
+ **Challenge assumptions:** "Is this the simplest solution?", "Could we reuse existing X?" (reference findings), "What happens when Y fails?"
170
110
 
171
- Spawn a targeted Task with `subagent_type=Explore`:
111
+ **Optional re-exploration:** If the user mentions components not covered in the initial report, spawn a targeted Explore agent:
172
112
 
173
113
  ```
174
114
  Targeted exploration for feature planning.
175
-
176
- **Context:** During Q&A, the user mentioned {specific component/module/pattern}.
177
-
178
- **Focused Task:**
179
- 1. Find and analyze {specific component} mentioned by user
180
- 2. Understand how it works and its patterns
181
- 3. Identify how it might relate to the planned feature
182
-
183
- **Report:** Provide a focused summary of:
184
- - How this component works
185
- - Relevant patterns or conventions
186
- - How it could integrate with the planned feature
187
-
188
- **IMPORTANT:** READ-ONLY. Only use Read, Glob, and Grep tools.
115
+ **Context:** User mentioned {component/module}.
116
+ **Task:** Find and analyze {component}, understand patterns, identify relation to planned feature.
117
+ **READ-ONLY.** Only use Read, Glob, and Grep tools.
189
118
  ```
190
119
 
191
- **Guidelines:**
192
- - Keep re-explorations focused and specific (not broad searches)
193
- - Use findings to ask better follow-up questions
194
- - Document relevant discoveries in the final feature spec
195
-
196
- **Question categories to explore:**
197
-
198
- 1. **Requirements Clarity**
199
- - What exactly should this feature do?
200
- - What is the expected user experience?
201
- - What are the inputs and outputs?
202
-
203
- 2. **Scope Boundaries**
204
- - What is explicitly IN scope?
205
- - What is explicitly OUT of scope?
206
- - Are there any constraints or limitations?
207
-
208
- 3. **Edge Cases**
209
- - What happens when X fails?
210
- - How should the system handle invalid inputs?
211
- - What are the boundary conditions?
120
+ ### Step 5: Create Feature Specification
212
121
 
213
- 4. **Performance Expectations**
214
- - Are there performance requirements?
215
- - How much data needs to be handled?
216
- - Are there concurrency concerns?
122
+ Determine a feature name: short, kebab-case (e.g., "add-emergency-schedule").
217
123
 
218
- 5. **Testing Strategy**
219
- - How will we verify this works?
220
- - What are the acceptance criteria?
221
- - What test scenarios should be covered?
124
+ Write to `.5/features/{TICKET-ID}-{description}/feature.md` using Write tool.
222
125
 
223
- 6. **Integration Points** (informed by sub-agent findings)
224
- - Which existing components/modules are affected?
225
- - Are there API changes?
226
- - How does this interact with existing features?
126
+ Use the template structure from `.claude/templates/workflow/FEATURE-SPEC.md`. Populate all sections:
127
+ - Ticket ID & Summary
128
+ - Problem Statement
129
+ - Requirements (functional and non-functional)
130
+ - Constraints
131
+ - Affected Components (from exploration)
132
+ - Acceptance Criteria
133
+ - Alternatives Considered
134
+ - Questions & Answers (from Q&A session)
227
135
 
228
- 7. **Alternative Approaches** (informed by sub-agent findings)
229
- - Have you considered approach X instead?
230
- - Is this the simplest solution?
231
- - Could we reuse existing components?
136
+ ## PLANNING COMPLETE
232
137
 
233
- 8. **Complexity Trade-offs**
234
- - What is the complexity vs value trade-off?
235
- - Should this be broken into smaller features?
236
- - Are there simpler alternatives?
138
+ After writing feature.md, output exactly:
237
139
 
238
- **Challenge assumptions:**
239
- - "Is this the simplest solution?"
240
- - "Have you considered X alternative?"
241
- - "What happens when Y fails?"
242
- - "Could we use existing Z component instead?" (reference sub-agent findings)
243
- - "Is a full factory needed or just simple creation?"
244
-
245
- **Ask questions ONE AT A TIME.** Use AskUserQuestion for each question. For clarifying questions, provide 2-4 options where meaningful. Wait for the user's answer before asking the next question. Open questions (like feature description) can use free text.
246
-
247
- ### Step 5: Determine Feature Name
248
-
249
- Based on the feature description and discussion:
250
- - Create a short, kebab-case description (e.g., "add-emergency-schedule")
251
- - This will be used for the feature spec filename: `{TICKET-ID}-{description}.md`
252
-
253
- ### Step 6: Create Feature Specification
254
-
255
- Write a comprehensive feature spec to `.5/features/{TICKET-ID}-{description}/feature.md` using the Write tool.
256
-
257
- **THIS IS YOUR FINAL OUTPUT. After creating this file, proceed immediately to Step 7.**
258
-
259
- **Template Reference:** Use the structure from `.claude/templates/workflow/FEATURE-SPEC.md`
260
-
261
- The template contains placeholders like `{TICKET-ID}`, `{Title}`, `{1-2 sentence overview}`, etc. Replace all placeholders with actual values based on your research and the Q&A session.
262
-
263
- Key sections to populate:
264
- - **Ticket ID & Summary** - From branch extraction and feature description
265
- - **Problem Statement** - Why this feature is needed
266
- - **Requirements** - Functional and non-functional requirements from discussion
267
- - **Constraints** - Business, technical, and time constraints identified
268
- - **Affected Components** - From sub-agent exploration report
269
- - **Entity Definitions** - If the feature involves new data structures
270
- - **Acceptance Criteria** - Verifiable criteria for success
271
- - **Alternatives Considered** - Options discussed and why chosen approach was selected
272
- - **Questions & Answers** - Document the Q&A from the collaboration phase
273
- - **Next Steps** - Instructions for proceeding to Phase 2
274
-
275
- ## Instructions
276
-
277
- Follow these steps **IN ORDER** and **STOP after step 8**:
278
-
279
- 1. **Ask for feature description** - Request task description and additional information from developer
280
- 2. **Extract Ticket ID** - Get current branch name and extract ticket ID using configured pattern
281
- 3. **Spawn Explore sub-agent** - Delegate codebase analysis to read-only agent, wait for report
282
- 4. **Ask 5-10 clarifying questions** - Based on sub-agent findings, ask informed questions using AskUserQuestion - This is MANDATORY
283
- - **4b. Re-explore as needed** - If user mentions unknown components during Q&A, spawn targeted Explore agents
284
- 5. **Challenge assumptions** - Present alternatives, question complexity
285
- 6. **Determine feature name** - Create short kebab-case description
286
- 7. **Create feature specification** in `.5/features/{TICKET-ID}-{description}/feature.md` using Write tool
287
- 8. **Inform the developer** to review the spec, run `/clear` to reset context, and then run `/5:plan-implementation {TICKET-ID}-{description}`
288
-
289
- **🛑 STOP HERE. YOUR JOB IS COMPLETE. DO NOT PROCEED TO IMPLEMENTATION.**
290
-
291
- ## Key Principles
292
-
293
- 1. **Feature description first** - Get context before asking detailed questions
294
- 2. **Auto-extract ticket ID** - Parse from branch name automatically
295
- 3. **Delegate exploration** - Use read-only sub-agent for codebase analysis
296
- 4. **Explore before questioning** - Wait for sub-agent report before asking questions
297
- 5. **Challenge assumptions** - Don't accept requirements at face value
298
- 6. **Explore alternatives** - Present options and trade-offs
299
- 7. **Document decisions** - Capture why choices were made
300
- 8. **Structured output** - Use the feature spec template consistently
301
- 9. **Clear handoff** - Tell developer what to do next
302
-
303
-
304
- ## Common Feature Types
305
-
306
- ### New Component/Module
307
- - Requires: Core logic, data structures, tests
308
- - Questions: Validation rules? Business logic? API design?
309
-
310
- ### Extend Existing Component
311
- - Requires: Update existing code, maintain compatibility
312
- - Questions: Breaking change? Migration needed? Impact on existing functionality?
313
-
314
- ### Add Business Rule
315
- - Requires: Logic implementation, validation
316
- - Questions: When is rule enforced? What are edge cases?
317
-
318
- ### API Endpoint
319
- - Requires: Endpoint implementation, request/response handling
320
- - Questions: API design? Error handling? Authentication?
140
+ ```
141
+ Feature spec created at `.5/features/{name}/feature.md`
321
142
 
322
- ## Example Workflow
143
+ Next steps:
144
+ 1. Review the feature spec
145
+ 2. If changes needed: /5:discuss-feature {name}
146
+ 3. If approved: /clear then /5:plan-implementation {name}
147
+ ```
323
148
 
324
- 1. User runs: `/5:plan-feature`
325
- 2. Main agent asks: "Please describe the feature you want to develop"
326
- 3. User: "I want to add emergency schedule tracking to products. It should allow marking products as emergency and setting a schedule window."
327
- 4. Main agent extracts: Ticket ID `PROJ-1234` from branch `PROJ-1234-add-emergency-schedule`
328
- 5. **Main agent spawns Explore sub-agent** with feature description
329
- 6. **Sub-agent returns report:** Found Product model at src/models/Product.ts, existing ScheduleService at src/services/ScheduleService.ts, similar pattern in src/models/Promotion.ts...
330
- 7. Main agent asks Question 1: "Should emergency schedules support recurring patterns or just one-time windows?"
331
- 8. User answers: "One-time for now, but we have the NotificationService that should trigger alerts"
332
- 9. **Main agent spawns targeted Re-Explore** for NotificationService (wasn't in initial report)
333
- 10. **Sub-agent returns:** Found NotificationService at src/services/NotificationService.ts with event-based triggers...
334
- 11. Main agent continues Q&A with better context about notifications
335
- 12. Main agent challenges: "The sub-agent found existing ScheduleService - could we reuse it instead of creating new scheduling infrastructure?"
336
- 13. Main agent determines: Feature name `add-emergency-schedule`
337
- 14. Main agent creates: `.5/features/PROJ-1234-add-emergency-schedule/feature.md` using Write tool
338
- 15. Main agent tells user: "✅ Feature spec created at `.5/features/PROJ-1234-add-emergency-schedule/feature.md`
339
-
340
- **Next steps:**
341
- 1. Review the feature spec
342
- 2. If changes needed: `/5:discuss-feature PROJ-1234-add-emergency-schedule`
343
- 3. If approved:
344
- - **Run `/clear` to reset context** (recommended between phases)
345
- - Then run `/5:plan-implementation PROJ-1234-add-emergency-schedule`"
346
-
347
- **🛑 COMMAND COMPLETE. The skill stops here and waits for user to proceed to Phase 2.**
348
-
349
- ## Related Documentation
350
-
351
- - [5-Phase Workflow Guide](../docs/workflow-guide.md)
149
+ STOP. You are a planner. Your job is done. Do not implement.