@ydtb/specsmd 0.1.22

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 (143) hide show
  1. package/README.md +322 -0
  2. package/bin/cli.js +21 -0
  3. package/flows/aidlc/README.md +372 -0
  4. package/flows/aidlc/agents/construction-agent.md +80 -0
  5. package/flows/aidlc/agents/inception-agent.md +97 -0
  6. package/flows/aidlc/agents/master-agent.md +61 -0
  7. package/flows/aidlc/agents/operations-agent.md +89 -0
  8. package/flows/aidlc/commands/construction-agent.md +67 -0
  9. package/flows/aidlc/commands/inception-agent.md +59 -0
  10. package/flows/aidlc/commands/master-agent.md +51 -0
  11. package/flows/aidlc/commands/operations-agent.md +81 -0
  12. package/flows/aidlc/context-config.yaml +67 -0
  13. package/flows/aidlc/memory-bank.yaml +105 -0
  14. package/flows/aidlc/quick-start.md +322 -0
  15. package/flows/aidlc/scripts/artifact-validator.cjs +594 -0
  16. package/flows/aidlc/scripts/bolt-complete.cjs +606 -0
  17. package/flows/aidlc/scripts/status-integrity.cjs +598 -0
  18. package/flows/aidlc/skills/construction/bolt-list.md +163 -0
  19. package/flows/aidlc/skills/construction/bolt-replan.md +345 -0
  20. package/flows/aidlc/skills/construction/bolt-start.md +442 -0
  21. package/flows/aidlc/skills/construction/bolt-status.md +185 -0
  22. package/flows/aidlc/skills/construction/navigator.md +196 -0
  23. package/flows/aidlc/skills/construction/prototype-apply.md +311 -0
  24. package/flows/aidlc/skills/inception/bolt-plan.md +372 -0
  25. package/flows/aidlc/skills/inception/context.md +171 -0
  26. package/flows/aidlc/skills/inception/intent-create.md +211 -0
  27. package/flows/aidlc/skills/inception/intent-list.md +124 -0
  28. package/flows/aidlc/skills/inception/navigator.md +207 -0
  29. package/flows/aidlc/skills/inception/requirements.md +227 -0
  30. package/flows/aidlc/skills/inception/review.md +248 -0
  31. package/flows/aidlc/skills/inception/story-create.md +304 -0
  32. package/flows/aidlc/skills/inception/units.md +278 -0
  33. package/flows/aidlc/skills/inception/vibe-to-spec.md +410 -0
  34. package/flows/aidlc/skills/master/analyze-context.md +239 -0
  35. package/flows/aidlc/skills/master/answer-question.md +141 -0
  36. package/flows/aidlc/skills/master/explain-flow.md +158 -0
  37. package/flows/aidlc/skills/master/project-init.md +281 -0
  38. package/flows/aidlc/skills/master/route-request.md +126 -0
  39. package/flows/aidlc/skills/operations/build.md +237 -0
  40. package/flows/aidlc/skills/operations/deploy.md +259 -0
  41. package/flows/aidlc/skills/operations/monitor.md +265 -0
  42. package/flows/aidlc/skills/operations/navigator.md +209 -0
  43. package/flows/aidlc/skills/operations/verify.md +224 -0
  44. package/flows/aidlc/templates/construction/bolt-template.md +226 -0
  45. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/adr-template.md +49 -0
  46. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-01-domain-model-template.md +55 -0
  47. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-02-technical-design-template.md +67 -0
  48. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-03-test-report-template.md +62 -0
  49. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt.md +590 -0
  50. package/flows/aidlc/templates/construction/bolt-types/simple-construction-bolt.md +347 -0
  51. package/flows/aidlc/templates/construction/bolt-types/spike-bolt.md +240 -0
  52. package/flows/aidlc/templates/construction/construction-log-template.md +129 -0
  53. package/flows/aidlc/templates/construction/standards/coding-standards.md +29 -0
  54. package/flows/aidlc/templates/construction/standards/system-architecture.md +22 -0
  55. package/flows/aidlc/templates/construction/standards/tech-stack.md +19 -0
  56. package/flows/aidlc/templates/inception/inception-log-template.md +134 -0
  57. package/flows/aidlc/templates/inception/project/README.md +55 -0
  58. package/flows/aidlc/templates/inception/requirements-template.md +144 -0
  59. package/flows/aidlc/templates/inception/stories-template.md +38 -0
  60. package/flows/aidlc/templates/inception/story-template.md +147 -0
  61. package/flows/aidlc/templates/inception/system-context-template.md +29 -0
  62. package/flows/aidlc/templates/inception/unit-brief-template.md +177 -0
  63. package/flows/aidlc/templates/inception/units-template.md +52 -0
  64. package/flows/aidlc/templates/standards/catalog.yaml +345 -0
  65. package/flows/aidlc/templates/standards/coding-standards.guide.md +553 -0
  66. package/flows/aidlc/templates/standards/data-stack.guide.md +162 -0
  67. package/flows/aidlc/templates/standards/decision-index-template.md +32 -0
  68. package/flows/aidlc/templates/standards/tech-stack.guide.md +280 -0
  69. package/flows/fire/README.md +19 -0
  70. package/flows/fire/agents/builder/agent.md +254 -0
  71. package/flows/fire/agents/builder/skills/code-review/SKILL.md +257 -0
  72. package/flows/fire/agents/builder/skills/code-review/references/auto-fix-rules.md +218 -0
  73. package/flows/fire/agents/builder/skills/code-review/references/review-categories.md +154 -0
  74. package/flows/fire/agents/builder/skills/code-review/templates/review-report.md.hbs +120 -0
  75. package/flows/fire/agents/builder/skills/commit-changes/SKILL.md +232 -0
  76. package/flows/fire/agents/builder/skills/commit-changes/scripts/commit-changes.cjs +447 -0
  77. package/flows/fire/agents/builder/skills/run-execute/SKILL.md +700 -0
  78. package/flows/fire/agents/builder/skills/run-execute/scripts/complete-run.cjs +748 -0
  79. package/flows/fire/agents/builder/skills/run-execute/scripts/init-run.cjs +457 -0
  80. package/flows/fire/agents/builder/skills/run-execute/scripts/update-phase.cjs +239 -0
  81. package/flows/fire/agents/builder/skills/run-execute/templates/plan.md.hbs +61 -0
  82. package/flows/fire/agents/builder/skills/run-execute/templates/test-report.md.hbs +81 -0
  83. package/flows/fire/agents/builder/skills/run-plan/SKILL.md +366 -0
  84. package/flows/fire/agents/builder/skills/run-status/SKILL.md +96 -0
  85. package/flows/fire/agents/builder/skills/walkthrough-generate/SKILL.md +181 -0
  86. package/flows/fire/agents/builder/skills/walkthrough-generate/templates/walkthrough.md.hbs +108 -0
  87. package/flows/fire/agents/orchestrator/agent.md +144 -0
  88. package/flows/fire/agents/orchestrator/skills/project-init/SKILL.md +226 -0
  89. package/flows/fire/agents/orchestrator/skills/project-init/templates/coding-standards.md.hbs +149 -0
  90. package/flows/fire/agents/orchestrator/skills/project-init/templates/constitution.md.hbs +43 -0
  91. package/flows/fire/agents/orchestrator/skills/project-init/templates/system-architecture.md.hbs +101 -0
  92. package/flows/fire/agents/orchestrator/skills/project-init/templates/tech-stack.md.hbs +136 -0
  93. package/flows/fire/agents/orchestrator/skills/project-init/templates/testing-standards.md.hbs +94 -0
  94. package/flows/fire/agents/orchestrator/skills/route/SKILL.md +146 -0
  95. package/flows/fire/agents/orchestrator/skills/status/SKILL.md +696 -0
  96. package/flows/fire/agents/planner/agent.md +143 -0
  97. package/flows/fire/agents/planner/skills/design-doc-generate/SKILL.md +156 -0
  98. package/flows/fire/agents/planner/skills/design-doc-generate/templates/design.md.hbs +124 -0
  99. package/flows/fire/agents/planner/skills/intent-capture/SKILL.md +125 -0
  100. package/flows/fire/agents/planner/skills/intent-capture/templates/brief.md.hbs +40 -0
  101. package/flows/fire/agents/planner/skills/work-item-decompose/SKILL.md +166 -0
  102. package/flows/fire/agents/planner/skills/work-item-decompose/templates/work-item.md.hbs +40 -0
  103. package/flows/fire/commands/fire-builder.md +56 -0
  104. package/flows/fire/commands/fire-planner.md +48 -0
  105. package/flows/fire/commands/fire.md +46 -0
  106. package/flows/fire/memory-bank.yaml +240 -0
  107. package/flows/fire/quick-start.md +146 -0
  108. package/flows/simple/README.md +190 -0
  109. package/flows/simple/agents/agent.md +404 -0
  110. package/flows/simple/commands/agent.md +60 -0
  111. package/flows/simple/context-config.yaml +34 -0
  112. package/flows/simple/memory-bank.yaml +66 -0
  113. package/flows/simple/quick-start.md +231 -0
  114. package/flows/simple/skills/design.md +96 -0
  115. package/flows/simple/skills/execute.md +190 -0
  116. package/flows/simple/skills/requirements.md +94 -0
  117. package/flows/simple/skills/tasks.md +136 -0
  118. package/flows/simple/templates/design-template.md +138 -0
  119. package/flows/simple/templates/requirements-template.md +85 -0
  120. package/flows/simple/templates/tasks-template.md +104 -0
  121. package/lib/InstallerFactory.js +36 -0
  122. package/lib/analytics/env-detector.js +92 -0
  123. package/lib/analytics/index.js +22 -0
  124. package/lib/analytics/machine-id.js +33 -0
  125. package/lib/analytics/tracker.js +232 -0
  126. package/lib/cli-utils.js +342 -0
  127. package/lib/constants.js +44 -0
  128. package/lib/installer.js +406 -0
  129. package/lib/installers/AntigravityInstaller.js +22 -0
  130. package/lib/installers/ClaudeInstaller.js +85 -0
  131. package/lib/installers/ClineInstaller.js +21 -0
  132. package/lib/installers/CodexInstaller.js +21 -0
  133. package/lib/installers/CopilotInstaller.js +113 -0
  134. package/lib/installers/CursorInstaller.js +63 -0
  135. package/lib/installers/GeminiInstaller.js +75 -0
  136. package/lib/installers/KiroInstaller.js +77 -0
  137. package/lib/installers/OpenCodeInstaller.js +30 -0
  138. package/lib/installers/RooInstaller.js +22 -0
  139. package/lib/installers/ToolInstaller.js +76 -0
  140. package/lib/installers/WindsurfInstaller.js +22 -0
  141. package/lib/markdown-validator.ts +175 -0
  142. package/lib/yaml-validator.ts +99 -0
  143. package/package.json +69 -0
@@ -0,0 +1,257 @@
1
+ ---
2
+ name: code-review
3
+ description: Review code written during a run, auto-fix no-brainer issues, and suggest improvements requiring confirmation. Invoked after tests pass.
4
+ version: 1.0.0
5
+ ---
6
+
7
+ <objective>
8
+ Review code written during a run, auto-fix no-brainer issues, and suggest improvements requiring confirmation.
9
+ </objective>
10
+
11
+ <triggers>
12
+ - Invoked by run-execute after tests pass (Step 6b)
13
+ - Receives: files_created, files_modified, run_id, intent context
14
+ </triggers>
15
+
16
+ <degrees_of_freedom>
17
+
18
+ - **AUTO-FIX**: LOW — Only mechanical, non-semantic changes
19
+ - **SUGGESTIONS**: MEDIUM — Present options, let user decide
20
+ </degrees_of_freedom>
21
+
22
+ <llm critical="true">
23
+ <mandate>REVIEW all files created/modified in current run</mandate>
24
+ <mandate>AUTO-FIX only mechanical, non-semantic issues</mandate>
25
+ <mandate>ALWAYS CONFIRM security, architecture, and behavioral changes</mandate>
26
+ <mandate>RESPECT project coding standards from .specs-fire/standards/</mandate>
27
+ <mandate>NEVER break working code — if tests passed, be conservative</mandate>
28
+ <mandate>RE-RUN tests after auto-fixes — revert if tests fail</mandate>
29
+ </llm>
30
+
31
+ <input_context>
32
+ The skill receives from run-execute:
33
+
34
+ ```yaml
35
+ files_created:
36
+ - path: src/auth/login.ts
37
+ purpose: Login endpoint handler
38
+ - path: src/auth/login.test.ts
39
+ purpose: Unit tests for login
40
+
41
+ files_modified:
42
+ - path: src/routes/index.ts
43
+ changes: Added login route
44
+
45
+ run_id: run-001
46
+ intent_id: user-auth
47
+ ```
48
+
49
+ </input_context>
50
+
51
+ <references_index>
52
+ <reference name="review-categories" path="references/review-categories.md" load_when="analyzing code"/>
53
+ <reference name="auto-fix-rules" path="references/auto-fix-rules.md" load_when="classifying findings"/>
54
+ </references_index>
55
+
56
+ <flow>
57
+ <step n="1" title="Gather Context">
58
+ <action>Receive files_created and files_modified from parent workflow</action>
59
+ <action>Load project standards:</action>
60
+ <substep>.specs-fire/standards/coding-standards.md</substep>
61
+ <substep>.specs-fire/standards/testing-standards.md</substep>
62
+
63
+ <action>Detect project tooling:</action>
64
+ <substep>Check for .eslintrc, eslint.config.js (JavaScript/TypeScript)</substep>
65
+ <substep>Check for .prettierrc (formatting)</substep>
66
+ <substep>Check for golangci.yml (Go)</substep>
67
+ <substep>Check for pyproject.toml, ruff.toml (Python)</substep>
68
+
69
+ <action>Read each file to be reviewed</action>
70
+
71
+ <output>Reviewing {file_count} files...</output>
72
+ </step>
73
+
74
+ <step n="2" title="Run Project Linters (if available)">
75
+ <check if="eslint config exists">
76
+ <action>Run: npm run lint --fix 2>&1 || npx eslint --fix {files}</action>
77
+ <action>Parse output for remaining issues</action>
78
+ </check>
79
+
80
+ <check if="golangci config exists">
81
+ <action>Run: golangci-lint run --fix {files}</action>
82
+ <action>Parse output for remaining issues</action>
83
+ </check>
84
+
85
+ <check if="ruff/pyproject config exists">
86
+ <action>Run: ruff check --fix {files}</action>
87
+ <action>Parse output for remaining issues</action>
88
+ </check>
89
+
90
+ <check if="no linter configured">
91
+ <action>Use built-in review rules from references/review-categories.md</action>
92
+ </check>
93
+ </step>
94
+
95
+ <step n="3" title="Analyze Code">
96
+ <action>For each file, check against review categories:</action>
97
+ <substep>Code Quality — unused imports, console statements, formatting</substep>
98
+ <substep>Security — hardcoded secrets, injection vulnerabilities, missing validation</substep>
99
+ <substep>Architecture — code placement, coupling, error handling</substep>
100
+ <substep>Testing — coverage gaps, edge cases, brittle patterns</substep>
101
+
102
+ <action>Classify each finding using references/auto-fix-rules.md:</action>
103
+ <substep>AUTO-FIX: Mechanical, non-semantic, reversible, tests won't break</substep>
104
+ <substep>CONFIRM: Behavioral change, security implication, judgment required</substep>
105
+
106
+ <action>Group findings by category and severity</action>
107
+ </step>
108
+
109
+ <step n="4" title="Apply Auto-Fixes">
110
+ <check if="auto-fix issues found">
111
+ <action>Apply all AUTO-FIX changes</action>
112
+ <action>Track each change made (file, line, before, after)</action>
113
+
114
+ <critical>Re-run tests to verify no breakage</critical>
115
+ <action>Run project test command</action>
116
+
117
+ <check if="tests fail after auto-fix">
118
+ <output>Auto-fix caused test failure. Reverting...</output>
119
+ <action>Revert all auto-fix changes</action>
120
+ <action>Move failed fixes to CONFIRM category</action>
121
+ </check>
122
+
123
+ <check if="tests pass">
124
+ <output>Auto-fixed {count} issues. Tests still passing.</output>
125
+ </check>
126
+ </check>
127
+ </step>
128
+
129
+ <step n="5" title="Generate Review Report">
130
+ <action>Create review report using template: templates/review-report.md.hbs</action>
131
+ <action>Write to: .specs-fire/runs/{run-id}/review-report.md</action>
132
+ <action>Include: auto-fixed issues, pending suggestions, skipped items</action>
133
+ </step>
134
+
135
+ <step n="6" title="Present Suggestions">
136
+ <check if="no suggestions requiring confirmation">
137
+ <output>
138
+ ## Code Review Complete
139
+
140
+ Auto-fixed {auto_count} issues. No additional suggestions.
141
+
142
+ Review report: .specs-fire/runs/{run-id}/review-report.md
143
+ </output>
144
+ <return>success</return>
145
+ </check>
146
+
147
+ <check if="suggestions exist">
148
+ <template_output section="suggestions">
149
+ ## Code Review Complete
150
+
151
+ **Auto-fixed ({auto_count} issues)**:
152
+ {for each auto_fixed}
153
+ - {description} ({file}:{line})
154
+ {/for}
155
+
156
+ **Suggestions requiring approval ({suggest_count} issues)**:
157
+
158
+ {for each suggestion with index}
159
+ {index}. **[{category}]** {title}
160
+ - File: {file}:{line}
161
+ - Suggestion: {description}
162
+ - Risk: {risk_level}
163
+ {/for}
164
+
165
+ ---
166
+ Apply suggestions?
167
+ [a] Apply all suggestions
168
+ {for each suggestion with index}
169
+ [{index}] Apply #{index} only ({category})
170
+ {/for}
171
+ [s] Skip all suggestions
172
+ [r] Review each individually
173
+ </template_output>
174
+
175
+ <checkpoint>Wait for user response</checkpoint>
176
+ </check>
177
+ </step>
178
+
179
+ <step n="7" title="Process User Choice">
180
+ <check if="response == a">
181
+ <action>Apply all suggestions</action>
182
+ <action>Re-run tests</action>
183
+ <action>Update review-report.md with applied status</action>
184
+ </check>
185
+
186
+ <check if="response == s">
187
+ <action>Skip all suggestions</action>
188
+ <action>Update review-report.md with skipped status</action>
189
+ </check>
190
+
191
+ <check if="response == r">
192
+ <iterate over="suggestions" as="suggestion">
193
+ <template_output section="individual_suggestion">
194
+ **[{suggestion.category}]** {suggestion.title}
195
+
196
+ File: {suggestion.file}:{suggestion.line}
197
+
198
+ Current code:
199
+ ```
200
+ {suggestion.current_code}
201
+ ```
202
+
203
+ Suggested change:
204
+ ```
205
+ {suggestion.suggested_code}
206
+ ```
207
+
208
+ Rationale: {suggestion.rationale}
209
+
210
+ Apply this change? [y/n]
211
+ </template_output>
212
+ <checkpoint>Wait for response</checkpoint>
213
+ <check if="response == y">
214
+ <action>Apply this suggestion</action>
215
+ </check>
216
+ </iterate>
217
+ <action>Re-run tests if any changes applied</action>
218
+ </check>
219
+
220
+ <check if="response is number">
221
+ <action>Apply only the numbered suggestion</action>
222
+ <action>Re-run tests</action>
223
+ <action>Update review-report.md</action>
224
+ </check>
225
+ </step>
226
+
227
+ <step n="8" title="Return to Parent">
228
+ <action>Return summary to run-execute workflow:</action>
229
+ <return_value>
230
+ {
231
+ "success": true,
232
+ "auto_fixed_count": {count},
233
+ "suggestions_applied": {count},
234
+ "suggestions_skipped": {count},
235
+ "tests_passing": true,
236
+ "report_path": ".specs-fire/runs/{run-id}/review-report.md"
237
+ }
238
+ </return_value>
239
+ </step>
240
+ </flow>
241
+
242
+ <output_artifact>
243
+ Creates `.specs-fire/runs/{run-id}/review-report.md` with:
244
+
245
+ - Summary table (auto-fixed, suggested, skipped by category)
246
+ - Detailed list of auto-fixed issues with diffs
247
+ - Applied suggestions with approval timestamps
248
+ - Skipped suggestions with reasons
249
+ </output_artifact>
250
+
251
+ <success_criteria>
252
+ <criterion>All files created/modified in run reviewed</criterion>
253
+ <criterion>Auto-fixes applied without breaking tests</criterion>
254
+ <criterion>Suggestions presented for user approval</criterion>
255
+ <criterion>review-report.md created in run folder</criterion>
256
+ <criterion>Return status to parent workflow</criterion>
257
+ </success_criteria>
@@ -0,0 +1,218 @@
1
+ # Auto-Fix Rules
2
+
3
+ This reference defines the criteria for determining whether an issue can be auto-fixed or requires user confirmation.
4
+
5
+ ---
6
+
7
+ ## Decision Framework
8
+
9
+ ```
10
+ CAN AUTO-FIX if ALL of these are true:
11
+ ├── Change is mechanical (not semantic)
12
+ ├── Change follows existing pattern in codebase
13
+ ├── Change has no functional impact
14
+ ├── Change is universally agreed best practice
15
+ ├── Reverting is trivial if wrong
16
+ └── Tests will still pass (verified after fix)
17
+
18
+ MUST CONFIRM if ANY of these are true:
19
+ ├── Change affects behavior/functionality
20
+ ├── Change requires judgment call
21
+ ├── Change involves security implications
22
+ ├── Change affects public API
23
+ ├── Multiple valid approaches exist
24
+ ├── Change is significant (>10 lines affected)
25
+ └── Change could break dependent code
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Auto-Fix Criteria by Category
31
+
32
+ ### 1. Removal Operations (SAFE)
33
+
34
+ These can be auto-fixed because removal of unused code has no functional impact:
35
+
36
+ | Operation | Criteria | Safe Because |
37
+ |-----------|----------|--------------|
38
+ | Remove unused import | Import not referenced anywhere | No runtime effect |
39
+ | Remove unused variable | Variable never read | No runtime effect |
40
+ | Remove console.log | Debug statement | No production effect |
41
+ | Remove console.debug | Debug statement | No production effect |
42
+ | Remove debugger | Debug statement | No production effect |
43
+ | Remove trailing whitespace | Whitespace only | No code effect |
44
+ | Remove empty lines (excess) | >2 consecutive blank lines | Formatting only |
45
+
46
+ ### 2. Formatting Operations (SAFE)
47
+
48
+ These can be auto-fixed because they don't change semantics:
49
+
50
+ | Operation | Criteria | Safe Because |
51
+ |-----------|----------|--------------|
52
+ | Sort imports | Reorder import statements | No runtime effect |
53
+ | Standardize quotes | Use project's quote style | String value unchanged |
54
+ | Add missing semicolons | Project uses semicolons | Parser handles both |
55
+ | Fix indentation | Match project indent style | Whitespace only |
56
+ | Add trailing newline | File doesn't end with newline | POSIX standard |
57
+
58
+ ### 3. Simple Substitutions (SAFE with verification)
59
+
60
+ These can be auto-fixed but require test verification:
61
+
62
+ | Operation | Criteria | Verify |
63
+ |-----------|----------|--------|
64
+ | `var` → `const` | Variable never reassigned | Run tests |
65
+ | `var` → `let` | Variable is reassigned | Run tests |
66
+ | `==` → `===` | Comparing same types | Run tests |
67
+ | `!=` → `!==` | Comparing same types | Run tests |
68
+
69
+ ---
70
+
71
+ ## Must-Confirm Criteria
72
+
73
+ ### 1. Behavioral Changes
74
+
75
+ Any change that could affect runtime behavior:
76
+
77
+ | Change | Why Confirm |
78
+ |--------|-------------|
79
+ | Add null check | Changes control flow |
80
+ | Add try/catch | Changes error handling |
81
+ | Add validation | May reject valid input |
82
+ | Change function signature | Affects callers |
83
+ | Add/remove async | Changes execution model |
84
+ | Modify return value | Affects callers |
85
+
86
+ ### 2. Security Changes
87
+
88
+ All security-related changes require confirmation:
89
+
90
+ | Change | Why Confirm |
91
+ |--------|-------------|
92
+ | Add input validation | May have false positives |
93
+ | Add authentication | May break intended access |
94
+ | Add authorization | May be too restrictive |
95
+ | Change crypto | May have compatibility issues |
96
+ | Add rate limiting | May affect legitimate users |
97
+
98
+ ### 3. Architectural Changes
99
+
100
+ Changes affecting code structure:
101
+
102
+ | Change | Why Confirm |
103
+ |--------|-------------|
104
+ | Extract function | Multiple valid ways |
105
+ | Move code to different file | Affects imports |
106
+ | Add abstraction layer | Judgment on necessity |
107
+ | Change dependency injection | Affects instantiation |
108
+ | Modify error propagation | Affects error handling chain |
109
+
110
+ ### 4. Size Threshold
111
+
112
+ Changes affecting many lines:
113
+
114
+ | Threshold | Action |
115
+ |-----------|--------|
116
+ | 1-5 lines | Can auto-fix if mechanical |
117
+ | 6-10 lines | Prefer confirmation |
118
+ | >10 lines | Must confirm |
119
+
120
+ ---
121
+
122
+ ## Rollback Protocol
123
+
124
+ If auto-fix causes test failure:
125
+
126
+ ```
127
+ 1. Immediately revert ALL auto-fix changes
128
+ 2. Move the fix to CONFIRM category
129
+ 3. Report: "Auto-fix for X caused test failure, moved to suggestions"
130
+ 4. Continue with remaining auto-fixes
131
+ 5. Re-run tests after each batch
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Project-Specific Overrides
137
+
138
+ The project can customize auto-fix behavior in `.specs-fire/standards/coding-standards.md`:
139
+
140
+ ```yaml
141
+ # In coding-standards.md frontmatter
142
+ auto_fix:
143
+ allow:
144
+ - unused_imports
145
+ - console_statements
146
+ - trailing_whitespace
147
+ deny:
148
+ - quote_style # Team prefers manual control
149
+ - semicolons # Mixed codebase
150
+
151
+ # Custom patterns to auto-remove
152
+ remove_patterns:
153
+ - "// TODO: remove"
154
+ - "// DEBUG"
155
+ ```
156
+
157
+ If `auto_fix` section exists, respect project preferences.
158
+ If not specified, use default rules from this document.
159
+
160
+ ---
161
+
162
+ ## Examples
163
+
164
+ ### Auto-Fix Example
165
+
166
+ **Before:**
167
+
168
+ ```javascript
169
+ import { unused } from './module'; // unused import
170
+ import { used } from './other';
171
+
172
+ function process() {
173
+ console.log('debug'); // debug statement
174
+ const result = used();
175
+ return result;
176
+ }
177
+ ```
178
+
179
+ **After (auto-fixed):**
180
+
181
+ ```javascript
182
+ import { used } from './other';
183
+
184
+ function process() {
185
+ const result = used();
186
+ return result;
187
+ }
188
+ ```
189
+
190
+ **Report:**
191
+
192
+ - Removed unused import `unused` from `./module`
193
+ - Removed console.log statement
194
+
195
+ ### Confirm Example
196
+
197
+ **Issue Detected:**
198
+
199
+ ```javascript
200
+ function getUser(id) {
201
+ return db.query(`SELECT * FROM users WHERE id = ${id}`);
202
+ }
203
+ ```
204
+
205
+ **Suggested Fix:**
206
+
207
+ ```javascript
208
+ function getUser(id) {
209
+ return db.query('SELECT * FROM users WHERE id = ?', [id]);
210
+ }
211
+ ```
212
+
213
+ **Why Confirm:**
214
+
215
+ - Security fix (SQL injection)
216
+ - Changes how query is constructed
217
+ - May have edge cases with ID format
218
+ - Requires understanding of db.query API
@@ -0,0 +1,154 @@
1
+ # Code Review Categories
2
+
3
+ This reference defines what the code-review skill checks for in each category.
4
+
5
+ ---
6
+
7
+ ## 1. Code Quality
8
+
9
+ Issues related to code cleanliness and maintainability.
10
+
11
+ ### Auto-Fixable
12
+
13
+ | Issue | Detection | Fix |
14
+ |-------|-----------|-----|
15
+ | Unused imports | Import not referenced in file | Remove import |
16
+ | Unused variables | Variable declared but never used | Remove declaration |
17
+ | Console statements | `console.log`, `console.debug`, `print()` | Remove statement |
18
+ | Commented-out code | Large blocks of commented code | Remove comments |
19
+ | Trailing whitespace | Whitespace at end of lines | Trim whitespace |
20
+ | Missing semicolons | JS/TS without semicolons (if project uses them) | Add semicolons |
21
+ | Inconsistent quotes | Mixed single/double quotes | Standardize |
22
+ | Empty blocks | Empty if/else/try/catch with no comment | Add TODO comment |
23
+ | Debugger statements | `debugger` keyword | Remove statement |
24
+
25
+ ### Requires Confirmation
26
+
27
+ | Issue | Detection | Why Confirm |
28
+ |-------|-----------|-------------|
29
+ | Long functions | Function > 50 lines | Requires judgment on how to split |
30
+ | Deep nesting | > 4 levels of nesting | Multiple valid refactoring approaches |
31
+ | Duplicate code | Similar code blocks (>10 lines) | May be intentional |
32
+ | Magic numbers | Hardcoded numbers without context | Need to understand meaning |
33
+ | Complex conditionals | Complex boolean expressions | May need domain knowledge |
34
+
35
+ ---
36
+
37
+ ## 2. Security
38
+
39
+ Issues that could lead to security vulnerabilities.
40
+
41
+ ### Auto-Fixable
42
+
43
+ | Issue | Detection | Fix |
44
+ |-------|-----------|-----|
45
+ | Hardcoded localhost | `localhost` or `127.0.0.1` in production code | Flag but usually intentional |
46
+
47
+ ### Requires Confirmation (ALWAYS)
48
+
49
+ | Issue | Detection | Risk |
50
+ |-------|-----------|------|
51
+ | Hardcoded secrets | API keys, passwords, tokens in code | Critical - secrets exposure |
52
+ | SQL injection | String concatenation in SQL queries | Critical - data breach |
53
+ | XSS vulnerabilities | Unescaped user input in HTML | High - script injection |
54
+ | Command injection | User input in shell commands | Critical - RCE |
55
+ | Path traversal | User input in file paths | High - unauthorized access |
56
+ | Missing input validation | User input used without validation | Medium - various attacks |
57
+ | Insecure crypto | Weak algorithms (MD5, SHA1 for passwords) | High - broken encryption |
58
+ | CORS misconfiguration | `Access-Control-Allow-Origin: *` | Medium - CSRF |
59
+ | Missing auth checks | Endpoints without authentication | High - unauthorized access |
60
+ | Sensitive data in logs | PII, passwords logged | Medium - data leak |
61
+
62
+ ---
63
+
64
+ ## 3. Architecture
65
+
66
+ Issues related to code organization and design.
67
+
68
+ ### Auto-Fixable
69
+
70
+ | Issue | Detection | Fix |
71
+ |-------|-----------|-----|
72
+ | Import order | Imports not grouped/sorted | Sort imports |
73
+
74
+ ### Requires Confirmation (ALWAYS)
75
+
76
+ | Issue | Detection | Why Confirm |
77
+ |-------|-----------|-------------|
78
+ | Wrong layer | Business logic in controller, DB in UI | Requires understanding architecture |
79
+ | Missing error handling | No try/catch for async/IO operations | May be intentional propagation |
80
+ | Tight coupling | Direct dependencies on concrete classes | Multiple valid solutions |
81
+ | Missing abstraction | Repeated patterns that could be extracted | Judgment on when to abstract |
82
+ | Circular dependencies | Module A imports B, B imports A | Requires refactoring design |
83
+ | God class/function | Class/function doing too many things | Domain knowledge needed |
84
+ | Inconsistent patterns | Different approaches for same problem | Need to pick canonical approach |
85
+ | Missing logging | No logging for important operations | Need to understand what matters |
86
+ | Synchronous blocking | Blocking calls in async context | May need architecture change |
87
+
88
+ ---
89
+
90
+ ## 4. Testing
91
+
92
+ Issues related to test quality and coverage.
93
+
94
+ ### Auto-Fixable
95
+
96
+ | Issue | Detection | Fix |
97
+ |-------|-----------|-----|
98
+ | Console in tests | `console.log` in test files | Remove statement |
99
+
100
+ ### Requires Confirmation (ALWAYS)
101
+
102
+ | Issue | Detection | Why Confirm |
103
+ |-------|-----------|-------------|
104
+ | Missing tests | New function without corresponding test | Need to understand what to test |
105
+ | Missing edge cases | Tests only cover happy path | Need domain knowledge |
106
+ | Brittle tests | Tests rely on implementation details | Multiple valid approaches |
107
+ | Missing assertions | Test runs but doesn't assert | May be setup test |
108
+ | Test coverage gaps | Lines not covered by tests | Need to prioritize |
109
+ | Flaky test patterns | Random data, timing dependencies | Need to understand intent |
110
+ | Missing error tests | No tests for error conditions | Need to identify error cases |
111
+ | Mock overuse | Everything mocked, no integration | Judgment on test strategy |
112
+
113
+ ---
114
+
115
+ ## Language-Specific Checks
116
+
117
+ ### JavaScript/TypeScript
118
+
119
+ | Issue | Category | Auto-Fix |
120
+ |-------|----------|----------|
121
+ | `var` instead of `let/const` | Quality | Yes |
122
+ | `==` instead of `===` | Quality | Yes (with caution) |
123
+ | Missing `await` | Quality | Confirm |
124
+ | `any` type usage | Quality | Confirm |
125
+ | Missing null checks | Security | Confirm |
126
+
127
+ ### Go
128
+
129
+ | Issue | Category | Auto-Fix |
130
+ |-------|----------|----------|
131
+ | Ignored error returns | Quality | Confirm |
132
+ | Naked returns | Quality | Confirm |
133
+ | Empty interface{} | Quality | Confirm |
134
+ | Missing context | Architecture | Confirm |
135
+
136
+ ### Python
137
+
138
+ | Issue | Category | Auto-Fix |
139
+ |-------|----------|----------|
140
+ | Bare except | Quality | Confirm |
141
+ | Mutable default args | Quality | Confirm |
142
+ | Missing type hints | Quality | Confirm |
143
+ | `import *` | Quality | Yes |
144
+
145
+ ---
146
+
147
+ ## Severity Levels
148
+
149
+ | Level | Description | Action |
150
+ |-------|-------------|--------|
151
+ | **Critical** | Security vulnerability, data loss risk | MUST address |
152
+ | **High** | Significant quality/maintainability issue | SHOULD address |
153
+ | **Medium** | Best practice violation | CONSIDER addressing |
154
+ | **Low** | Minor style/preference issue | OPTIONAL |