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.
@@ -7,165 +7,82 @@ context: fork
7
7
  user-invocable: true
8
8
  ---
9
9
 
10
- # Review Code (Phase 5)
11
-
12
- ## Prerequisites Check
13
-
14
- **CRITICAL: Check for configuration before proceeding (skip for CONFIGURE feature)**
15
-
16
- If the feature argument is `CONFIGURE`, skip this check entirely — the CONFIGURE workflow is what creates the config file.
17
-
18
- For all other features, run this check:
19
-
20
- ```bash
21
- if [ ! -f ".claude/.5/config.json" ]; then
22
- echo "❌ Configuration not found"
23
- echo ""
24
- echo "Please run /5:configure first to set up your project."
25
- echo ""
26
- echo "The configure command will:"
27
- echo " • Detect your project type and build commands"
28
- echo " • Set up ticket tracking conventions"
29
- echo " • Generate documentation (CLAUDE.md)"
30
- echo " • Create project-specific skills"
31
- exit 1
32
- fi
33
- ```
34
-
35
- **If config doesn't exist and the feature is NOT `CONFIGURE`, STOP IMMEDIATELY. Do not proceed with the workflow.**
10
+ <role>
11
+ You are a Code Reviewer. You review code and apply user-approved fixes.
12
+ You do NOT implement new features. You do NOT refactor beyond review findings.
13
+ You ALWAYS get user consent before applying ANY fix.
14
+ You ALWAYS verify changes after applying fixes (build + test).
15
+ You follow the exact step sequence below. Do not skip or reorder steps.
16
+ After saving the review report, you are DONE.
17
+ </role>
36
18
 
37
- ## Overview
38
-
39
- This command automates code review using a configurable review tool. The review tool is set in `.claude/.5/config.json` (`reviewTool` field). Two tools are supported:
40
-
41
- - **Claude** (default) — Built-in, zero setup. A fresh-context agent reviews code blind with no knowledge of what was built.
42
- - **CodeRabbit** — External CLI tool. Requires installation and authentication.
43
-
44
- Both tools produce the same structured output format, so all downstream steps (presenting results, applying fixes, saving reports) work identically regardless of which tool is used.
45
-
46
- **Workflow A: Interactive Review** (default)
47
- 1. Checks prerequisites in main context
48
- 2. Asks user what to review
49
- 3. Delegates review execution and output parsing to a spawned agent
50
- 4. Presents structured results and asks user for decisions
51
- 5. Applies fixes based on user approval
52
- 6. Reports results
53
-
54
- **Workflow B: File-Based Annotation** (user preference)
55
- 1. Runs review and saves findings to `.5/features/{feature-name}/review-{timestamp}-findings.md`
56
- 2. User edits the file to mark which findings to fix ([FIX], [SKIP], [MANUAL])
57
- 3. User runs `/review-code apply` to read annotations and apply marked fixes
58
-
59
- **Architecture:** `Command -> Agent -> Review Tool`
60
- - This command stays in the main context (user interaction, fix application)
61
- - Spawned agent runs the review and categorizes findings (forked context)
62
-
63
- ## ⚠️ Scope Constraint
19
+ # Review Code (Phase 5)
64
20
 
65
- **THIS COMMAND REVIEWS CODE AND APPLIES USER-APPROVED FIXES ONLY.**
21
+ ## Prerequisites
66
22
 
67
- Read config to determine review tool
68
- ✅ Check prerequisites for the selected tool
69
- ✅ Ask user what to review
70
- ✅ Spawn review agent (Claude or CodeRabbit)
71
- ✅ Present findings overview to user
72
- ✅ Ask user which fixes to apply
73
- ✅ Apply ONLY user-approved fixes
74
- ✅ Verify changes (compile and test)
75
- ✅ Save review report
23
+ If the feature argument is `CONFIGURE`, skip this check.
76
24
 
77
- Run the review tool directly (agent does this)
78
- ❌ Parse review output directly (agent does this)
79
- ❌ Apply fixes without user approval
80
- ❌ Skip the overview step — user must see all findings first
81
- ❌ Skip verification — always compile and test after fixes
25
+ For all other features: Read `.claude/.5/config.json`. If the file does not exist, STOP immediately and tell the user:
82
26
 
83
- **ALWAYS GET USER CONSENT BEFORE APPLYING ANY FIXES.**
27
+ "Configuration not found. Please run `/5:configure` first to set up your project."
84
28
 
85
- ## Prerequisites
29
+ Do NOT proceed without configuration.
86
30
 
87
- **Claude reviewer (default):**
88
- - Git repository with changes to review
89
- - No additional setup needed
31
+ ## Review Tools
90
32
 
91
- **CodeRabbit reviewer:**
92
- - CodeRabbit CLI installed (`coderabbit` command available)
93
- - User logged in to CodeRabbit (`coderabbit auth status` shows authenticated)
94
- - Git repository with changes to review
33
+ Two review tools are supported (configured in `.claude/.5/config.json` field `reviewTool`):
95
34
 
96
- ## Review Process
35
+ - **Claude** (default) — Built-in, zero setup. A fresh-context agent reviews code blind.
36
+ - **CodeRabbit** — External CLI. Requires `coderabbit` installed and authenticated.
97
37
 
98
- ### Step 1: Determine Review Tool and Check Prerequisites
38
+ Both produce the same structured output format.
99
39
 
100
- **1a. Read config:**
101
- ```bash
102
- # Read review tool preference
103
- cat .claude/.5/config.json
104
- # Look for "reviewTool" field — values: "claude", "coderabbit", or "none"
105
- ```
40
+ ## Process
106
41
 
107
- If no config exists or `reviewTool` is not set, default to `"claude"`.
42
+ ### Step 1: Determine Review Tool
108
43
 
109
- If `reviewTool` is `"none"`, inform user that automated review is disabled and exit.
44
+ Read `.claude/.5/config.json` and check the `reviewTool` field.
110
45
 
111
- **1b. If review tool is CodeRabbit, check prerequisites:**
46
+ - If not set or missing, default to `"claude"`
47
+ - If `"none"`, inform user that automated review is disabled and STOP
112
48
 
49
+ **If CodeRabbit:** Check prerequisites via Bash:
113
50
  ```bash
114
- # Check if coderabbit command exists
115
- which coderabbit
116
-
117
- # Check authentication status
118
- coderabbit auth status
51
+ which coderabbit && coderabbit auth status
119
52
  ```
53
+ If not installed or not authenticated, ask user via AskUserQuestion:
54
+ - "Switch to Claude for this review? (Recommended)" / "I'll install CodeRabbit first"
55
+ - If they choose CodeRabbit setup, provide install instructions and STOP
120
56
 
121
- **If CodeRabbit not installed or not logged in:**
122
- - Inform user: "CodeRabbit CLI is not installed or you're not logged in."
123
- - Provide installation guidance:
124
- - macOS: `brew install --cask coderabbit`
125
- - Other: `curl -fsSL https://cli.coderabbit.ai/install.sh | sh`
126
- - Then: `coderabbit auth login`
127
- - Ask user (via AskUserQuestion): "Would you like to switch to Claude (built-in) for this review instead?"
128
- - Options: "Yes, use Claude for this review (Recommended)", "No, I'll install CodeRabbit first"
129
- - If yes: proceed with Claude as the review tool for this session
130
- - If no: exit without reviewing
131
-
132
- **1c. If review tool is Claude:** no prerequisites to check — proceed directly.
133
-
134
- ### Step 2: Check for Special Modes
135
-
136
- **Check if user invoked with `apply` argument:**
137
- ```
138
- /review-code apply
139
- ```
57
+ ### Step 2: Check for Apply Mode
140
58
 
141
- If `apply` mode:
142
- - Skip to Step 11 (Apply Annotated Findings)
59
+ If user invoked with `apply` argument (`/5:review-code apply`):
60
+ - Skip to Step 10 (Apply Annotated Findings)
143
61
  - Do NOT run a new review
144
62
 
145
- **Otherwise, proceed with new review:**
63
+ Otherwise, continue with new review.
146
64
 
147
65
  ### Step 3: Determine What to Review
148
66
 
149
- Ask the user what to review and how to present results using AskUserQuestion:
67
+ Ask the user via AskUserQuestion:
150
68
 
151
69
  **Question 1: What to review?**
152
- 1. **Staged changes** (default) - Review `git diff --cached`
153
- 2. **Unstaged changes** - Review `git diff`
154
- 3. **All changes** - Review both staged and unstaged
155
- 4. **Current branch** - Review all commits on current branch vs main/master
156
- 5. **Specific files** - User specifies file paths
70
+ 1. Staged changes (`git diff --cached`) — default
71
+ 2. Unstaged changes (`git diff`)
72
+ 3. All changes (`git diff HEAD`)
73
+ 4. Current branch vs main/master (`git diff main...HEAD`)
157
74
 
158
- **Question 2: How to review?**
159
- 1. **Interactive** (default) - Show findings and apply fixes immediately
160
- 2. **Save to file** - Save findings to `.5/{feature-name}/` for later annotation
75
+ **Question 2: How to present results?**
76
+ 1. Interactive (show findings, apply fixes immediately) — default
77
+ 2. Save to file (for later annotation with `[FIX]`/`[SKIP]`/`[MANUAL]`)
161
78
 
162
79
  ### Step 4: Spawn Review Agent
163
80
 
164
- Branch based on the review tool determined in Step 1.
81
+ Spawn a single agent to execute the review. Do NOT run the review yourself.
165
82
 
166
- #### Step 4A: CodeRabbit Review Agent
83
+ **Architecture:** You (main agent) handle user interaction and fix application. The spawned agent runs the review and categorizes findings.
167
84
 
168
- If the review tool is **CodeRabbit**, spawn:
85
+ #### 4A: CodeRabbit Review Agent
169
86
 
170
87
  ```
171
88
  Task tool call:
@@ -178,53 +95,37 @@ Task tool call:
178
95
  ## Review Scope
179
96
  Scope: {scope from Step 3}
180
97
  Base Branch: {branch-name if scope is "branch"}
181
- Files: [{file-paths if scope is "files"}]
182
98
 
183
99
  ## Process
184
-
185
- 1. **Run CodeRabbit** based on scope:
100
+ 1. Run CodeRabbit based on scope:
186
101
  - staged: `coderabbit review --plain`
187
- - files: `coderabbit review --plain {file1} {file2}`
188
102
  - branch: `coderabbit review --plain --base {base-branch}`
189
-
190
- 2. **Parse output** - Extract file paths, line numbers, severity, descriptions, suggested fixes
191
-
192
- 3. **Categorize each finding:**
103
+ 2. Parse output — extract file paths, line numbers, severity, descriptions, suggested fixes
104
+ 3. Categorize each finding:
193
105
  - **Fixable**: Mechanical fixes (unused imports, null checks, formatting, typos)
194
106
  - **Questions**: Clarifications needed (validation logic, trade-offs)
195
107
  - **Manual**: Requires judgment (refactoring, architecture, security)
196
108
 
197
109
  ## Output Format
198
110
  Return:
199
- ```
200
111
  Status: success | failed
201
112
  Error: {if failed}
202
-
203
- Summary:
204
- total: {N}, fixable: {N}, questions: {N}, manual: {N}
205
-
113
+ Summary: total: {N}, fixable: {N}, questions: {N}, manual: {N}
206
114
  Fixable Issues:
207
115
  - file: {path}, line: {N}, description: {what}, fix: {suggestion}
208
-
209
116
  Questions:
210
117
  - file: {path}, line: {N}, question: {what the reviewer asks}
211
-
212
118
  Manual Review:
213
119
  - file: {path}, line: {N}, description: {what}, severity: {level}
214
-
215
- Raw Output:
216
- {full review output}
217
- ```
120
+ Raw Output: {full review output}
218
121
 
219
122
  ## Rules
220
- - DO NOT apply fixes (parent handles with user consent)
123
+ - DO NOT apply fixes
221
124
  - DO NOT interact with user
222
- - Include ALL findings - let parent decide what to apply
125
+ - Include ALL findings
223
126
  ```
224
127
 
225
- #### Step 4B: Claude Review Agent
226
-
227
- If the review tool is **Claude**, spawn:
128
+ #### 4B: Claude Review Agent
228
129
 
229
130
  ```
230
131
  Task tool call:
@@ -232,88 +133,63 @@ Task tool call:
232
133
  model: sonnet
233
134
  description: "Run Claude code review"
234
135
  prompt: |
235
- You are a code reviewer. You have NO prior knowledge of what was built, why it was built,
236
- or what the implementation plan was. You are reviewing this code blind, purely on its merits.
136
+ You are a code reviewer. You have NO prior knowledge of what was built or why.
137
+ Review this code blind, purely on its merits.
237
138
 
238
139
  ## Review Scope
239
140
  Scope: {scope from Step 3}
240
141
  Base Branch: {branch-name if scope is "branch"}
241
- Files: [{file-paths if scope is "files"}]
242
142
 
243
143
  ## Process
244
-
245
- 1. **Get the diff** based on scope:
246
- - staged: run `git diff --cached`
247
- - unstaged: run `git diff`
248
- - all: run `git diff HEAD`
249
- - branch: run `git diff {base-branch}...HEAD`
250
- - files: run `git diff -- {file1} {file2}` (or `git diff --cached -- {file1} {file2}` if staged)
251
-
252
- 2. **Read full files** For every file that appears in the diff, read the complete file content.
253
- Also read 1 level of imports (files directly imported by changed files) to understand context.
254
-
255
- 3. **Review for:**
256
- - **Bugs**: Logic errors, off-by-one, null/undefined access, race conditions, missing error handling
257
- - **Security**: Injection, XSS, auth bypass, secrets exposure, insecure defaults
258
- - **Performance**: N+1 queries, unnecessary allocations, missing pagination, blocking operations
259
- - **Code quality**: Dead code, unclear naming, duplicated logic, overly complex conditionals
260
- - **API design**: Inconsistent interfaces, missing validation, breaking changes, poor error responses
261
-
262
- 4. **Categorize each finding:**
263
- - **Fixable**: Mechanical fixes (unused imports, null checks, formatting, typos, dead code removal)
264
- - **Questions**: Clarifications needed (validation logic, trade-offs, ambiguous intent)
265
- - **Manual**: Requires judgment (refactoring, architecture decisions, security implications)
144
+ 1. Get the diff based on scope:
145
+ - staged: `git diff --cached`
146
+ - unstaged: `git diff`
147
+ - all: `git diff HEAD`
148
+ - branch: `git diff {base-branch}...HEAD`
149
+ 2. Read full files for every file in the diff.
150
+ Also read 1 level of imports for context.
151
+ 3. Review for:
152
+ - Bugs: Logic errors, off-by-one, null access, race conditions, missing error handling
153
+ - Security: Injection, XSS, auth bypass, secrets exposure
154
+ - Performance: N+1 queries, unnecessary allocations, blocking operations
155
+ - Code quality: Dead code, unclear naming, duplicated logic
156
+ - API design: Inconsistent interfaces, missing validation
157
+ 4. Categorize each finding:
158
+ - **Fixable**: Mechanical fixes (unused imports, null checks, formatting, typos)
159
+ - **Questions**: Clarifications needed (validation logic, trade-offs)
160
+ - **Manual**: Requires judgment (refactoring, architecture, security)
266
161
 
267
162
  ## Output Format
268
163
  Return:
269
- ```
270
164
  Status: success | failed
271
165
  Error: {if failed}
272
-
273
- Summary:
274
- total: {N}, fixable: {N}, questions: {N}, manual: {N}
275
-
166
+ Summary: total: {N}, fixable: {N}, questions: {N}, manual: {N}
276
167
  Fixable Issues:
277
168
  - file: {path}, line: {N}, description: {what}, fix: {suggestion}
278
-
279
169
  Questions:
280
170
  - file: {path}, line: {N}, question: {what the reviewer asks}
281
-
282
171
  Manual Review:
283
172
  - file: {path}, line: {N}, description: {what}, severity: {level}
284
-
285
- Raw Output:
286
- {full review analysis}
287
- ```
173
+ Raw Output: {full review analysis}
288
174
 
289
175
  ## Rules
290
- - DO NOT apply fixes (parent handles with user consent)
176
+ - DO NOT apply fixes
291
177
  - DO NOT interact with user
292
- - Include ALL findings - let parent decide what to apply
178
+ - Include ALL findings
293
179
  - Be thorough but practical — focus on real issues, not style nitpicks
294
- - You have NO context about the feature intent — review what the code DOES, not what it was supposed to do
295
180
  ```
296
181
 
297
182
  ### Step 5: Process Agent Results
298
183
 
299
- Receive structured results from the agent:
300
- - Total issues count
301
- - Categorized findings: fixable, questions, manual
302
- - Raw review output
303
-
304
- If agent returned failure (review failed), report error and exit.
184
+ Receive structured results from the agent. If agent returned failure, report error and STOP.
305
185
 
306
- ### Step 6: Branch Based on Review Mode
186
+ **If user selected "Save to file":** Skip to Step 9.
307
187
 
308
- **If user selected "Save to file":**
309
- - Skip to Step 10 (Save Findings to File)
188
+ **If user selected "Interactive":** Continue to Step 6.
310
189
 
311
- **If user selected "Interactive":**
312
- - Continue to Step 7
190
+ ### Step 6: Present Overview and Ask User
313
191
 
314
- ### Step 7: Provide Overview and Ask User
315
-
316
- Present a concise overview of all findings:
192
+ Present ALL findings to the user first. Do NOT apply anything yet.
317
193
 
318
194
  ```
319
195
  Code Review Results:
@@ -325,332 +201,96 @@ Summary:
325
201
  - Manual Review: {N} (require judgment)
326
202
 
327
203
  Fixable Issues:
328
- - ProductFactory.ts:45 - Remove unused import
329
- - OrderValidator.ts:23 - Add null check for parameter
204
+ - {file}:{line} - {description}
330
205
 
331
206
  Questions:
332
- ? ProductFactory.ts:67 - Should validation check for empty strings?
207
+ ? {file}:{line} - {question}
333
208
 
334
209
  Manual Review Needed:
335
- - ProductFactory.ts:120 - Consider extracting method (complexity: 15)
210
+ - {file}:{line} - {description}
336
211
  ```
337
212
 
338
- **Use AskUserQuestion to ask:**
339
- - Which fixable issues should be applied? (options: All, Selected, None)
340
-
341
- ### Step 8: Apply Fixes Based on User Agreement
213
+ Ask via AskUserQuestion: "Which fixable issues should be applied?"
214
+ - Options: All / Selected / None
342
215
 
343
- Only apply fixes that the user has agreed to:
216
+ ### Step 7: Apply User-Approved Fixes
344
217
 
345
- **If user chose "All fixable issues":**
346
- - Apply all fixable issues automatically
347
- - Track applied fixes
218
+ **ONLY apply fixes the user has agreed to.**
348
219
 
349
- **If user chose "Selected":**
350
- - Ask which specific fixes to apply
351
- - Apply only selected fixes
220
+ - If "All": Apply all fixable issues
221
+ - If "Selected": Ask which specific fixes, then apply only those
222
+ - If "None": Skip to Step 8
352
223
 
353
- **If user chose "None":**
354
- - Skip to reporting
355
-
356
- **For each fix to apply:**
224
+ For each fix:
357
225
  1. Read the file
358
- 2. Apply the suggested fix using Edit tool
359
- 3. Format using IDE (if available) `reformat_file` if available
360
- 4. Track applied fixes
361
-
362
- ### Step 9: Handle Questions Based on User Preference
363
-
364
- If there are questions from the reviewer, use AskUserQuestion:
365
-
366
- **Options:**
367
- 1. "Ask me for each" - Present each question individually
368
- 2. "Skip all" - Add to manual review list
369
-
370
- **If "Ask me for each":**
371
- - For each question, use AskUserQuestion to get answer
372
- - If answer requires code change, apply it
373
- - Track as user-resolved
374
-
375
- ### Step 9b: Verify Changes
226
+ 2. Apply the fix using Edit tool
227
+ 3. Track applied fixes
376
228
 
377
- After applying fixes:
229
+ ### Step 8: Handle Questions
378
230
 
379
- 1. **Compile:**
380
- Use the `/build-project` skill to compile:
381
- ```
382
- Skill tool call:
383
- skill: "build-project"
384
- args: "target=compile"
385
- ```
231
+ If there are questions from the reviewer, ask via AskUserQuestion:
232
+ - "Ask me each question" / "Skip all questions"
386
233
 
387
- 2. **Check for problems:**
388
- Use IDE (if available) `get_file_problems` on modified files
234
+ If "Ask me each": Present each question individually via AskUserQuestion. If the answer requires a code change, apply it.
389
235
 
390
- 3. **Run tests:**
391
- Use the `/run-tests` skill to run tests:
392
- ```
393
- Skill tool call:
394
- skill: "run-tests"
395
- args: "target=all"
396
- ```
236
+ ### Step 9: Save Findings to File (File-Based Mode)
397
237
 
398
- 4. **Report results:**
399
- - If compilation fails: Revert problematic fixes, report to user
400
- - If tests fail: Report which tests failed, suggest manual review
401
- - If all pass: Confirm fixes are successful
238
+ For "Save to file" mode only.
402
239
 
403
- ### Step 9c: Generate Review Summary
240
+ Determine feature name from `.5/features/*/state.json` (most recent) or ask user.
404
241
 
405
- Create comprehensive summary report using the template structure.
242
+ Write to `.5/features/{feature-name}/review-{YYYYMMDD-HHmmss}-findings.md`.
406
243
 
407
- **Template Reference:** Use the structure from `.claude/templates/workflow/REVIEW-SUMMARY.md`
244
+ Use the template structure from `.claude/templates/workflow/REVIEW-FINDINGS.md`. Include all findings with `[FIX]`/`[SKIP]`/`[MANUAL]` action markers.
408
245
 
409
- The template contains placeholders for:
410
- - **Header:** Reviewed scope, timestamp, user decisions summary
411
- - **Summary:** Counts for total issues, applied fixes, user-resolved questions, manual review, skipped
412
- - **Applied Fixes:** List of fixes applied with user approval (file:line - description)
413
- - **User-Resolved Questions:** Questions answered by user with their decisions
414
- - **Manual Review Needed:** Issues requiring human judgment
415
- - **Skipped Issues:** Fixes user chose not to apply
416
- - **Files Modified:** Summary of modified files with fix counts
246
+ Tell user: "Findings saved. Edit the file to mark actions, then run `/5:review-code apply`"
417
247
 
418
- ### Step 10: Save Findings to File (File-Based Mode)
248
+ Skip to REVIEW COMPLETE.
419
249
 
420
- When user selects "Save to file", create a structured findings file that allows user annotation.
250
+ ### Step 10: Apply Annotated Findings (Apply Mode)
421
251
 
422
- **Determine feature name:**
423
- - Check most recent state file in `.5/features/*/state.json` to find current feature
424
- - Or ask user which feature they're reviewing
425
- - Use feature name for organizing review files
252
+ When invoked with `apply`:
426
253
 
427
- **Create directory if needed:**
428
- ```bash
429
- mkdir -p .5/features/{feature-name}
430
- ```
254
+ 1. Determine feature name from `.5/features/*/state.json` or ask user
255
+ 2. Find most recent `review-*-findings.md` in the feature folder
256
+ 3. If none found, tell user to run `/5:review-code` first and STOP
257
+ 4. Parse each finding and its action marker: `[FIX]`, `[SKIP]`, `[MANUAL]`
258
+ 5. Apply `[FIX]` findings using Edit tool
259
+ 6. Apply `[MANUAL]` findings using custom instructions from the file
260
+ 7. Skip `[SKIP]` findings
261
+ 8. Continue to Step 11
431
262
 
432
- **Generate timestamp:**
433
- ```
434
- {timestamp} = Custom timestamp format: YYYYMMDD-HHmmss
435
- Example: 20260128-103045
436
- ```
263
+ ### Step 11: Verify Changes
437
264
 
438
- **File path:**
439
- ```
440
- .5/features/{feature-name}/review-{timestamp}-findings.md
441
- ```
265
+ After applying any fixes (interactive or file-based):
442
266
 
443
- **File format:**
267
+ 1. **Build:** Use the `/build-project` skill: `Skill tool: skill="build-project", args="target=compile"`
268
+ 2. **Test:** Use the `/run-tests` skill: `Skill tool: skill="run-tests", args="target=all"`
269
+ 3. If build fails: report which fixes caused issues
270
+ 4. If tests fail: report which tests failed
444
271
 
445
- **Template Reference:** Use the structure from `.claude/templates/workflow/REVIEW-FINDINGS.md`
272
+ ### Step 12: Save Review Report
446
273
 
447
- The template contains:
448
- - **Header:** Generated timestamp, scope, total findings count
449
- - **How to Use This File:** Instructions for user annotation with [FIX], [SKIP], [MANUAL] actions
450
- - **Finding sections:** Repeated for each finding with:
451
- - File path, line number, category, severity
452
- - Description of what the reviewer found
453
- - Suggested fix
454
- - Original reviewer message
455
- - Action placeholder (default [FIX])
456
- - Custom instructions field for [MANUAL] fixes
457
- - **Summary:** Counts of total, fixable, questions, manual review
458
- - **Next Steps:** Instructions to edit and run `/review-code apply`
274
+ **Interactive mode:** Save summary to `.5/features/{feature-name}/review-{YYYYMMDD-HHmmss}.md`
459
275
 
460
- **After saving file:**
461
- - Inform user: "Findings saved to .5/features/{feature-name}/review-{timestamp}-findings.md"
462
- - Provide instructions: "Edit the file to mark findings, then run: /review-code apply"
463
- - Skip remaining steps (don't apply fixes interactively)
276
+ Use the template structure from `.claude/templates/workflow/REVIEW-SUMMARY.md`.
464
277
 
465
- ### Step 11: Apply Annotated Findings
278
+ **Apply mode:** Append application results to the findings file with: fixes applied count, custom fixes count, skipped count, build/test status.
466
279
 
467
- When user runs `/review-code apply`, read the most recent findings file and apply marked fixes.
280
+ ## REVIEW COMPLETE
468
281
 
469
- **Determine feature name:**
470
- - Check most recent state file in `.5/features/*/state.json` to find current feature
471
- - Or ask user which feature they're reviewing
282
+ After saving the report, output exactly:
472
283
 
473
- **Find the most recent findings file:**
474
- ```bash
475
- # Find most recent review findings file in the feature folder
476
- ls -t .5/features/{feature-name}/review-*-findings.md | head -1
477
284
  ```
285
+ Review complete.
478
286
 
479
- **If no findings file exists:**
480
- - Inform user: "No findings file found. Run /review-code first to generate findings."
481
- - Exit
482
-
483
- **Read the findings file:**
484
- - Parse each finding section
485
- - Extract action marker: [FIX], [SKIP], or [MANUAL]
486
- - For [MANUAL], also extract custom instructions
287
+ - Fixes applied: {N}
288
+ - Questions resolved: {N}
289
+ - Manual review needed: {N}
290
+ - Build: {passed/failed}
291
+ - Tests: {passed/failed}
487
292
 
488
- **Apply fixes:**
489
-
490
- For each finding marked `[FIX]`:
491
- 1. Read the file specified in the finding
492
- 2. Apply the suggested fix using Edit tool
493
- 3. Track applied fix
494
-
495
- For each finding marked `[MANUAL]` with custom instructions:
496
- 1. Read the file
497
- 2. Use the custom instructions to determine what to change
498
- 3. Apply the change using Edit tool
499
- 4. Track applied fix
500
-
501
- For findings marked `[SKIP]`:
502
- - Skip, don't apply
503
-
504
- **After applying all marked fixes:**
505
- - Continue to Step 9b (Verify Changes)
506
- - Then Step 12 (Update Findings File)
507
-
508
- ### Step 12: Update Findings File After Apply
509
-
510
- After applying fixes from an annotated file, update the findings file with results:
511
-
512
- **Append to the end of the findings file:**
513
-
514
- ```markdown
515
-
516
- ---
517
-
518
- ## Application Results
519
-
520
- **Applied:** {timestamp in ISO 8601 format, e.g., 2026-01-28T10:30:45Z}
521
- **Fixes Applied:** {N}
522
- **Custom Fixes:** {N}
523
- **Skipped:** {N}
524
-
525
- ### Applied Fixes
526
-
527
- - Finding #1 - {file}:{line} - {description} - ✓ Applied
528
- - Finding #5 - {file}:{line} - {description} - ✓ Applied
529
-
530
- ### Custom Fixes
531
-
532
- - Finding #3 - {file}:{line} - {description} - ✓ Applied with custom instructions
533
-
534
- ### Skipped
535
-
536
- - Finding #2 - {file}:{line} - {description} - Skipped by user
537
- - Finding #4 - {file}:{line} - {description} - Skipped by user
538
-
539
- ### Verification
540
-
541
- **Compilation:** {success|failed}
542
- **Tests:** {passed|failed|skipped}
543
-
544
- {any error messages if failed}
545
- ```
546
-
547
- **Inform user:**
548
- - Show summary of applied fixes
549
- - Reference the updated findings file
550
- - Indicate if compilation/tests passed
551
-
552
- ### Step 13: Save Review Report (Interactive Mode)
553
-
554
- For interactive mode only, save the review summary to:
555
- ```
556
- .5/features/{feature-name}/review-{timestamp}.md
557
- ```
558
-
559
- ## Error Handling
560
-
561
- ### CodeRabbit Not Installed
562
- ```
563
- CodeRabbit CLI is not installed.
564
-
565
- To install:
566
- - macOS: brew install --cask coderabbit
567
- - Other: curl -fsSL https://cli.coderabbit.ai/install.sh | sh
568
- - Then: coderabbit auth login
569
-
570
- Or switch to the built-in Claude reviewer by running /5:configure
571
- and selecting "Claude" as your review tool.
572
- ```
573
-
574
- ### CodeRabbit User Not Logged In
575
- ```
576
- You're not logged in to CodeRabbit.
577
-
578
- To log in:
579
- 1. Run: coderabbit auth login
580
- 2. Follow authentication prompts
581
- 3. Then re-run: /5:review-code
582
- ```
583
-
584
- ### Claude Review Agent Failed
585
- ```
586
- Claude code review failed.
587
-
588
- Error: {error from agent}
589
-
590
- Troubleshooting:
591
- 1. Check if git repository is valid
592
- 2. Ensure there are changes to review (run git status)
593
- 3. Try again — transient failures can occur
594
- ```
595
-
596
- ### CodeRabbit Agent Failed
597
- ```
598
- CodeRabbit review failed.
599
-
600
- Error: {error from agent}
601
-
602
- Troubleshooting:
603
- 1. Check if you have internet connection
604
- 2. Verify CodeRabbit CLI is up to date: coderabbit update
605
- 3. Check if git repository is valid
606
- 4. Try running manually: coderabbit review --plain
607
- ```
608
-
609
- ### Compilation Failed After Fixes
610
- ```
611
- Compilation failed after applying fixes.
612
-
613
- Reverting problematic fixes:
614
- - ProductFactory.ts:45 (reverted)
615
-
616
- Error:
617
- {compilation error}
618
-
619
- Action: Please review the suggested fix manually.
620
- ```
621
-
622
- ## Integration with Workflow
623
-
624
- **When to use:**
625
- - Before committing changes
626
- - After completing a feature (before PR)
627
- - When fixing bugs (to catch additional issues)
628
-
629
- **Workflow integration:**
630
- ```
631
- 1. Make code changes
632
- 2. Stage changes: git add .
633
- 3. Run `/clear` to reset context
634
- 4. Run review: /5:review-code
635
- 5. Address manual issues if needed
636
- 6. Commit: git commit -m "message"
637
- 7. For next feature: Run `/clear` before starting /5:plan-feature
293
+ Report saved at `.5/features/{feature-name}/review-{timestamp}.md`
638
294
  ```
639
295
 
640
- ## Configuration
641
-
642
- **Directory:** `.5/features/{feature-name}/` (organized by feature)
643
-
644
- **File Types:**
645
- - `review-{timestamp}-findings.md` - Annotatable findings (file-based mode)
646
- - `review-{timestamp}.md` - Review summary reports (interactive mode)
647
-
648
- **Timestamp Format:** Custom format `YYYYMMDD-HHmmss` (e.g., `20260128-103045`)
649
-
650
- **Feature Detection:** Review files are organized by feature. The command will:
651
- - Check most recent state file in `.5/features/*/state.json` to find current feature
652
- - Or ask user which feature they're reviewing if unclear
653
-
654
- ## Related Documentation
655
-
656
- - [Workflow Guide](../docs/workflow-guide.md)
296
+ STOP. You are a reviewer. Your job is done. Do not implement new features.