sdlc-framework 1.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 (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +321 -0
  3. package/bin/install.js +193 -0
  4. package/package.json +39 -0
  5. package/src/commands/close.md +200 -0
  6. package/src/commands/debug.md +124 -0
  7. package/src/commands/fast.md +149 -0
  8. package/src/commands/fix.md +104 -0
  9. package/src/commands/help.md +144 -0
  10. package/src/commands/hotfix.md +99 -0
  11. package/src/commands/impl.md +142 -0
  12. package/src/commands/init.md +93 -0
  13. package/src/commands/milestone.md +136 -0
  14. package/src/commands/pause.md +115 -0
  15. package/src/commands/research.md +136 -0
  16. package/src/commands/resume.md +103 -0
  17. package/src/commands/review.md +195 -0
  18. package/src/commands/spec.md +164 -0
  19. package/src/commands/status.md +118 -0
  20. package/src/commands/verify.md +153 -0
  21. package/src/references/clarification-strategy.md +352 -0
  22. package/src/references/engineering-laws.md +374 -0
  23. package/src/references/loop-phases.md +331 -0
  24. package/src/references/playwright-testing.md +298 -0
  25. package/src/references/prompt-detection.md +264 -0
  26. package/src/references/sub-agent-strategy.md +260 -0
  27. package/src/rules/commands.md +180 -0
  28. package/src/rules/style.md +354 -0
  29. package/src/rules/templates.md +238 -0
  30. package/src/rules/workflows.md +314 -0
  31. package/src/templates/HANDOFF.md +121 -0
  32. package/src/templates/LAWS.md +521 -0
  33. package/src/templates/PROJECT.md +112 -0
  34. package/src/templates/REVIEW.md +145 -0
  35. package/src/templates/ROADMAP.md +101 -0
  36. package/src/templates/SPEC.md +231 -0
  37. package/src/templates/STATE.md +106 -0
  38. package/src/templates/SUMMARY.md +126 -0
  39. package/src/workflows/close-phase.md +189 -0
  40. package/src/workflows/debug-flow.md +302 -0
  41. package/src/workflows/fast-forward.md +340 -0
  42. package/src/workflows/fix-findings.md +235 -0
  43. package/src/workflows/hotfix-flow.md +190 -0
  44. package/src/workflows/impl-phase.md +229 -0
  45. package/src/workflows/init-project.md +249 -0
  46. package/src/workflows/milestone-management.md +169 -0
  47. package/src/workflows/pause-work.md +153 -0
  48. package/src/workflows/research.md +219 -0
  49. package/src/workflows/resume-project.md +159 -0
  50. package/src/workflows/review-phase.md +337 -0
  51. package/src/workflows/spec-phase.md +379 -0
  52. package/src/workflows/transition-phase.md +203 -0
  53. package/src/workflows/verify-phase.md +280 -0
@@ -0,0 +1,340 @@
1
+ <purpose>The universal entry point workflow. Accept a plain language description, classify the work, estimate complexity, and either execute inline (simple work) or route to the appropriate specialized command (complex work, bugs, research, hotfixes). This is the "just tell me what to do" workflow.</purpose>
2
+ <when_to_use>Use anytime. This is the default way to start work. The user describes what they need, and this workflow figures out the rest. No prior knowledge of SDLC commands required.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, .sdlc/PROJECT.md, .sdlc/LAWS.md</required_reading>
4
+ <loop_context>
5
+ expected_phase: FAST (compressed loop or routing)
6
+ prior_phase: any (fast can be used between loops or as the first action)
7
+ next_phase: depends on routing — SPEC, DEBUG, HOTFIX, RESEARCH, or self-contained
8
+ </loop_context>
9
+ <references>
10
+ @~/.claude/sdlc-framework/references/prompt-detection.md
11
+ @~/.claude/sdlc-framework/references/engineering-laws.md
12
+ </references>
13
+ <process>
14
+
15
+ <step name="preflight" priority="first">
16
+ Read .sdlc/STATE.md.
17
+
18
+ IF .sdlc/ does not exist:
19
+ Display: "Framework not initialized. Run /sdlc:init first."
20
+ STOP.
21
+
22
+ Note the current state:
23
+ - current_phase
24
+ - current_plan
25
+ - loop_position
26
+ - next_required_action
27
+
28
+ Save this state — if we execute inline, we restore it after.
29
+
30
+ Check: Is there an active mid-loop?
31
+ - If loop_position is mid-loop (e.g., "IMPL ✓" waiting for verify):
32
+ Display: "Active loop in progress. Current state: {loop_position}. Required: {next_required_action}."
33
+ Ask: "Override and start fast work? The active loop will pause. (yes/no)"
34
+ If no: STOP.
35
+ If yes: save state for restoration, proceed.
36
+
37
+ Read .sdlc/PROJECT.md for tech stack context.
38
+ Read .sdlc/LAWS.md for engineering laws.
39
+
40
+ WHY: Fast should work from any state — it's the universal entry point. But if there's an active loop, the user should know they're interrupting it.
41
+ </step>
42
+
43
+ <step name="classify_work" priority="second">
44
+ Receive the user's description from $ARGUMENTS.
45
+
46
+ Apply PROMPT DETECTION to classify. Scan for keywords and intent:
47
+
48
+ CLASSIFICATION RULES (checked in priority order — first match wins):
49
+
50
+ 1. CRITICAL — urgent production issues
51
+ Indicators: "urgent", "production", "down", "outage", "critical", "P0", "hotfix", "emergency", "ASAP"
52
+ Route: /sdlc:hotfix
53
+ Display: "Critical issue detected. Routing to /sdlc:hotfix for emergency handling."
54
+ Write to STATE.md: fast_context = {original description}
55
+ STOP this workflow.
56
+
57
+ 2. BUG — something broken that needs debugging
58
+ Indicators: "fix bug", "broken", "crash", "error when", "fails to", "wrong output", "regression", "not working", "throws", "exception"
59
+ IMPORTANT: "fix" alone is ambiguous — "fix the button alignment" is a feature, "fix the crash on login" is a bug.
60
+ Disambiguation: Does the description mention an ERROR, FAILURE, or INCORRECT BEHAVIOR?
61
+ - Yes → BUG → Route: /sdlc:debug
62
+ - No → FEATURE (a "fix" that is really a refinement)
63
+ Display: "Bug detected. Routing to /sdlc:debug for structured debugging."
64
+ Write to STATE.md: fast_context = {original description}
65
+ STOP this workflow.
66
+
67
+ 3. RESEARCH — exploration and investigation
68
+ Indicators: "explore", "investigate", "research", "compare options", "evaluate", "what are the options", "how does X work", "should we use"
69
+ Route: /sdlc:research
70
+ Display: "Research task detected. Routing to /sdlc:research."
71
+ Write to STATE.md: fast_context = {original description}
72
+ STOP this workflow.
73
+
74
+ 4. FEATURE — new functionality
75
+ Indicators: "add", "create", "build", "implement", "new", "introduce", "enable", "support", "integrate"
76
+ Route: complexity-dependent (next step)
77
+
78
+ 5. REFACTOR — restructuring without behavior change
79
+ Indicators: "refactor", "clean up", "rename", "extract", "move", "reorganize", "simplify", "split", "merge"
80
+ Route: complexity-dependent (next step)
81
+
82
+ 6. TEST — adding or improving tests
83
+ Indicators: "test", "coverage", "spec", "assertion", "mock", "e2e", "unit test", "integration test"
84
+ Route: complexity-dependent (next step)
85
+
86
+ 7. DOCS — documentation only
87
+ Indicators: "document", "readme", "comment", "describe", "jsdoc", "annotate"
88
+ Route: complexity-dependent (next step)
89
+
90
+ 8. DEFAULT — if no clear match
91
+ Treat as FEATURE and proceed to complexity check.
92
+
93
+ Display: "Classified as: {TYPE}. {Brief explanation of why.}"
94
+
95
+ WHY: Classification determines the entire routing strategy. Bugs need root cause analysis (debug), not fast implementation. Critical issues need minimal ceremony (hotfix). Research needs subagents, not code changes. Getting the classification wrong wastes the user's time on the wrong workflow.
96
+ </step>
97
+
98
+ <step name="estimate_complexity" priority="third">
99
+ FOR TYPES: FEATURE, REFACTOR, TEST, DOCS — estimate scope.
100
+
101
+ A. CODEBASE SCAN:
102
+ Extract key terms from the description.
103
+ Search the codebase for related files:
104
+ - Grep for keywords in file content
105
+ - Glob for file names matching the description
106
+ - Check import graphs for connected modules
107
+
108
+ B. SCOPE ESTIMATION:
109
+ Count the files that would need modification.
110
+ Estimate lines of change based on task type:
111
+ - New function/method: ~20-40 lines
112
+ - New file: ~50-100 lines
113
+ - Modification to existing logic: ~10-30 lines per function
114
+ - Test file: ~30-60 lines per test suite
115
+ - Docs: ~10-50 lines
116
+
117
+ C. DEPENDENCY CHECK:
118
+ Does the task cross module boundaries?
119
+ Does it require changes to shared types/interfaces?
120
+ Does it affect database schema, API contracts, or config?
121
+ These add complexity even if file/line counts are low.
122
+
123
+ D. COMPLEXITY CLASSIFICATION:
124
+
125
+ SIMPLE (execute inline):
126
+ - ≤3 files modified
127
+ - ≤100 estimated lines
128
+ - No cross-module dependencies
129
+ - No schema/API/config changes
130
+
131
+ MEDIUM (route to /sdlc:spec):
132
+ - 4-6 files modified, OR
133
+ - 101-300 estimated lines, OR
134
+ - Cross-module dependencies
135
+
136
+ COMPLEX (route to /sdlc:spec):
137
+ - 7+ files modified, OR
138
+ - 300+ estimated lines, OR
139
+ - Schema/API/config changes, OR
140
+ - Requires parallel sub-agent execution
141
+
142
+ Display complexity assessment:
143
+ ```
144
+ Complexity: {SIMPLE|MEDIUM|COMPLEX}
145
+ Estimated: {N} files, ~{N} lines
146
+ Cross-module: {yes/no}
147
+ Schema/API changes: {yes/no}
148
+ ```
149
+
150
+ WHY: The complexity check protects quality. Simple work done inline is fast and safe. Complex work needs proper task decomposition, dependency analysis, and parallel sub-agent execution — which /sdlc:spec provides. Skipping decomposition for complex work produces spaghetti.
151
+ </step>
152
+
153
+ <step name="route_complex_work" priority="fourth">
154
+ IF COMPLEXITY IS MEDIUM OR COMPLEX:
155
+
156
+ Pre-fill context for /sdlc:spec so the user doesn't repeat themselves:
157
+ Write to .sdlc/STATE.md fast_context field:
158
+ ```yaml
159
+ fast_context:
160
+ description: "{original user description}"
161
+ classified_as: "{type}"
162
+ estimated_files: [{list of identified files}]
163
+ estimated_lines: {N}
164
+ cross_module: {yes/no}
165
+ suggested_approach: "{brief recommendation based on codebase scan}"
166
+ ```
167
+
168
+ Display:
169
+ ```
170
+ Task complexity exceeds inline threshold.
171
+
172
+ Classification: {TYPE}
173
+ Estimated scope: {N} files, ~{N} lines
174
+ Reason: {why this needs full spec — e.g., "cross-module changes require task dependency analysis"}
175
+
176
+ Your description and the identified files have been saved to STATE.md.
177
+ /sdlc:spec will pick up this context automatically — no need to repeat yourself.
178
+
179
+ NEXT ACTION REQUIRED: /sdlc:spec
180
+ Run /sdlc:spec to decompose this into parallel tasks with proper dependency ordering.
181
+ ```
182
+
183
+ STOP this workflow.
184
+
185
+ WHY: The user should not have to re-describe their work when routing. Pre-filling context makes the handoff seamless. The explanation tells the user WHY the routing happened — building trust in the framework's decisions.
186
+ </step>
187
+
188
+ <step name="inline_mini_spec" priority="fifth">
189
+ IF COMPLEXITY IS SIMPLE: execute inline.
190
+
191
+ Create a lightweight inline specification:
192
+
193
+ Task name: derive from description (kebab-case, max 5 words)
194
+ Task type: {classified type}
195
+ Files to modify: {from codebase scan}
196
+ Action: {imperative description of what to do}
197
+
198
+ Write 1-3 acceptance criteria in BDD format:
199
+ - At minimum: one AC for the expected behavior
200
+ - If type involves user interaction: one AC for the interaction flow
201
+ - If type involves error handling: one AC for the error case
202
+
203
+ Define boundaries: do not modify files outside the identified set.
204
+
205
+ Display:
206
+ ```
207
+ ── Quick Spec ──────────────────────
208
+ Task: {name}
209
+ Type: {type}
210
+ Files: {list}
211
+
212
+ AC-1: {description}
213
+ GIVEN {precondition}
214
+ WHEN {action}
215
+ THEN {outcome}
216
+
217
+ Boundaries: only {listed files}
218
+ ────────────────────────────────────
219
+ Proceed? (yes / no / adjust)
220
+ ```
221
+
222
+ Wait for user response.
223
+ - "yes" / "y" / "go" → proceed
224
+ - "no" / "n" → STOP
225
+ - Anything else → treat as adjustment instructions, update spec, re-present
226
+
227
+ WHY: Even quick work gets a spec. But it's 10 lines, not a full SPEC.md. The user confirms before code changes begin.
228
+ </step>
229
+
230
+ <step name="inline_implement" priority="sixth">
231
+ Execute the task directly (no sub-agents for inline work).
232
+
233
+ BEFORE writing code:
234
+ 1. Read every file to modify — understand current state
235
+ 2. Search for existing patterns that match what you need (DRY)
236
+ 3. Check for utilities, helpers, base classes to reuse
237
+
238
+ IMPLEMENT following engineering laws:
239
+ - Max 40 lines per function
240
+ - Max 3 parameters
241
+ - Max 3 nesting levels
242
+ - Named types for complex shapes (2+ properties)
243
+ - Search before creating
244
+ - Guard clauses over nested conditionals
245
+ - Domain-specific exceptions over generic Error
246
+
247
+ AFTER writing code:
248
+ - List all files actually modified
249
+ - Verify no syntax errors (quick build check if available)
250
+
251
+ WHY: Even inline execution follows the laws. "Fast" means less ceremony, not less quality.
252
+ </step>
253
+
254
+ <step name="inline_verify" priority="seventh">
255
+ Verify based on task type:
256
+
257
+ ALL TYPES:
258
+ - Run build if available (npm run build / bun run build)
259
+ - Run lint if available
260
+
261
+ FEATURE / TEST:
262
+ - Run relevant tests (test files for modified modules)
263
+ - Check new tests pass
264
+
265
+ REFACTOR:
266
+ - Run FULL test suite — refactors must not change behavior
267
+ - Verify no regressions
268
+
269
+ DOCS:
270
+ - Verify markdown/JSDoc parses correctly
271
+
272
+ UI-RELATED (detected from file types — .tsx, .vue, .svelte, etc.):
273
+ - Playwright MCP: browser_navigate → browser_snapshot → verify AC against snapshot
274
+
275
+ Check each AC:
276
+ - PASS: expected outcome observed
277
+ - FAIL: expected outcome not observed, describe what happened instead
278
+
279
+ IF ALL PASS: proceed to mini-review
280
+ IF ANY FAIL:
281
+ Display: "Verification failed:\n AC-{N}: FAIL — {what happened}\nFix the issue and describe what you changed, or say 'retry' to re-verify."
282
+ Wait for user response, then re-verify.
283
+
284
+ WHY: Fast work still gets verified. Small changes are where bugs hide — developers assume "it's trivial" and skip checking.
285
+ </step>
286
+
287
+ <step name="inline_review" priority="eighth">
288
+ Quick engineering laws check on changed files ONLY.
289
+
290
+ Check (abbreviated — only blockers):
291
+ - Function length > 40 lines?
292
+ - Parameter count > 3?
293
+ - Nesting depth > 3 levels?
294
+ - DRY: search codebase for duplicates of new code
295
+ - Security: hardcoded secrets, injection patterns
296
+ - Error handling: empty catch blocks, swallowed exceptions
297
+ - Tests: new behavior without new tests?
298
+
299
+ IF BLOCKERS FOUND:
300
+ Fix them inline immediately (do not route to /sdlc:fix for fast work).
301
+ Display: "Review found {N} issues. Fixing inline..."
302
+ Apply fixes. Re-check.
303
+
304
+ IF CLEAN: proceed.
305
+
306
+ WHY: Review is abbreviated but never skipped. Fast trades ceremony, not quality.
307
+ </step>
308
+
309
+ <step name="inline_close" priority="ninth">
310
+ Write fast-forward summary to .sdlc/phases/{current_phase}/FF-{timestamp}-SUMMARY.md:
311
+ ```markdown
312
+ # Fast: {task name}
313
+
314
+ - **Type**: {type}
315
+ - **Files modified**: {list}
316
+ - **ACs**: {N}/{N} passed
317
+ - **Review**: clean (or {N} warnings fixed inline)
318
+ - **Routed from**: /sdlc:fast
319
+ ```
320
+
321
+ Update .sdlc/STATE.md:
322
+ - Restore prior loop state (fast does not advance the phase)
323
+ - Add history entry: "{timestamp} | fast | {type}: {task name}. {N} files changed."
324
+
325
+ Display:
326
+ ```
327
+ ── Fast Complete ──────────────────
328
+ Task: {name}
329
+ Type: {type}
330
+ Files: {N} changed
331
+ ACs: {N}/{N} passed
332
+ Review: clean
333
+ ────────────────────────────────────
334
+ State restored. Continue with: {prior next_required_action or "/sdlc:fast for more work"}
335
+ ```
336
+
337
+ WHY: Fast is a side-quest. It records what happened (audit trail) but does not disrupt the main loop state.
338
+ </step>
339
+
340
+ </process>
@@ -0,0 +1,235 @@
1
+ <purpose>Systematically fix all blocker findings from code review. Read REVIEW.md, analyze fix dependencies, apply fixes in optimal order (parallel where possible), then re-run review to confirm compliance. Fixes must not introduce new violations.</purpose>
2
+ <when_to_use>Run after /sdlc:review reports blockers. STATE.md should show next_required_action = /sdlc:review (still in review loop) with blockers outstanding.</when_to_use>
3
+ <required_reading>.sdlc/STATE.md, the current REVIEW.md, .sdlc/LAWS.md, all files referenced in findings</required_reading>
4
+ <loop_context>
5
+ expected_phase: REVIEW (fix sub-loop)
6
+ prior_phase: REVIEW found blockers
7
+ next_phase: REVIEW (re-run) → CLOSE (if pass)
8
+ </loop_context>
9
+ <process>
10
+
11
+ <step name="load_findings" priority="first">
12
+ Read the REVIEW.md at .sdlc/phases/{current_phase}/{current_plan}-REVIEW.md.
13
+
14
+ Parse every finding into a structured list:
15
+ ```
16
+ Finding {N}:
17
+ file: {path}
18
+ line: {number}
19
+ law: {SOLID|DRY|YAGNI|CLEAN_CODE|SECURITY|TESTING|ERROR_HANDLING|NAMING}
20
+ severity: {BLOCKER|WARNING|INFO}
21
+ description: {what is wrong}
22
+ suggested_fix: {how to fix it}
23
+ ```
24
+
25
+ Count totals: {blocker_count} blockers, {warning_count} warnings, {info_count} info.
26
+
27
+ IF blocker_count == 0:
28
+ Display: "No blockers to fix. Run /sdlc:review to confirm, then /sdlc:close."
29
+ STOP.
30
+
31
+ WHY: Parsing findings into structured data enables dependency analysis and parallel execution. Without structure, fixes would be ad-hoc and error-prone.
32
+ </step>
33
+
34
+ <step name="analyze_fix_dependencies" priority="second">
35
+ Analyze relationships between findings to determine fix order.
36
+
37
+ DEPENDENCY PATTERNS:
38
+
39
+ 1. DRY RESOLUTION CASCADES:
40
+ If a DRY finding says "duplicates logic from {file-B}",
41
+ the fix (extract to shared utility) affects BOTH the flagged file AND file-B.
42
+ Other findings on the duplicated code may be auto-resolved.
43
+ → Fix DRY violations FIRST — they often reduce other finding counts.
44
+
45
+ 2. YAGNI REMOVALS:
46
+ If a YAGNI finding says "remove {function/class}",
47
+ all other findings on that code (Clean Code, Naming, Testing) are auto-resolved.
48
+ → Fix YAGNI violations SECOND — they eliminate dead code findings.
49
+
50
+ 3. SOLID REFACTORS:
51
+ If a SOLID finding says "split {class} into {class-A} and {class-B}",
52
+ other findings on that class need to know which split file they belong to.
53
+ → Fix SOLID violations BEFORE Clean Code findings on the same class.
54
+
55
+ 4. INDEPENDENT FINDINGS:
56
+ Findings on different files with no shared code → fully independent.
57
+ → Fix in parallel.
58
+
59
+ Build a fix execution plan:
60
+ ```
61
+ Phase 1 (sequential): DRY extractions that affect multiple files
62
+ Phase 2 (sequential): YAGNI removals
63
+ Phase 3 (parallel by file): SOLID refactors + Clean Code + Security + Testing + Error Handling + Naming
64
+ ```
65
+
66
+ WHY: Wrong fix order causes wasted work. Fixing a Naming violation on code that YAGNI will remove is pointless. Fix order matters: DRY → YAGNI → SOLID → everything else.
67
+ </step>
68
+
69
+ <step name="present_fix_plan" priority="third">
70
+ Display the fix plan to the user:
71
+
72
+ ```
73
+ ══════════════════════════════════════
74
+ FIX PLAN — {blocker_count} Blockers
75
+ ══════════════════════════════════════
76
+
77
+ Phase 1 — DRY Extractions ({count} findings):
78
+ • {file}: Extract {function} to shared utility (resolves {N} findings)
79
+
80
+ Phase 2 — YAGNI Removals ({count} findings):
81
+ • {file}: Remove {function/class} (auto-resolves {N} other findings)
82
+
83
+ Phase 3 — File-Level Fixes ({count} findings, parallel):
84
+ • {file-A}: {N} findings (Clean Code, Security)
85
+ • {file-B}: {N} findings (SOLID, Error Handling)
86
+ • {file-C}: {N} findings (Testing)
87
+
88
+ Warnings ({warning_count} total):
89
+ {list of warning descriptions}
90
+
91
+ ══════════════════════════════════════
92
+ ```
93
+
94
+ Ask user:
95
+ "Proceed with fixing all {blocker_count} blockers? For warnings, which would you like fixed? (all / none / list numbers)"
96
+
97
+ Wait for response.
98
+
99
+ IF user says "none" for warnings: fix only blockers.
100
+ IF user says "all" for warnings: fix blockers + all warnings.
101
+ IF user lists specific numbers: fix blockers + listed warnings.
102
+
103
+ WHY: The user should understand what will change before code is modified. Showing the plan builds trust and catches misunderstandings ("wait, don't remove that function — it's used in the other repo").
104
+ </step>
105
+
106
+ <step name="execute_phase_1_dry" priority="fourth">
107
+ For each DRY extraction:
108
+
109
+ 1. Identify the duplicated logic across files
110
+ 2. Determine the best location for the shared utility:
111
+ - Is there an existing utils/ directory? Use it.
112
+ - Is there a shared module? Use it.
113
+ - Create new utility file only if no appropriate location exists.
114
+ 3. Extract the shared logic into a named function with proper types
115
+ 4. Replace all duplicate instances with imports of the shared function
116
+ 5. Verify: run build/lint to confirm no import errors
117
+
118
+ IMPORTANT: Apply DRY fixes SEQUENTIALLY — each extraction may affect multiple files, and parallel edits to the same file cause conflicts.
119
+
120
+ After all DRY fixes:
121
+ - Re-count remaining findings (some may be auto-resolved)
122
+ - Update TaskUpdate with progress
123
+
124
+ WHY: DRY fixes have the highest cascading impact. A single extraction can resolve 2-5 findings across multiple files. Running these first maximizes the value of each fix.
125
+ </step>
126
+
127
+ <step name="execute_phase_2_yagni" priority="fifth">
128
+ For each YAGNI removal:
129
+
130
+ 1. Verify the code has zero callers (search for imports/references)
131
+ 2. If callers found: this is NOT a valid YAGNI removal — skip and flag as "disputed finding"
132
+ 3. If truly unused: remove the code
133
+ 4. Remove associated tests for removed code (tests for dead code are also dead)
134
+ 5. Remove associated imports
135
+ 6. Verify: run build/lint to confirm no broken references
136
+
137
+ After all YAGNI removals:
138
+ - Re-count remaining findings
139
+ - Update TaskUpdate with progress
140
+
141
+ WHY: Removing dead code eliminates entire categories of findings. Any Clean Code, Naming, or Testing findings on removed code disappear automatically.
142
+ </step>
143
+
144
+ <step name="execute_phase_3_parallel" priority="sixth">
145
+ Group remaining findings by file. For each file group:
146
+
147
+ IF the file group is independent (no shared dependencies with other file groups):
148
+ Spawn a sub-agent with Agent tool (run_in_background: true):
149
+ ```
150
+ Agent instruction:
151
+ Fix these review findings in {file-path}:
152
+ {list of findings with line numbers and suggested fixes}
153
+
154
+ Engineering laws to follow: {compact laws from LAWS.md}
155
+ Boundaries: Do NOT modify any file other than {file-path}.
156
+
157
+ For each finding:
158
+ 1. Read the current code at the specified line
159
+ 2. Apply the suggested fix
160
+ 3. Verify the fix does not introduce new violations
161
+ 4. If the suggested fix is unclear, apply your best judgment following engineering laws
162
+
163
+ CRITICAL: Do NOT introduce new violations. A fix that creates a new problem is worse than the original finding.
164
+ ```
165
+
166
+ IF the file group shares dependencies with another group:
167
+ Apply fixes SEQUENTIALLY to avoid conflicts.
168
+
169
+ Wait for all agents to complete.
170
+
171
+ Review agent results:
172
+ - Verify each fix was applied correctly
173
+ - Check for any agent errors or partial fixes
174
+ - If an agent failed: apply the fix manually
175
+
176
+ WHY: Parallel file-level fixes maximize speed. Each agent works on one file, no conflicts. Sequential fallback for dependent files prevents corruption.
177
+ </step>
178
+
179
+ <step name="verify_fixes" priority="seventh">
180
+ After all fixes applied:
181
+
182
+ 1. Run build: verify the project still compiles
183
+ 2. Run lint: verify no new lint errors
184
+ 3. Run tests: verify no regressions
185
+
186
+ IF build fails:
187
+ Display: "Build broken after fixes. Error: {error}. Manual intervention needed."
188
+ Show which fix likely caused the failure (based on file and error location).
189
+ STOP.
190
+
191
+ IF tests fail:
192
+ Display: "Test regression after fixes. Failed: {test}. Manual intervention needed."
193
+ Show which fix likely caused the regression.
194
+ STOP.
195
+
196
+ IF all pass: proceed to re-review.
197
+
198
+ WHY: Fixes must not break the project. The build/test check is a safety net before re-running review.
199
+ </step>
200
+
201
+ <step name="trigger_re_review" priority="eighth">
202
+ Display:
203
+ ```
204
+ Fixes applied:
205
+ - Blockers fixed: {count}
206
+ - Warnings fixed: {count}
207
+ - YAGNI removals: {count} (auto-resolved {count} other findings)
208
+ - DRY extractions: {count} (auto-resolved {count} other findings)
209
+ - Build: ✓
210
+ - Tests: ✓
211
+
212
+ Re-running /sdlc:review to confirm compliance...
213
+ ```
214
+
215
+ Trigger the review-phase workflow (re-run the full review).
216
+
217
+ IF re-review finds NEW blockers (fixes introduced new violations):
218
+ Display: "Fix introduced {N} new blockers. Review the new findings and run /sdlc:fix again."
219
+ Set next_required_action to "/sdlc:fix"
220
+
221
+ IF re-review passes (zero blockers):
222
+ Display:
223
+ ```
224
+ Review PASSED after fixes: 0 blockers.
225
+ Warnings: {count}
226
+ Info: {count}
227
+
228
+ NEXT ACTION REQUIRED: /sdlc:close
229
+ Run /sdlc:close to close this loop.
230
+ ```
231
+
232
+ WHY: Re-review confirms the fixes are correct and complete. Without re-review, a fix that introduced a new violation would slip through to close.
233
+ </step>
234
+
235
+ </process>