5-phase-workflow 1.9.5 → 2.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.
Files changed (44) hide show
  1. package/README.md +68 -420
  2. package/bin/install.js +294 -64
  3. package/bin/sync-agents.js +50 -11
  4. package/docs/findings.md +3 -3
  5. package/docs/workflow-guide.md +110 -1046
  6. package/package.json +6 -5
  7. package/src/agents/step-executor-agent.md +49 -0
  8. package/src/agents/step-orchestrator-agent.md +111 -0
  9. package/src/agents/verification-agent.md +78 -0
  10. package/src/commands/5/address-review-findings.md +69 -403
  11. package/src/commands/5/apply-review-findings.md +66 -0
  12. package/src/commands/5/configure.md +110 -76
  13. package/src/commands/5/discuss-feature.md +47 -57
  14. package/src/commands/5/eject.md +7 -6
  15. package/src/commands/5/implement.md +202 -0
  16. package/src/commands/5/plan.md +164 -0
  17. package/src/commands/5/reconfigure.md +30 -29
  18. package/src/commands/5/reply-pr-comments.md +46 -0
  19. package/src/commands/5/review.md +95 -0
  20. package/src/commands/5/split.md +190 -0
  21. package/src/commands/5/synchronize-agents.md +4 -4
  22. package/src/commands/5/triage-pr-comments.md +70 -0
  23. package/src/commands/5/update.md +8 -8
  24. package/src/hooks/check-updates.js +50 -7
  25. package/src/hooks/plan-guard.js +28 -22
  26. package/src/hooks/statusline.js +50 -4
  27. package/src/skills/configure-docs-index/SKILL.md +16 -20
  28. package/src/skills/configure-skills/SKILL.md +12 -12
  29. package/src/templates/AGENTS.md +94 -0
  30. package/src/templates/workflow/FIX-PLAN.md +1 -1
  31. package/src/templates/workflow/PLAN-COMPACT.md +42 -0
  32. package/src/templates/workflow/PLAN.md +58 -34
  33. package/src/templates/workflow/REVIEW-FINDINGS.md +7 -16
  34. package/src/templates/workflow/REVIEW-SUMMARY.md +5 -0
  35. package/src/templates/workflow/STATE.json +32 -3
  36. package/src/agents/component-executor.md +0 -57
  37. package/src/commands/5/implement-feature.md +0 -381
  38. package/src/commands/5/plan-feature.md +0 -293
  39. package/src/commands/5/plan-implementation.md +0 -333
  40. package/src/commands/5/quick-implement.md +0 -375
  41. package/src/commands/5/review-code.md +0 -212
  42. package/src/commands/5/verify-implementation.md +0 -277
  43. package/src/templates/workflow/FEATURE-SPEC.md +0 -100
  44. package/src/templates/workflow/VERIFICATION-REPORT.md +0 -103
@@ -1,1119 +1,183 @@
1
- # Claude-Assisted Development Workflow Guide
1
+ # dev-workflow Guide
2
2
 
3
- ## Table of Contents
3
+ v2.0.0 collapses the old five command path into the dev-workflow command path:
4
4
 
5
- 1. [Overview](#overview)
6
- 2. [Architecture](#architecture)
7
- 3. [The 5-Phase Workflow](#the-5-phase-workflow)
8
- 4. [Phase 1: Feature Planning](#phase-1-feature-planning)
9
- 5. [Phase 2: Implementation Planning](#phase-2-implementation-planning)
10
- 6. [Phase 3: Orchestrated Implementation](#phase-3-orchestrated-implementation)
11
- 7. [Phase 4: Verify Implementation](#phase-4-verify-implementation)
12
- 8. [Phase 5: Code Review](#phase-5-code-review)
13
- 9. [Complete Example Walkthrough](#complete-example-walkthrough)
14
- 10. [Tips for Effective Collaboration](#tips-for-effective-collaboration)
15
- 11. [Troubleshooting](#troubleshooting)
16
- 12. [Advanced Topics](#advanced-topics)
17
-
18
- ---
19
-
20
- ## Overview
21
-
22
- This guide describes how to use Claude Code's skill system to efficiently implement features in any software project. The workflow minimizes context usage while ensuring systematic, high-quality implementations.
23
-
24
- ### Why This Workflow?
25
-
26
- **Benefits:**
27
- - Lower context usage (orchestrator stays thin, agents do heavy lifting in forked contexts)
28
- - Better collaboration (intensive Q&A ensures requirements are clear)
29
- - Session continuity (can pause and resume without losing context)
30
- - Systematic delivery (clear phases, clear handoffs, clear verification)
31
- - Developer confidence (transparent process, visible progress, predictable results)
32
-
33
- **When to Use:**
34
- - New domain entities
35
- - Extending existing domains
36
- - Adding business rules/validation
37
- - Creating API endpoints
38
- - Any non-trivial feature requiring multiple files
39
-
40
- **When NOT to Use:**
41
- - Simple bug fixes
42
- - Typo corrections
43
- - Single-line changes
44
- - Purely exploratory work
45
-
46
- **Middle Ground - Use `/quick-implement`:**
47
- For small, well-understood tasks (1-5 files). Uses same state tracking and skills as full workflow, but with inline planning and `/build-project` verification instead of full agents.
48
-
49
- ---
50
-
51
- ## Getting Started
52
-
53
- ### Installation
54
-
55
- ```bash
56
- npx 5-phase-workflow
5
+ ```text
6
+ /5:plan -> /5:implement -> /5:review
57
7
  ```
58
8
 
59
- The installer copies workflow files to `.claude/` directory. **It does NOT create configuration.**
60
-
61
- ### Required First Step: Configuration
62
-
63
- ```bash
64
- /5:configure
65
- ```
66
-
67
- **This is a required setup step.** The configure command uses the 5-phase workflow itself:
68
-
69
- 1. **Phase 1** (`/5:configure`): Analyzes project, gathers preferences, creates feature spec
70
- 2. **Phase 2** (`/5:plan-implementation CONFIGURE`): Creates implementation plan
71
- 3. **Phase 3** (`/5:implement-feature CONFIGURE`): Executes configuration
72
- 4. **Phase 4** (`/5:verify-implementation`): Verifies configuration
73
-
74
- After completing these steps, you have:
75
- - `.5/config.json` with your project settings
76
- - `CLAUDE.md` with comprehensive project documentation
77
- - `.5/ARCHITECTURE.md`, `.5/TESTING.md`, `.5/CONCERNS.md` with focused documentation
78
- - Project-specific skills in `.claude/skills/`
79
-
80
- **Without configuration, workflow commands will fail.**
81
-
82
- ### Your First Feature
83
-
84
- After configuration is complete, start your first feature:
85
-
86
- ```bash
87
- /5:plan-feature
88
- ```
89
-
90
- ---
9
+ The package is named `foifi`.
91
10
 
92
11
  ## Architecture
93
12
 
94
- The workflow uses a **4-layer architecture**:
95
-
96
- ```
97
- Developer
98
- |
99
- v
100
- Commands (thin orchestrators, main context)
101
- | - /plan-feature, /plan-implementation
102
- | - /implement-feature, /verify-implementation, /review-code
103
- v
104
- Agents (heavy lifting, forked contexts)
105
- | - step-executor, step-verifier
106
- | - integration-agent, verification-agent, review-processor
107
- v
108
- Skills (atomic operations, called by agents)
109
- | - /build-project, /run-tests, /generate-readme
110
- | - Project-specific skills as configured
111
- v
112
- Tools (file operations, compilation, IDE integration)
113
- - Read, Write, Edit, Bash, Glob, Grep, JetBrains MCP
114
- ```
115
-
116
- ### Layer Responsibilities
117
-
118
- | Layer | Context | Responsibility |
119
- |-------|---------|---------------|
120
- | **Commands** | Main (inherit) | User interaction, orchestration, state tracking |
121
- | **Agents** | Forked | Heavy work: skill execution, compilation, review parsing |
122
- | **Skills** | Called by agents | Atomic operations: create files, run builds, run tests |
123
- | **Tools** | N/A | Low-level operations: file I/O, bash, IDE integration |
124
-
125
- ### Why Agents?
13
+ The workflow separates human decisions from mechanical execution.
126
14
 
127
- Commands used to call skills directly, consuming main context for heavy operations. With the agent layer:
15
+ - `plan.md` is the only planning artifact.
16
+ - `codebase-scan.md` caches discovery so later phases avoid repeated scanning.
17
+ - `state.json` is generated by `step-orchestrator-agent` and drives implementation.
18
+ - `state-events.jsonl` stores detailed execution history so `state.json` stays compact.
19
+ - `verification-agent` records final verification status in `state.json`.
128
20
 
129
- - **Commands stay thin**: Only read plans, spawn agents, process results, update state
130
- - **Agents handle heavy work**: File creation, compilation, review parsing in forked contexts
131
- - **Skills remain unchanged**: Same atomic operations, called by agents instead of commands
132
- - **Main context preserved**: More room for user interaction and error handling
21
+ This keeps planning short and reviewable while still giving implementation agents enough structured data to work reliably.
133
22
 
134
- ### Agent Inventory
23
+ ## Plan
135
24
 
136
- | Agent | Spawned By | Purpose |
137
- |-------|-----------|---------|
138
- | `step-executor` | implement-feature | Execute all components of a single step |
139
- | `step-verifier` | implement-feature | Build and check files after each step |
140
- | `integration-agent` | implement-feature | Wire components, register routes (final step) |
141
- | `verification-agent` | verify-implementation | Full verification (files, compilation, tests) |
142
- | `review-processor` | review-code | Run CodeRabbit CLI and categorize findings |
25
+ Run:
143
26
 
144
- ---
145
-
146
- ## The 5-Phase Workflow
147
-
148
- ```
149
- +-----------------------------------------------------------------+
150
- | Phase 1: Feature Planning |
151
- | |
152
- | Developer: /plan-feature |
153
- | Claude: Asks 6-10 questions, challenges assumptions |
154
- | Output: .5/features/{TICKET-ID}-{description}/feature.md |
155
- | Developer: Reviews and approves spec |
156
- +-----------------------------+-------------------------------------+
157
- |
158
- v
159
- +-----------------------------------------------------------------+
160
- | Phase 2: Implementation Planning |
161
- | |
162
- | Developer: /plan-implementation {TICKET-ID}-{description} |
163
- | Claude: Maps to modules, skills, dependency steps |
164
- | Output: .5/{ticket}/plan/ (atomic structure) |
165
- | - meta.md, step-N.md files, verification.md |
166
- | Developer: Reviews technical approach |
167
- +-----------------------------+-------------------------------------+
168
- |
169
- v
170
- +-----------------------------------------------------------------+
171
- | Phase 3: Orchestrated Implementation |
172
- | |
173
- | Developer: /implement-feature {TICKET-ID}-{description} |
174
- | Claude: Spawns agents for each step, tracks state |
175
- | Agents: step-executor -> step-verifier (per step) |
176
- | Agent: integration-agent (final step) |
177
- | Output: Completed feature + state file |
178
- +-----------------------------+-------------------------------------+
179
- |
180
- v
181
- +-----------------------------------------------------------------+
182
- | Phase 4: Verify Implementation |
183
- | |
184
- | Developer: /verify-implementation (or automatic) |
185
- | Agent: verification-agent checks files, compiles, runs tests |
186
- | Claude: Reports results, prompts for commit |
187
- | Output: Verification report |
188
- +-----------------------------+-------------------------------------+
189
- |
190
- v
191
- +-----------------------------------------------------------------+
192
- | Phase 5: Code Review |
193
- | |
194
- | Developer: /review-code |
195
- | Agent: review-processor runs CodeRabbit, categorizes findings |
196
- | Claude: Shows overview, applies user-approved fixes |
197
- | Output: Improved code + review report |
198
- +-----------------------------------------------------------------+
199
- ```
200
-
201
- ---
202
-
203
- ## Phase 1: Feature Planning
204
-
205
- ### Goal
206
- Understand requirements, challenge assumptions, and create a comprehensive feature specification.
207
-
208
- ### Command
209
- ```bash
210
- /plan-feature
27
+ ```text
28
+ /5:plan
211
29
  ```
212
30
 
213
- ### What Happens
214
-
215
- 1. **Intensive Q&A**: Claude asks 6-10 clarifying questions
216
- - Requirements clarity
217
- - Scope boundaries
218
- - Edge cases
219
- - Performance expectations
220
- - Testing strategy
221
- - Integration points
222
- - Alternative approaches
223
- - Complexity trade-offs
224
-
225
- 2. **Assumption Challenges**: Claude questions your approach
226
- - "Is this the simplest solution?"
227
- - "Have you considered X alternative?"
228
- - "What happens when Y fails?"
229
- - "Could we reuse existing Z component?"
230
-
231
- 3. **Codebase Exploration**: Claude examines existing patterns
232
- - Checks affected domains
233
- - Reviews similar implementations
234
- - Identifies reusable components
235
-
236
- 4. **Ticket ID Collection**: Claude asks for ticket ID if not provided
237
-
238
- 5. **Feature Spec Creation**: Claude writes structured spec to:
239
- ```
240
- .5/features/{TICKET-ID}-{description}/feature.md
241
- ```
242
-
243
- ### Your Role
244
-
245
- 1. **Answer questions thoroughly**: Don't rush, clarify requirements
246
- 2. **Challenge back if needed**: If Claude misunderstands, correct it
247
- 3. **Provide ticket ID**: From Jira or your task tracking system
248
- 4. **Review the spec carefully**: This becomes the contract for implementation
249
- 5. **Approve or request changes**: Don't proceed if spec is unclear
31
+ or:
250
32
 
251
- ### Next Steps
252
-
253
- After approval:
254
- ```bash
255
- /plan-implementation {TICKET-ID}-{description}
33
+ ```text
34
+ $5-plan
256
35
  ```
257
36
 
258
- ---
259
-
260
- ## Phase 2: Implementation Planning
37
+ The planner gathers requirements, explores the codebase, asks targeted questions, and writes:
261
38
 
262
- ### Goal
263
- Map feature requirements to technical components, skills, and dependency steps.
264
-
265
- ### Command
266
- ```bash
267
- /plan-implementation PROJ-1234-add-user-profile
39
+ ```text
40
+ .5/features/{feature-name}/plan.md
41
+ .5/features/{feature-name}/codebase-scan.md
268
42
  ```
269
- (Replace with your ticket ID and description)
270
-
271
- ### What Happens
272
-
273
- 1. **Load Feature Spec**: Claude reads the approved feature spec
274
-
275
- 2. **Technical Analysis**: Analyzes project structure to identify affected areas
276
- - Examines existing codebase architecture
277
- - Identifies modules, layers, or packages that need changes
278
- - Maps to your project's specific patterns (MVC, Clean Architecture, etc.)
279
- - Determines which files need to be created or modified
280
-
281
- 3. **Technical Q&A**: Claude asks 3-5 framework-specific questions
282
- - Which persistence layer changes are needed?
283
- - What validation approach should be used?
284
- - Which API endpoints need to be created/modified?
285
- - Are there business logic components needed?
286
- - What integration points exist?
287
-
288
- 4. **Component Mapping**: Each component mapped to a skill or creation task
289
- - Based on available project-specific skills
290
- - Or described as file creation tasks if no skill exists
291
- - Example: User model -> /model-generator (if available) or manual creation
292
43
 
293
- 5. **Dependency Steps**: Groups components into implementation steps (configurable, default 3)
294
- - **Step 1 (Foundation)**: Core models, types, schemas (parallel execution)
295
- - **Step 2 (Logic)**: Business logic, services, handlers (sequential if needed)
296
- - **Step 3 (Integration)**: API routes, wiring, tests (sequential for integration)
44
+ `plan.md` uses either the normal template or `PLAN-COMPACT.md` for small, low-risk changes with 1-2 components and no migration, security/auth, or public API contract change. It contains:
297
45
 
298
- Note: Step count and organization is configurable in `.5/config.json`
46
+ - overview
47
+ - what changes
48
+ - existing patterns to follow
49
+ - constraints
50
+ - scope in/out
51
+ - acceptance criteria
52
+ - decisions
53
+ - module impact
54
+ - component checklist
55
+ - technical notes
299
56
 
300
- 6. **Implementation Plan Creation**: Claude writes an **atomic plan structure** to:
301
- ```
302
- .5/features/{TICKET-ID}-{description}/plan/
303
- ├── meta.md # Feature metadata and risks
304
- ├── step-1.md # Step 1 components (YAML format)
305
- ├── step-2.md # Step 2 components
306
- ├── step-N.md # Step N components
307
- └── verification.md # Build/test configuration
308
- ```
57
+ The component checklist has only four columns: component, action, target path, intent. It does not contain step grouping, model selection, verify commands, or pattern-reference wiring.
309
58
 
310
- **Atomic Plan Structure (Format Version 2.0):**
311
- - Each step is in a separate file for modularity
312
- - Components are stored in YAML format for easy parsing
313
- - Metadata and verification config are separated
314
- - Benefits: scalability, navigation, agent efficiency, version control
59
+ ## Refining A Plan
315
60
 
316
- **File Formats:**
317
- - `meta.md`: YAML frontmatter (feature, ticket, totals) + risks section
318
- - `step-N.md`: YAML frontmatter (step, name, mode) + components YAML block + expected outputs
319
- - `verification.md`: Build/test commands and expected file lists
61
+ Run:
320
62
 
321
- ### Your Role
322
-
323
- 1. **Answer technical questions**: Clarify implementation details
324
- 2. **Review module impact**: Ensure correct modules affected
325
- 3. **Check component checklist**: All components needed?
326
- 4. **Validate dependency steps**: Does order make sense?
327
- 5. **Review technical decisions**: Agree with approach?
328
- 6. **Approve or request changes**: Don't proceed if plan is unclear
329
-
330
- ### Next Steps
331
-
332
- After approval:
333
- ```bash
334
- /implement-feature {TICKET-ID}-{description}
63
+ ```text
64
+ /5:discuss-feature {feature-name}
335
65
  ```
336
66
 
337
- ---
67
+ Use this when the reviewed plan needs changed scope, additional acceptance criteria, or a corrected component checklist.
338
68
 
339
- ## Phase 3: Orchestrated Implementation
69
+ ## Implement
340
70
 
341
- ### Goal
342
- Execute the implementation plan with state tracking, using agents in forked contexts to minimize main context usage.
71
+ Run:
343
72
 
344
- ### Command
345
- ```bash
346
- /implement-feature PROJ-1234-add-user-profile
73
+ ```text
74
+ /5:implement {feature-name}
347
75
  ```
348
- (Replace with your ticket ID and description)
349
-
350
- ### What Happens
351
-
352
- 1. **Load Implementation Plan**: Command reads the approved atomic plan
353
- - Reads `plan/meta.md` for feature metadata and total steps count
354
- - Loads each `plan/step-N.md` on-demand during execution
355
- - Parses YAML components from each step file
356
-
357
- 2. **Initialize State File**: Creates tracking file
358
- ```
359
- .5/features/{TICKET-ID}-{description}/state.json
360
- ```
361
-
362
- 3. **Create Task List**: One item per step (default 3 steps, configurable)
363
-
364
- 4. **Execute Steps** (for each implementation step):
365
-
366
- ```
367
- [Main Context] Construct step input from plan
368
- |
369
- v
370
- [FORK] step-executor agent
371
- | - Calls skills for each component
372
- | - Creates/modifies files as needed
373
- | - Returns created files and status
374
- v
375
- [Main Context] Process results, update state
376
- |
377
- v
378
- [FORK] step-verifier agent
379
- | - Runs project build command
380
- | - Checks files for problems
381
- | - Returns verification status
382
- v
383
- [Main Context] Process results, handle failures, next step
384
- ```
385
-
386
- 5. **Integration (Final Step)**:
387
-
388
- ```
389
- [FORK] integration-agent
390
- | - Wires components using project patterns
391
- | - Registers routes/endpoints
392
- | - Runs final build and tests
393
- v
394
- [Main Context] Process results, update state
395
- ```
396
-
397
- 6. **Report Completion**: Summary of all work done
398
-
399
- ### State File
400
-
401
- Tracks progress in JSON format:
402
- ```json
403
- {
404
- "ticketId": "PROJ-1234",
405
- "featureName": "PROJ-1234-add-user-profile",
406
- "status": "in-progress",
407
- "currentStep": 2,
408
- "totalSteps": 3,
409
- "completedComponents": [...],
410
- "pendingComponents": [...],
411
- "contextUsage": "45%"
412
- }
413
- ```
414
-
415
- ### Your Role
416
-
417
- 1. **Monitor progress**: Watch task list updates
418
- 2. **Review errors if any**: Claude will escalate if stuck
419
- 3. **Approve integration changes**: Review wiring/routing changes
420
- 4. **Trust the delegation**: Let Claude delegate to agents and skills
421
-
422
- ### Output Files
423
-
424
- - **State file**: `.5/features/{ticket}/state.json`
425
- - **All created files**: As specified in implementation plan
426
-
427
- ### Next Steps
428
-
429
- After implementation completes:
430
- ```bash
431
- /verify-implementation
432
- ```
433
- (This may be invoked automatically by `/implement-feature`)
434
-
435
- ---
436
-
437
- ## Phase 4: Verify Implementation
438
-
439
- ### Goal
440
- Systematically verify that the implementation is complete, correct, and ready for review.
441
-
442
- ### Command
443
- ```bash
444
- /verify-implementation
445
- ```
446
- (Usually invoked automatically by `/implement-feature` at the end of Phase 3)
447
-
448
- ### What Happens
449
-
450
- 1. **Load Implementation State**: Command reads state file from Phase 3
451
-
452
- 2. **Spawn verification-agent**: Delegates all checks to forked context
453
-
454
- 3. **Agent Performs Checks**:
455
- - File existence (all planned files exist?)
456
- - IDE diagnostics (errors vs warnings)
457
- - Production code compilation
458
- - Test code compilation
459
- - Test execution
460
-
461
- 4. **Process Results**: Command receives structured verification data
462
-
463
- 5. **Save Report**: Writes verification report to:
464
- `.5/features/{ticket}/verification.md`
465
-
466
- 6. **Update State File**: Marks verification status
467
-
468
- 7. **Prompt for Commit**: If passed, asks user about committing
469
-
470
- ### Verification Statuses
471
-
472
- **PASSED**
473
- - All files exist
474
- - No errors (warnings OK)
475
- - Compilation successful
476
- - All tests passing
477
-
478
- **PASSED WITH WARNINGS**
479
- - All files exist
480
- - Warnings present (but no errors)
481
- - Compilation successful
482
- - All tests passing
483
-
484
- **FAILED**
485
- - Missing files, OR
486
- - Errors present, OR
487
- - Compilation failures, OR
488
- - Test failures
489
-
490
- ### Your Role
491
-
492
- 1. **Review verification report**: Check the generated markdown report
493
- 2. **Address failures if any**: Fix errors before proceeding
494
- 3. **Decide on warnings**: Warnings don't block, but review them
495
- 4. **Proceed to code review**: If passed, move to Phase 5
496
-
497
- ### Next Steps
498
-
499
- If verification passed:
500
- ```bash
501
- /review-code
502
- ```
503
-
504
- If verification failed:
505
- - Address the reported issues
506
- - Re-run `/verify-implementation` after fixes
507
-
508
- ---
509
-
510
- ## Phase 5: Code Review
511
-
512
- ### Goal
513
- Use automated code review to catch quality issues, apply auto-fixes, and ensure code meets standards.
514
-
515
- ### Command
516
- ```bash
517
- /review-code
518
- ```
519
-
520
- ### What Happens
521
-
522
- 1. **Check Prerequisites**: Verifies CodeRabbit CLI is installed and authenticated
523
-
524
- 2. **Ask Review Scope**: User chooses what to review (staged, branch, files)
525
-
526
- 3. **Spawn review-processor agent**: Delegates CodeRabbit execution to forked context
527
- - Agent runs `coderabbit review --plain`
528
- - Agent parses output and categorizes findings
529
- - Agent returns structured results (fixable, questions, manual)
530
-
531
- 4. **Show Overview**: Command presents categorized findings to user
532
-
533
- 5. **User Decisions**: Ask user which fixes to apply, how to handle questions
534
-
535
- 6. **Apply Fixes**: Only user-approved fixes applied via Edit tool
536
-
537
- 7. **Handle Questions**: Present each question to user if requested
538
-
539
- 8. **Verify**: Compile and test after applying fixes
540
-
541
- 9. **Save Report**: Store review summary in `.5/features/{feature-name}/`
542
-
543
- ### Your Role
544
-
545
- 1. **Choose review scope**: What changes to review
546
- 2. **Review findings overview**: Understand what CodeRabbit found
547
- 3. **Decide on fixes**: Which to apply, which to skip
548
- 4. **Answer questions**: Respond to clarifications
549
- 5. **Address manual issues**: Fix issues that require judgment
550
- 6. **Approve changes**: If satisfied, proceed to commit
551
-
552
- ### Next Steps
553
-
554
- After code review:
555
- 1. Review all changes (implementation + review fixes)
556
- 2. Run tests locally if desired
557
- 3. Commit and push
558
- 4. Create pull request
559
-
560
- ---
561
-
562
- ## Complete Example Walkthrough
563
-
564
- Let's walk through implementing "Add user profile endpoint to API"
565
76
 
566
- ### Step 1: Start Feature Planning
77
+ Implementation does three things:
567
78
 
568
- ```bash
569
- You: /plan-feature
79
+ 1. Spawns `step-orchestrator-agent` to derive compact `state.json` from `plan.md` and `codebase-scan.md`.
80
+ 2. Spawns executor agents for each component using an inline executor contract, parallelizing independent work.
81
+ 3. Spawns `verification-agent` to verify completeness, correctness, build/tests, acceptance criteria, and test coverage, then records the result in `state.json`.
570
82
 
571
- Claude: I'll help you plan this feature. Let me ask some clarifying questions...
83
+ `state.json` tracks:
572
84
 
573
- [Claude asks 8 questions about requirements, scope, validation, API design, etc.]
85
+ - steps and execution mode
86
+ - pending/completed/failed components
87
+ - dependency edges
88
+ - targeted pattern references
89
+ - verify commands
90
+ - baseline and verification results
91
+ - compact latest command/commit summaries, with detailed history in `state-events.jsonl`
574
92
 
575
- You: [Answer each question]
93
+ If implementation is interrupted, rerun `/5:implement {feature-name}` to resume from the recorded step.
576
94
 
577
- Claude: Let me explore the existing user domain...
578
- [Claude examines existing user models, routes, controllers]
95
+ Verification runs inline during `/5:implement`. It checks planned files, final build/test commands, acceptance criteria, and recorded component verification outcomes.
579
96
 
580
- Claude: What's the ticket ID for this feature?
97
+ ## Review
581
98
 
582
- You: PROJ-1234
99
+ Run:
583
100
 
584
- Claude: Feature spec created at .5/PROJ-1234-add-user-profile/feature.md
585
-
586
- Next steps:
587
- 1. Review the feature spec
588
- 2. Run `/clear` to reset context (recommended between phases)
589
- 3. Then run `/5:plan-implementation PROJ-1234-add-user-profile`
101
+ ```text
102
+ /5:review
590
103
  ```
591
104
 
592
- ### Step 2: Review Feature Spec
593
-
594
- Open `.5/PROJ-1234-add-user-profile/feature.md` and review:
595
- - Problem statement clear?
596
- - Requirements complete?
597
- - Acceptance criteria verifiable?
598
- - Alternatives make sense?
599
-
600
- If satisfied, clear context and proceed to next phase.
601
-
602
- ### Step 3: Clear Context and Start Implementation Planning
603
-
604
- ```bash
605
- You: /clear
606
- [Context cleared]
607
-
608
- You: /plan-implementation PROJ-1234-add-user-profile
609
-
610
- Claude: Reading feature spec...
611
-
612
- [Claude analyzes technical requirements]
105
+ Review can use native agent review or CodeRabbit if configured. Native review triages changed files by risk and reads full files only for high-risk changes or when diff context is insufficient. It saves findings to:
613
106
 
614
- Claude: Let me ask a few technical questions...
615
- - Should profile validation be separate or part of existing UserValidator?
616
- - Do we need database schema changes or just new API endpoints?
617
- - What authentication/authorization is required?
618
-
619
- You: [Answer technical questions]
620
-
621
- Claude: Implementation plan created at
622
- .5/PROJ-1234-add-user-profile/plan/
623
-
624
- Atomic plan structure:
625
- - meta.md: Feature metadata, 3 steps, 6 components
626
- - step-1.md: Foundation (2 components, parallel)
627
- - step-2.md: Logic (2 components, sequential)
628
- - step-3.md: Integration (2 components, sequential)
629
- - verification.md: Build/test configuration
630
-
631
- Module Impact:
632
- - src/models: 1 update (User model)
633
- - src/services: 1 new file (ProfileService)
634
- - src/routes: 1 update (user routes)
635
- - src/validators: 1 new file (ProfileValidator)
636
-
637
- Component Checklist:
638
- Step 1 (Foundation): User model update, ProfileValidator
639
- Step 2 (Logic): ProfileService with business logic
640
- Step 3 (Integration): API route registration, tests
641
-
642
- Review the plan, then:
643
- 1. Run `/clear` to reset context (recommended between phases)
644
- 2. Run `/5:implement-feature PROJ-1234-add-user-profile`
107
+ ```text
108
+ .5/features/{feature-name}/review-findings-{timestamp}.md
645
109
  ```
646
110
 
647
- ### Step 4: Clear Context and Start Implementation (with Agents)
648
-
649
- ```bash
650
- You: /clear
651
- [Context cleared]
652
-
653
- You: /implement-feature PROJ-1234-add-user-profile
111
+ Then apply approved findings:
654
112
 
655
- Claude: Reading implementation plan...
656
- Creating state file...
657
- Initializing tasks...
658
-
659
- [FORK] step-executor: Step 1 (Foundation)
660
- -> User model updated (added profile fields)
661
- -> ProfileValidator created
662
- [FORK] step-verifier: Step 1
663
- -> Build successful
664
-
665
- [FORK] step-executor: Step 2 (Logic)
666
- -> ProfileService created
667
- -> Business logic implemented
668
- [FORK] step-verifier: Step 2
669
- -> Build successful
670
-
671
- [FORK] step-executor: Step 3 (Integration)
672
- -> Profile routes added
673
- -> Tests created
674
- [FORK] step-verifier: Step 3
675
- -> Build successful
676
-
677
- [FORK] integration-agent: Final integration
678
- -> Routes registered in app
679
- -> All tests passing
680
-
681
- Feature implementation complete!
682
- - All 4 components created/updated
683
- - State file updated
684
- - Ready for verification!
685
-
686
- Next steps:
687
- 1. Run `/clear` to reset context (recommended between phases)
688
- 2. Run `/5:verify-implementation PROJ-1234-add-user-profile`
113
+ ```text
114
+ /5:address-review-findings {feature-name}
689
115
  ```
690
116
 
691
- ### Step 5: Clear Context and Verify Implementation
692
-
693
- ```bash
694
- You: /clear
695
- [Context cleared]
696
-
697
- You: /verify-implementation
117
+ `/5:address-review-findings` is a compact coordinator. It routes local fixes, PR comment triage, and PR replies through focused helper commands:
698
118
 
699
- Claude: Loading implementation state...
119
+ - `/5:apply-review-findings`
120
+ - `/5:triage-pr-comments`
121
+ - `/5:reply-pr-comments`
700
122
 
701
- [FORK] verification-agent
702
- -> File existence: 4/4 exist
703
- -> Problem detection: 0 errors, 2 warnings
704
- -> Build: Successful
705
- -> Tests: 23/23 passing
123
+ PR comment decisions are recorded in `.5/features/{feature-name}/pr-comment-decisions.json` when PR handling is used.
706
124
 
707
- Verification Status: PASSED WITH WARNINGS
125
+ ## Configuration
708
126
 
709
- Would you like to commit these changes now?
127
+ First-time setup:
710
128
 
711
- Next steps:
712
- 1. Run `/clear` to reset context (recommended between phases)
713
- 2. Run `/5:review-code`
129
+ ```text
130
+ /5:configure
131
+ /5:implement CONFIGURE
714
132
  ```
715
133
 
716
- ### Step 6: Clear Context and Code Review
717
-
718
- ```bash
719
- You: /clear
720
- [Context cleared]
721
-
722
- You: /review-code
723
-
724
- Claude: Checking CodeRabbit CLI... installed
725
- What would you like to review? [Staged changes]
726
-
727
- [FORK] review-processor
728
- -> CodeRabbit found 3 issues
729
- -> 2 fixable, 1 manual
730
-
731
- CodeRabbit Review Results:
732
- - 2 fixable issues
733
- - 1 manual review item
734
-
735
- Apply all fixable issues? [Yes]
134
+ `/5:configure` writes `.5/config.json` and a CONFIGURE plan. `/5:implement CONFIGURE` generates documentation, the codebase index, AGENTS.md, CLAUDE.md shim, selected skills, and scoped rules.
736
135
 
737
- Applied:
738
- - Removed unused import
739
- - Added missing error handling
136
+ Refresh generated docs/index/skills later with:
740
137
 
741
- Manual issues:
742
- - Consider adding rate limiting (line 42)
743
-
744
- Build: Successful
745
- Tests: All passing
138
+ ```text
139
+ /5:reconfigure
746
140
  ```
747
141
 
748
- ---
749
-
750
- ## Tips for Effective Collaboration
751
-
752
- ### During Feature Planning (Phase 1)
753
-
754
- 1. **Be thorough with questions**: Don't rush, clarify everything
755
- 2. **Challenge assumptions**: If Claude suggests something unexpected, ask why
756
- 3. **Provide examples**: If requirements are complex, give examples
757
- 4. **Think about edge cases**: What happens when things go wrong?
758
- 5. **Consider existing patterns**: Mention similar features for consistency
759
-
760
- ### During Implementation Planning (Phase 2)
761
-
762
- 1. **Validate technical approach**: Ensure approach aligns with codebase patterns
763
- 2. **Check module dependencies**: Make sure step order is correct
764
- 3. **Question complexity**: If plan seems overly complex, challenge it
765
- 4. **Clarify verification steps**: Make sure verification will catch issues
766
-
767
- ### During Implementation (Phase 3)
768
-
769
- 1. **Monitor progress**: Watch task list for updates
770
- 2. **Don't interrupt mid-step**: Let steps complete before reviewing
771
- 3. **Review errors promptly**: If Claude escalates, review and respond
772
- 4. **Trust the process**: Agents handle heavy lifting, you focus on high-level review
773
-
774
- ### During Verification (Phase 4)
775
-
776
- 1. **Review the verification report carefully**: Check all sections
777
- 2. **Warnings are OK**: Don't block on warnings, but review them
778
- 3. **Fix errors immediately**: Address any errors before proceeding
779
- 4. **Re-verify after fixes**: Run `/verify-implementation` again if you made changes
780
-
781
- ### During Code Review (Phase 5)
782
-
783
- 1. **Review auto-fixes**: Check what CodeRabbit changed automatically
784
- 2. **Address manual issues**: Fix issues that require human judgment
785
- 3. **Don't skip this phase**: Code review catches quality issues early
786
- 4. **Learn from feedback**: CodeRabbit feedback helps improve coding patterns
787
-
788
- ### General Tips
789
-
790
- 1. **Clear context between phases**: Run `/clear` before starting each new phase to reset context. This keeps conversations focused, prevents context pollution, and improves efficiency. Each phase reads necessary artifacts from previous phases.
791
- 2. **Use git branches**: Create feature branch before starting
792
- 3. **Commit often**: Commit after Phase 3 completes successfully
793
- 4. **Run verification manually**: Re-run /verify-implementation after fixes
794
- 5. **Review state files**: Check `.5/features/{feature-name}/state.json` for progress tracking
795
- 6. **Save verification reports**: Keep reports for documentation/debugging
796
-
797
- ---
142
+ `/5:reconfigure` writes `.5/reconfigure-manifest.json` and passes that compact manifest to documentation and skill refresh helpers instead of duplicating long detection summaries in prompts.
798
143
 
799
144
  ## Troubleshooting
800
145
 
801
- ### Issue: Feature spec is too vague
802
-
803
- **Solution**: Ask Claude more questions during Phase 1. Use AskUserQuestion to clarify requirements before finalizing spec.
804
-
805
- ### Issue: Implementation plan identifies wrong modules
806
-
807
- **Solution**: Provide feedback during Phase 2 review. Tell Claude which modules should actually be affected.
808
-
809
- ### Issue: Component creation fails during implementation
810
-
811
- **Symptom**: Claude reports agent failure or compilation error
812
-
813
- **Solution**:
814
- 1. Check error message in state file
815
- 2. If small fix (missing import, syntax error), Claude will fix in main context
816
- 3. If large fix needed, Claude will re-spawn agent with corrected prompt
817
- 4. If stuck after 2 attempts, Claude will escalate to you
818
-
819
- ### Issue: Tests fail during verification
820
-
821
- **Solution**:
822
- 1. Review verification report for test failures
823
- 2. Check test output for error details
824
- 3. Fix failing tests manually or ask Claude to fix
825
- 4. Re-run /verify-implementation after fixes
826
-
827
- ### Issue: Context usage too high
828
-
829
- **Symptom**: Claude warns about 50% or 80% context usage
830
-
831
- **Solution**:
832
- 1. Let current step complete
833
- 2. Commit current progress
834
- 3. Break remaining work into new feature
835
- 4. Start new session for remaining work
836
-
837
- ### Issue: State file corrupted
838
-
839
- **Symptom**: JSON parse error when reading state file
840
-
841
- **Solution**:
842
- 1. Open `.5/features/{ticket}/state.json`
843
- 2. Fix JSON syntax error
844
- 3. Or delete and re-run /implement-feature (will restart from beginning)
845
-
846
- ### Issue: Verification passes with warnings
146
+ If planning is blocked by a stale guard:
847
147
 
848
- **Status**: PASSED WITH WARNINGS
849
-
850
- **Action**:
851
- - Warnings don't block completion
852
- - Review warnings in verification report
853
- - Optionally fix warnings (unused imports, etc.)
854
- - Proceed to commit
855
-
856
- ### Issue: Need to pause mid-implementation
857
-
858
- **Solution**:
859
- 1. Let current step complete if possible
860
- 2. Commit current progress
861
- 3. State file preserves progress
862
- 4. Resume later by running /implement-feature {ticket} (will continue from current step)
863
-
864
- ### Issue: Agent returns unexpected results
865
-
866
- **Solution**:
867
- 1. Check the agent output for error details
868
- 2. The command will attempt to fix small issues
869
- 3. For persistent failures, the command will escalate to you
870
- 4. You can re-run the command to retry from the failed step
871
-
872
- ---
873
-
874
- ## Advanced Topics
875
-
876
- ### Resuming Interrupted Implementation
877
-
878
- If implementation was interrupted:
879
- 1. Check state file: `.5/features/{ticket}/state.json`
880
- 2. Note `currentStep` value
881
- 3. Re-run `/implement-feature {ticket}`
882
- 4. Claude will resume from `currentStep`
883
-
884
- ### Breaking Large Features into Parts
885
-
886
- If feature is too large:
887
- 1. Complete Phase 1 (feature planning) for full feature
888
- 2. In Phase 2, split implementation plan into parts:
889
- - Part 1: Core model + validation
890
- - Part 2: API layer
891
- - Part 3: Advanced features
892
- 3. Implement each part separately
893
- 4. Each part gets own state file
894
-
895
- ### Custom Verification
896
-
897
- If you need custom verification:
898
- 1. Let /verify-implementation run standard checks
899
- 2. Add your own checks (performance tests, integration tests, etc.)
900
- 3. Document custom checks in verification report
901
-
902
- ### Automated Code Review with CodeRabbit
903
-
904
- Use `/review-code` to get AI-powered code review before committing:
905
-
906
- **Prerequisites:**
907
- - Install CodeRabbit CLI: https://docs.coderabbit.ai/cli/installation
908
- - Authenticate: `coderabbit auth login`
909
-
910
- **Usage:**
911
- ```bash
912
- # After making changes, stage them
913
- git add .
914
-
915
- # Run automated review
916
- /review-code
917
-
918
- # review-processor agent will:
919
- # - Run CodeRabbit CLI
920
- # - Parse and categorize findings
921
- # - Return structured results to the command
922
- #
923
- # The command will then:
924
- # - Show overview to you
925
- # - Ask which fixes to apply
926
- # - Apply approved fixes
927
- # - Verify changes build correctly
928
- ```
929
-
930
- ### Working with Existing Features
931
-
932
- If modifying existing feature:
933
- 1. Phase 1: Describe modifications clearly
934
- 2. Phase 2: Plan will include "Modified" status for affected modules
935
- 3. Phase 3: Agents will use Edit tool instead of Write for modifications
936
-
937
- ### Parallel Feature Development
938
-
939
- If working on multiple features:
940
- 1. Each feature has own branch
941
- 2. Each feature has own state file
942
- 3. Can run /plan-feature for multiple features
943
- 4. Implement one at a time (to avoid context conflicts)
944
-
945
- ---
946
-
947
- ## Quick Reference
948
-
949
- ### Commands
950
-
951
- | Command | Phase | Purpose |
952
- |---------|-------|---------|
953
- | `/plan-feature` | 1 | Create feature specification |
954
- | `/plan-implementation {ticket}` | 2 | Create implementation plan |
955
- | `/implement-feature {ticket}` | 3 | Execute implementation via agents |
956
- | `/verify-implementation {ticket}` | 4 | Verify via verification-agent |
957
- | `/review-code` | 5 | Review via review-processor agent |
958
- | `/quick-implement` | - | Fast path for small tasks (inline planning, same state tracking) |
959
-
960
- ### Agents
961
-
962
- | Agent | Phase | Purpose |
963
- |-------|-------|---------|
964
- | `step-executor` | 3 | Execute step components via skills |
965
- | `step-verifier` | 3 | Build and check after each step |
966
- | `integration-agent` | 3 | Wire components and routes (final step) |
967
- | `verification-agent` | 4 | Full verification checks |
968
- | `review-processor` | 5 | Run CodeRabbit and categorize findings |
969
-
970
- ### File Locations
971
-
972
- | File | Purpose | Committed? |
973
- |------|---------|------------|
974
- | `.5/features/{ticket}/feature.md` | Feature spec | Yes (after approval) |
975
- | `.5/features/{ticket}/plan/` | Atomic implementation plan (meta.md, step-N.md, verification.md) | Yes (after approval) |
976
- | `.5/features/{ticket}/state.json` | Progress tracking | No (gitignored) |
977
- | `.5/features/{ticket}/verification.md` | Verification report | No (gitignored) |
978
- | `.5/features/{ticket}/review-{timestamp}.md` | CodeRabbit review report | No (gitignored) |
979
-
980
- ### State File Status Values
981
-
982
- | Status | Meaning |
983
- |--------|---------|
984
- | `in-progress` | Implementation ongoing |
985
- | `completed` | Implementation finished successfully |
986
- | `failed` | Implementation failed, needs fixes |
987
-
988
- ### Verification Status Values
989
-
990
- | Status | Meaning | Action |
991
- |--------|---------|--------|
992
- | `passed` | All checks successful | Ready to commit |
993
- | `passed-with-warnings` | Warnings but no errors | Review warnings, then commit |
994
- | `failed` | Errors found | Fix errors, re-verify |
995
-
996
- ---
997
-
998
- ## Configuring for Different Tech Stacks
999
-
1000
- The 5-phase workflow is designed to work with any technology stack. Configuration is stored in `.5/config.json` and can be customized using the `/5:configure` command.
1001
-
1002
- ### Quick Setup
1003
-
1004
- ```bash
1005
- # Interactive configuration wizard
1006
- /5:configure
1007
- ```
1008
-
1009
- The wizard will:
1010
- 1. Auto-detect your project type (Node.js, Python, Java, Rust, Go, etc.)
1011
- 2. Set up appropriate build and test commands
1012
- 3. Configure ticket ID patterns
1013
- 4. Set up step structure (default 3 steps)
1014
-
1015
- ### Configuration Examples
1016
-
1017
- **JavaScript/TypeScript (Node.js)**
1018
- ```json
1019
- {
1020
- "ticket": {
1021
- "pattern": "[A-Z]+-\\d+",
1022
- "extractFromBranch": true
1023
- },
1024
- "build": {
1025
- "command": "npm run build",
1026
- "testCommand": "npm test"
1027
- },
1028
- "steps": [
1029
- { "name": "foundation", "mode": "parallel" },
1030
- { "name": "logic", "mode": "sequential" },
1031
- { "name": "integration", "mode": "sequential" }
1032
- ]
1033
- }
1034
- ```
1035
-
1036
- **Python**
1037
- ```json
1038
- {
1039
- "build": {
1040
- "command": "python -m py_compile",
1041
- "testCommand": "pytest"
1042
- },
1043
- "steps": [
1044
- { "name": "models", "mode": "parallel" },
1045
- { "name": "services", "mode": "sequential" },
1046
- { "name": "api", "mode": "sequential" }
1047
- ]
1048
- }
148
+ ```text
149
+ /5:unlock
1049
150
  ```
1050
151
 
1051
- **Java (Gradle)**
1052
- ```json
1053
- {
1054
- "build": {
1055
- "command": "gradle build",
1056
- "testCommand": "gradle test"
1057
- },
1058
- "steps": [
1059
- { "name": "domain", "mode": "parallel" },
1060
- { "name": "business-logic", "mode": "sequential" },
1061
- { "name": "api-integration", "mode": "sequential" }
1062
- ]
1063
- }
1064
- ```
1065
-
1066
- ### Customizing Steps
152
+ If an implementation failed:
1067
153
 
1068
- You can configure the number and names of implementation steps. The default is 3 steps:
154
+ 1. Read `.5/features/{feature-name}/state.json`.
155
+ 2. Fix external blockers if needed.
156
+ 3. Re-run `/5:implement {feature-name}` to resume.
1069
157
 
1070
- - **Step 1 (Foundation)**: Core models, types, schemas - executed in parallel
1071
- - **Step 2 (Logic)**: Business logic, services - executed sequentially if dependencies exist
1072
- - **Step 3 (Integration)**: API routes, wiring, tests - executed sequentially
158
+ If an upgrade left old command files installed, run:
1073
159
 
1074
- For more complex projects, you might use 4-5 steps:
1075
-
1076
- ```json
1077
- {
1078
- "steps": [
1079
- { "name": "models", "mode": "parallel" },
1080
- { "name": "validation", "mode": "parallel" },
1081
- { "name": "services", "mode": "sequential" },
1082
- { "name": "api", "mode": "sequential" },
1083
- { "name": "integration", "mode": "sequential" }
1084
- ]
1085
- }
160
+ ```text
161
+ npx foifi --upgrade
1086
162
  ```
1087
163
 
1088
- ### Auto-Detection
1089
-
1090
- The workflow automatically detects:
1091
- - **Build system**: package.json, build.gradle, Cargo.toml, go.mod, Makefile, etc.
1092
- - **Test runner**: Jest, Vitest, pytest, cargo test, go test, Gradle, Maven, etc.
1093
- - **Project type**: Express, NestJS, Next.js, Django, FastAPI, Spring Boot, etc.
164
+ v2.0.0 removes old commands during upgrade:
1094
165
 
1095
- You can override auto-detected values in the config file.
166
+ - `plan-feature`
167
+ - `plan-implementation`
168
+ - `implement-feature`
169
+ - `verify-implementation`
170
+ - `review-code`
171
+ - `quick-implement`
1096
172
 
1097
- ### Further Customization
1098
-
1099
- See the `/5:configure` command for interactive configuration, or manually edit `.5/config.json` to customize:
1100
- - Ticket ID patterns
1101
- - Branch naming conventions
1102
- - Build and test commands
1103
- - Step structure and execution modes
1104
- - Integration patterns
1105
-
1106
- ---
1107
-
1108
- ## Related Documentation
1109
-
1110
- - **[CLAUDE.md](../../CLAUDE.md)** - Project context, domain patterns and conventions
1111
- - **[Skills README](../../skills/README.md)** - All available skills
1112
-
1113
- ---
1114
-
1115
- ## Feedback
173
+ ## Quick Reference
1116
174
 
1117
- Found an issue with this workflow or have suggestions?
1118
- - Create an issue: https://github.com/anthropics/claude-code/issues
1119
- - Or discuss with your team
175
+ | Command | Purpose |
176
+ |---------|---------|
177
+ | `/5:plan` | Create unified plan |
178
+ | `/5:discuss-feature` | Refine existing plan |
179
+ | `/5:implement` | Implement and verify |
180
+ | `/5:review` | Review changes |
181
+ | `/5:address-review-findings` | Apply approved findings |
182
+ | `/5:configure` | Create project config and CONFIGURE plan |
183
+ | `/5:reconfigure` | Refresh generated project context |