- AUTO-FIX: LOW — Only mechanical, non-semantic changes
- SUGGESTIONS: MEDIUM — Present options, let user decide
files_created:
- path: src/auth/login.ts
purpose: Login endpoint handler
- path: src/auth/login.test.ts
purpose: Unit tests for login
files_modified:
- path: src/routes/index.ts
changes: Added login route
run_id: run-fabriqa-2026-001
intent_id: user-auth
<action>Detect project tooling:</action>
<substep>Check for .eslintrc, eslint.config.js (JavaScript/TypeScript)</substep>
<substep>Check for .prettierrc (formatting)</substep>
<substep>Check for golangci.yml (Go)</substep>
<substep>Check for pyproject.toml, ruff.toml (Python)</substep>
<action>Read each file to be reviewed</action>
<output>Reviewing {file_count} files...</output>
<check if="golangci config exists">
<action>Run: golangci-lint run --fix {files}</action>
<action>Parse output for remaining issues</action>
</check>
<check if="ruff/pyproject config exists">
<action>Run: ruff check --fix {files}</action>
<action>Parse output for remaining issues</action>
</check>
<check if="no linter configured">
<action>Use built-in review rules from references/review-categories.md</action>
</check>
<action>Classify each finding using references/auto-fix-rules.md:</action>
<substep>AUTO-FIX: Mechanical, non-semantic, reversible, tests won't break</substep>
<substep>CONFIRM: Behavioral change, security implication, judgment required</substep>
<action>Group findings by category and severity</action>
<critical>Re-run tests to verify no breakage</critical>
<action>Run project test command</action>
<check if="tests fail after auto-fix">
<output>Auto-fix caused test failure. Reverting...</output>
<action>Revert all auto-fix changes</action>
<action>Move failed fixes to CONFIRM category</action>
</check>
<check if="tests pass">
<output>Auto-fixed {count} issues. Tests still passing.</output>
</check>
</check>
Auto-fixed {auto_count} issues. No additional suggestions.
Review report: .specs-fire/runs/{run-id}/review-report.md
</output>
<return>success</return>
</check>
<check if="suggestions exist">
<template_output section="suggestions">
## Code Review Complete
**Auto-fixed ({auto_count} issues)**:
{for each auto_fixed}
- {description} ({file}:{line})
{/for}
**Suggestions requiring approval ({suggest_count} issues)**:
{for each suggestion with index}
{index}. **[{category}]** {title}
- File: {file}:{line}
- Suggestion: {description}
- Risk: {risk_level}
{/for}
---
Apply suggestions?
[a] Apply all suggestions
{for each suggestion with index}
[{index}] Apply #{index} only ({category})
{/for}
[s] Skip all suggestions
[r] Review each individually
</template_output>
<checkpoint>Wait for user response</checkpoint>
</check>
<check if="response == s">
<action>Skip all suggestions</action>
<action>Update review-report.md with skipped status</action>
</check>
<check if="response == r">
<iterate over="suggestions" as="suggestion">
<template_output section="individual_suggestion">
**[{suggestion.category}]** {suggestion.title}
File: {suggestion.file}:{suggestion.line}
Current code:
```
{suggestion.current_code}
```
Suggested change:
```
{suggestion.suggested_code}
```
Rationale: {suggestion.rationale}
Apply this change? [y/n]
</template_output>
<checkpoint>Wait for response</checkpoint>
<check if="response == y">
<action>Apply this suggestion</action>
</check>
</iterate>
<action>Re-run tests if any changes applied</action>
</check>
<check if="response is number">
<action>Apply only the numbered suggestion</action>
<action>Re-run tests</action>
<action>Update review-report.md</action>
</check>
- Summary table (auto-fixed, suggested, skipped by category)
- Detailed list of auto-fixed issues with diffs
- Applied suggestions with approval timestamps
- Skipped suggestions with reasons
1---2name: code-review-553description: Review code written during a run, auto-fix no-brainer issues, and suggest improvements requiring confirmation. Invoked after tests pass.4---5
6<objective>
7Review code written during a run, auto-fix no-brainer issues, and suggest improvements requiring confirmation.
8</objective>
9
10<triggers>
11 - Invoked by run-execute after tests pass (Step 6b)
12 - Receives: files_created, files_modified, run_id, intent context
13</triggers>
14
15<degrees_of_freedom>
16
17- **AUTO-FIX**: LOW — Only mechanical, non-semantic changes
18- **SUGGESTIONS**: MEDIUM — Present options, let user decide
19</degrees_of_freedom>
20
21<llm critical="true">
22 <mandate>REVIEW all files created/modified in current run</mandate>
23 <mandate>AUTO-FIX only mechanical, non-semantic issues</mandate>
24 <mandate>ALWAYS CONFIRM security, architecture, and behavioral changes</mandate>
25 <mandate>RESPECT project coding standards from .specs-fire/standards/</mandate>
26 <mandate>NEVER break working code — if tests passed, be conservative</mandate>
27 <mandate>RE-RUN tests after auto-fixes — revert if tests fail</mandate>
28</llm>
29
30<input_context>
31 The skill receives from run-execute:
32
33 ```yaml
34 files_created:
35 - path: src/auth/login.ts
36 purpose: Login endpoint handler
37 - path: src/auth/login.test.ts
38 purpose: Unit tests for login
39
40 files_modified:
41 - path: src/routes/index.ts
42 changes: Added login route
43
44 run_id: run-fabriqa-2026-001
45 intent_id: user-auth
46 ```
47
48</input_context>
49
50<references_index>
51 <reference name="review-categories" path="references/review-categories.md" load_when="analyzing code"/>
52 <reference name="auto-fix-rules" path="references/auto-fix-rules.md" load_when="classifying findings"/>
53</references_index>
54
55<flow>
56 <step n="1" title="Gather Context">
57 <action>Receive files_created and files_modified from parent workflow</action>
58 <action>Load project standards:</action>
59 <substep>.specs-fire/standards/coding-standards.md</substep>
60 <substep>.specs-fire/standards/testing-standards.md</substep>
61
62 <action>Detect project tooling:</action>
63 <substep>Check for .eslintrc, eslint.config.js (JavaScript/TypeScript)</substep>
64 <substep>Check for .prettierrc (formatting)</substep>
65 <substep>Check for golangci.yml (Go)</substep>
66 <substep>Check for pyproject.toml, ruff.toml (Python)</substep>
67
68 <action>Read each file to be reviewed</action>
69
70 <output>Reviewing {file_count} files...</output>
71 </step>
72
73 <step n="2" title="Run Project Linters (if available)">
74 <check if="eslint config exists">
75 <action>Run: npm run lint --fix 2>&1 || npx eslint --fix {files}</action>
76 <action>Parse output for remaining issues</action>
77 </check>
78
79 <check if="golangci config exists">
80 <action>Run: golangci-lint run --fix {files}</action>
81 <action>Parse output for remaining issues</action>
82 </check>
83
84 <check if="ruff/pyproject config exists">
85 <action>Run: ruff check --fix {files}</action>
86 <action>Parse output for remaining issues</action>
87 </check>
88
89 <check if="no linter configured">
90 <action>Use built-in review rules from references/review-categories.md</action>
91 </check>
92 </step>
93
94 <step n="3" title="Analyze Code">
95 <action>For each file, check against review categories:</action>
96 <substep>Code Quality — unused imports, console statements, formatting</substep>
97 <substep>Security — hardcoded secrets, injection vulnerabilities, missing validation</substep>
98 <substep>Architecture — code placement, coupling, error handling</substep>
99 <substep>Testing — coverage gaps, edge cases, brittle patterns</substep>
100
101 <action>Classify each finding using references/auto-fix-rules.md:</action>
102 <substep>AUTO-FIX: Mechanical, non-semantic, reversible, tests won't break</substep>
103 <substep>CONFIRM: Behavioral change, security implication, judgment required</substep>
104
105 <action>Group findings by category and severity</action>
106 </step>
107
108 <step n="4" title="Apply Auto-Fixes">
109 <check if="auto-fix issues found">
110 <action>Apply all AUTO-FIX changes</action>
111 <action>Track each change made (file, line, before, after)</action>
112
113 <critical>Re-run tests to verify no breakage</critical>
114 <action>Run project test command</action>
115
116 <check if="tests fail after auto-fix">
117 <output>Auto-fix caused test failure. Reverting...</output>
118 <action>Revert all auto-fix changes</action>
119 <action>Move failed fixes to CONFIRM category</action>
120 </check>
121
122 <check if="tests pass">
123 <output>Auto-fixed {count} issues. Tests still passing.</output>
124 </check>
125 </check>
126 </step>
127
128 <step n="5" title="Generate Review Report">
129 <action>Create review report using template: templates/review-report.md.hbs</action>
130 <action>Write to: .specs-fire/runs/{run-id}/review-report.md</action>
131 <action>Include: auto-fixed issues, pending suggestions, skipped items</action>
132 </step>
133
134 <step n="6" title="Present Suggestions">
135 <check if="no suggestions requiring confirmation">
136 <output>
137 ## Code Review Complete
138
139 Auto-fixed {auto_count} issues. No additional suggestions.
140
141 Review report: .specs-fire/runs/{run-id}/review-report.md
142 </output>
143 <return>success</return>
144 </check>
145
146 <check if="suggestions exist">
147 <template_output section="suggestions">
148 ## Code Review Complete
149
150 **Auto-fixed ({auto_count} issues)**:
151 {for each auto_fixed}
152 - {description} ({file}:{line})
153 {/for}
154
155 **Suggestions requiring approval ({suggest_count} issues)**:
156
157 {for each suggestion with index}
158 {index}. **[{category}]** {title}
159 - File: {file}:{line}
160 - Suggestion: {description}
161 - Risk: {risk_level}
162 {/for}
163
164 ---
165 Apply suggestions?
166 [a] Apply all suggestions
167 {for each suggestion with index}
168 [{index}] Apply #{index} only ({category})
169 {/for}
170 [s] Skip all suggestions
171 [r] Review each individually
172 </template_output>
173
174 <checkpoint>Wait for user response</checkpoint>
175 </check>
176 </step>
177
178 <step n="7" title="Process User Choice">
179 <check if="response == a">
180 <action>Apply all suggestions</action>
181 <action>Re-run tests</action>
182 <action>Update review-report.md with applied status</action>
183 </check>
184
185 <check if="response == s">
186 <action>Skip all suggestions</action>
187 <action>Update review-report.md with skipped status</action>
188 </check>
189
190 <check if="response == r">
191 <iterate over="suggestions" as="suggestion">
192 <template_output section="individual_suggestion">
193 **[{suggestion.category}]** {suggestion.title}
194
195 File: {suggestion.file}:{suggestion.line}
196
197 Current code:
198 ```
199 {suggestion.current_code}
200 ```
201
202 Suggested change:
203 ```
204 {suggestion.suggested_code}
205 ```
206
207 Rationale: {suggestion.rationale}
208
209 Apply this change? [y/n]
210 </template_output>
211 <checkpoint>Wait for response</checkpoint>
212 <check if="response == y">
213 <action>Apply this suggestion</action>
214 </check>
215 </iterate>
216 <action>Re-run tests if any changes applied</action>
217 </check>
218
219 <check if="response is number">
220 <action>Apply only the numbered suggestion</action>
221 <action>Re-run tests</action>
222 <action>Update review-report.md</action>
223 </check>
224 </step>
225
226 <step n="8" title="Return to Parent">
227 <action>Return summary to run-execute workflow:</action>
228 <return_value>
229 {
230 "success": true,
231 "auto_fixed_count": {count},
232 "suggestions_applied": {count},
233 "suggestions_skipped": {count},
234 "tests_passing": true,
235 "report_path": ".specs-fire/runs/{run-id}/review-report.md"
236 }
237 </return_value>
238 </step>
239</flow>
240
241<output_artifact>
242 Creates `.specs-fire/runs/{run-id}/review-report.md` with:
243
244- Summary table (auto-fixed, suggested, skipped by category)
245- Detailed list of auto-fixed issues with diffs
246- Applied suggestions with approval timestamps
247- Skipped suggestions with reasons
248</output_artifact>
249
250<success_criteria>
251 <criterion>All files created/modified in run reviewed</criterion>
252 <criterion>Auto-fixes applied without breaking tests</criterion>
253 <criterion>Suggestions presented for user approval</criterion>
254 <criterion>review-report.md created in run folder</criterion>
255 <criterion>Return status to parent workflow</criterion>
256</success_criteria>