@onuraslan/sdd 1.0.5

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 (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +184 -0
  3. package/bin/sdd.js +9 -0
  4. package/cli/index.js +74 -0
  5. package/cli/install.js +156 -0
  6. package/cli/prompts.js +98 -0
  7. package/cli/skills.js +56 -0
  8. package/cli/targets.js +69 -0
  9. package/package.json +23 -0
  10. package/sdd/plugin.json +10 -0
  11. package/sdd/skills/chicago-tdd/SKILL.md +26 -0
  12. package/sdd/skills/deep-spec/SKILL.md +69 -0
  13. package/sdd/skills/deep-spec/spec-format.md +32 -0
  14. package/sdd/skills/feature-implementer/SKILL.md +48 -0
  15. package/sdd/skills/feature-implementer/reference/task-implementer.md +5 -0
  16. package/sdd/skills/implementer/SKILL.md +11 -0
  17. package/sdd/skills/prd-test-writer/SKILL.md +86 -0
  18. package/sdd/skills/prd-test-writer/references/user-story-test-writer-prompt.md +12 -0
  19. package/sdd/skills/prd-to-task/SKILL.md +51 -0
  20. package/sdd/skills/prd-to-task/reference/ascii-mock-format.md +67 -0
  21. package/sdd/skills/prd-to-task/reference/feature-template.md +20 -0
  22. package/sdd/skills/prd-to-task/reference/task-template.md +63 -0
  23. package/sdd/skills/spec-to-prd/SKILL.md +76 -0
  24. package/sdd/skills/spec-to-prd/references/mapping-guide.md +95 -0
  25. package/sdd/skills/spec-to-prd/references/prd-format.md +122 -0
  26. package/sdd/skills/workflow-generator/SKILL.md +60 -0
  27. package/sdd/skills/workflow-generator/reference/workflow-bug-fix-backend.md +35 -0
  28. package/sdd/skills/workflow-generator/reference/workflow-bug-fix-frontend.md +34 -0
  29. package/sdd/skills/workflow-generator/reference/workflow-enhancement-backend.md +35 -0
  30. package/sdd/skills/workflow-generator/reference/workflow-enhancement-frontend.md +34 -0
  31. package/sdd/skills/workflow-generator/reference/workflow-feature-development-backend.md +105 -0
  32. package/sdd/skills/workflow-generator/reference/workflow-feature-frontend-development.md +78 -0
  33. package/sdd-backend/plugin.json +10 -0
  34. package/sdd-backend/skills/backend-enhancement/SKILL.md +54 -0
  35. package/sdd-backend/skills/bug-fix-backend/SKILL.md +21 -0
  36. package/sdd-backend/skills/verify-with-curl/SKILL.md +8 -0
  37. package/sdd-frontend/.mcp.json +8 -0
  38. package/sdd-frontend/plugin.json +10 -0
  39. package/sdd-frontend/skills/bug-fix-frontend/SKILL.md +15 -0
  40. package/sdd-frontend/skills/feature-e2e-verifier/SKILL.md +64 -0
  41. package/sdd-frontend/skills/feature-e2e-verifier/reference/e2e-verifier.md +17 -0
  42. package/sdd-frontend/skills/frontend-enhancement/SKILL.md +44 -0
  43. package/sdd-frontend/skills/git-cleanup-playwright-artifacts/SKILL.md +7 -0
  44. package/sdd-frontend/skills/ui-heuristic-click-audit/SKILL.md +168 -0
  45. package/sdd-frontend/skills/ui-heuristic-click-audit/references/checklist.md +72 -0
  46. package/sdd-frontend/skills/using-playwright-mcp/SKILL.md +7 -0
  47. package/sdd-frontend/skills/verify-with-playwright-mcp/SKILL.md +14 -0
  48. package/sdd-utility/plugin.json +10 -0
  49. package/sdd-utility/skills/ask-first/SKILL.md +30 -0
  50. package/sdd-utility/skills/buy-before-build/SKILL.md +11 -0
  51. package/sdd-utility/skills/code-slop-review/SKILL.md +134 -0
  52. package/sdd-utility/skills/code-slop-review/references/agent-prompt.md +110 -0
  53. package/sdd-utility/skills/code-slop-review/references/aggregate-and-report.md +62 -0
  54. package/sdd-utility/skills/code-slop-review/references/architecture-slop.md +126 -0
  55. package/sdd-utility/skills/code-slop-review/references/dead-code-slop.md +107 -0
  56. package/sdd-utility/skills/code-slop-review/references/error-handling-slop.md +101 -0
  57. package/sdd-utility/skills/code-slop-review/references/final-report-template.md +55 -0
  58. package/sdd-utility/skills/code-slop-review/references/fix-mode.md +68 -0
  59. package/sdd-utility/skills/code-slop-review/references/structural-slop.md +150 -0
  60. package/sdd-utility/skills/code-slop-review/references/test-slop.md +88 -0
  61. package/sdd-utility/skills/gap-analysis/SKILL.md +7 -0
  62. package/sdd-utility/skills/glossary-builder/SKILL.md +28 -0
  63. package/sdd-utility/skills/grounded-mode/SKILL.md +13 -0
  64. package/sdd-utility/skills/handoff/SKILL.md +67 -0
  65. package/sdd-utility/skills/handoff-resume/SKILL.md +15 -0
  66. package/sdd-utility/skills/init-feature/SKILL.md +63 -0
  67. package/sdd-utility/skills/init-feature/references/explorer-prompt.md +58 -0
  68. package/sdd-utility/skills/init-feature/references/prd-format.md +122 -0
  69. package/sdd-utility/skills/init-feature/references/prd-writer-prompt.md +23 -0
  70. package/sdd-utility/skills/using-glossary/SKILL.md +11 -0
@@ -0,0 +1,110 @@
1
+ # Agent Prompt Template
2
+
3
+ ---
4
+
5
+ ## For Full Codebase Scope (Layer Agents)
6
+
7
+ ```
8
+ You are a code slop reviewer running Layer <N> — <Layer Name>.
9
+
10
+ SCOPE: <scope descriptor from Step 1>
11
+
12
+ YOUR TASK:
13
+ 1. Read the rules from: [\<layer-reference-file\>](<layer-reference-file>)
14
+ 2. Scan the code in the given scope according to those rules
15
+ 3. For each finding, assign it to the correct bucket (Critical / Important / Moderate)
16
+ using the Severity Guide at the bottom of the reference file
17
+ 4. For diff-based scopes: scan only + lines and their nearby context;
18
+ also flag removed error handling, tests, and logging from - lines
19
+ 5. For full / single-file / directory scopes: read and scan each source file
20
+ 6. Write your findings to: docs/sdd/code-slop/<output-filename>
21
+
22
+ OUTPUT FILE FORMAT — write exactly this structure to the output file:
23
+
24
+ # Layer <N> — <Layer Name> Findings
25
+
26
+ **Scope:** <scope descriptor>
27
+ **Scanned:** <N files / N changed lines>
28
+ **Layer findings:** Critical: <C>, Important: <I>, Moderate: <M>
29
+
30
+ ## Findings
31
+
32
+ Omit any bucket section that has no findings (do not write an empty ### header).
33
+
34
+ ### 🔴 Critical
35
+ - `<file>:<line>` — <description>
36
+ → Fix: <one-line fix suggestion>
37
+
38
+ ### 🟠 Important
39
+ - `<file>:<line>` — <description>
40
+ → Fix: <one-line fix suggestion>
41
+
42
+ ### 🟡 Moderate
43
+ - `<file>:<line>` — <description>
44
+ → Fix: <one-line fix suggestion>
45
+
46
+ ## Removed Code Flags *(diff scopes only — omit section if not applicable)*
47
+ - `<file>:<line>` — <what was removed and why it matters>
48
+
49
+ ## Notes
50
+ <Any freeform architectural or contextual observations. Omit section if none.>
51
+ ```
52
+
53
+ ---
54
+
55
+ ## For Non-Full-Codebase Scope (Single Explore Task)
56
+
57
+ ```
58
+ You are a code slop reviewer. Scan the given code scope for ALL types of AI-generated code slop patterns.
59
+
60
+ SCOPE: <scope descriptor — e.g., "git diff HEAD", "single file: src/auth.ts", "directory: src/services/">
61
+
62
+ ## Your Task
63
+
64
+ 1. Read all applicable layer rules from:
65
+ - [structural-slop.md](structural-slop.md)
66
+ - [test-slop.md](test-slop.md) (if test files in scope)
67
+ - [error-handling-slop.md](error-handling-slop.md)
68
+ - [dead-code-slop.md](dead-code-slop.md)
69
+ - [architecture-slop.md](architecture-slop.md)
70
+
71
+ 2. Scan the code in the given scope for all patterns above
72
+
73
+ 3. For diff-based scopes: scan only `+` lines and their nearby context;
74
+ also flag removed error handling, tests, and logging from `-` lines
75
+
76
+ 4. For each finding, assign to correct bucket (Critical / Important / Moderate)
77
+ using the Severity Guide from each layer reference
78
+
79
+ 5. Write findings to: `docs/sdd/code-slop/diff-review.md`
80
+
81
+ ## Output Format
82
+
83
+ ```markdown
84
+ # Code Slop Review — <scope type>
85
+
86
+ **Scope:** <scope descriptor>
87
+ **Scanned:** <N files / N changed lines>
88
+ **Total findings:** Critical: <C>, Important: <I>, Moderate: <M>
89
+
90
+ ## Findings by Bucket
91
+
92
+ ### 🔴 Critical
93
+ - `<file>:<line>` — <description>
94
+ → Fix: <one-line fix suggestion>
95
+
96
+ ### 🟠 Important
97
+ - `<file>:<line>` — <description>
98
+ → Fix: <one-line fix suggestion>
99
+
100
+ ### 🟡 Moderate
101
+ - `<file>:<line>` — <description>
102
+ → Fix: <one-line fix suggestion>
103
+
104
+ ## Removed Code Flags *(diff scopes only)*
105
+ - `<file>:<line>` — <what was removed and why it matters>
106
+
107
+ ## Notes
108
+ <Any architectural or contextual observations>
109
+ ```
110
+ ```
@@ -0,0 +1,62 @@
1
+ # Aggregate and Report
2
+
3
+ Runs after all explore agents have written their layer output files.
4
+ Reads `docs/sdd/code-slop/layer-*.md`, counts findings by bucket, and produces
5
+ the final report.
6
+
7
+ ---
8
+
9
+ ## 1 — Collect and Deduplicate
10
+
11
+ List all files in `docs/sdd/code-slop/` and read every file matching
12
+ `layer-*.md`. Skipped layers will not have an output file — skip missing files silently.
13
+
14
+ If the same `file:line` appears in multiple layer outputs, count it once
15
+ using the highest bucket priority (🔴 Critical > 🟠 Important > 🟡 Moderate).
16
+ Mark the lower-priority duplicates in the summary as "covered by Layer N — not scored."
17
+
18
+ ---
19
+
20
+ ## 2 — Count
21
+
22
+ Each layer file contains bucket labels per finding (Critical / Important / Moderate),
23
+ assigned by the layer reference file. Count findings per bucket after deduplication:
24
+
25
+ ```
26
+ Critical count → C
27
+ Important count → I
28
+ Moderate count → M
29
+ ```
30
+
31
+ Determine overall slop level by context:
32
+ - Zero Critical, minimal Important → 🟢 Clean
33
+ - Zero Critical, notable Important → 🟡 Mild Slop
34
+ - Some Critical findings → 🟠 Heavy Slop
35
+ - Many Critical findings → 🔴 Full Slop
36
+
37
+ > **Note:** These levels are scope-agnostic. A single-file review with Critical
38
+ > findings is proportionally more severe than a full-codebase review with the same.
39
+ > Note the scope in the report header so the reader can calibrate.
40
+
41
+ ---
42
+
43
+ ## 3 — Write Final Report
44
+
45
+ → Read [final-report-template.md](final-report-template.md) for the report structure.
46
+
47
+ Fill every placeholder from the aggregated layer data and write the result
48
+ to `docs/sdd/code-slop/report.md`.
49
+
50
+ ---
51
+
52
+ ## 4 — Present to User
53
+
54
+ Display the contents of `docs/sdd/code-slop/report.md` to the user.
55
+
56
+ **Report size cap when displaying:**
57
+ - 🔴 Critical: always show all
58
+ - 🟠 Important: show a representative subset; group remainder as "…and N more"
59
+ - 🟡 Moderate: show a representative subset; group remainder as "…and N more"
60
+
61
+ End with — unless the user already triggered Fix Mode:
62
+ > "Full layer reports saved to `docs/sdd/code-slop/`. Should I apply the refactors?"
@@ -0,0 +1,126 @@
1
+ # Layer 4 — Architecture Slop Reference
2
+
3
+ AI generates code by pattern-matching against training data. Over months this
4
+ produces a codebase where every module is internally consistent but
5
+ architecturally foreign to the others.
6
+
7
+ ---
8
+
9
+ ## Step 0 — Detect the Project's Architecture First
10
+
11
+ Before applying any rule, identify which architecture the project uses.
12
+
13
+ **Look for these signals:**
14
+ - Layered / DDD → directories named domain/, service/, repository/, infrastructure/
15
+ - MVC → directories named models/, views/, controllers/
16
+ - Hexagonal → directories named ports/, adapters/, core/
17
+ - Modular monolith → directories named modules/, features/, domains/
18
+ - Serverless → handler functions in root or functions/
19
+ - Minimal API → single file or flat structure, no layer separation
20
+
21
+ **Apply layer boundary rules (Patterns 1 and 4) only for Layered, DDD, or Hexagonal architectures.**
22
+
23
+ ---
24
+
25
+ ## Pattern 1 — Layer Boundary Violation
26
+
27
+ Each architectural layer has a responsibility.
28
+
29
+ **What to flag:**
30
+ - DB query inside a controller
31
+ - Business logic inside a repository
32
+ - Domain model importing from infrastructure
33
+
34
+ ---
35
+
36
+ ## Pattern 2 — Magic Values
37
+
38
+ Hard-coded literals with no named constant.
39
+
40
+ **What to flag:**
41
+ - Unexplained numbers
42
+ - Status strings
43
+ - Service URLs that vary by environment
44
+
45
+ **Do NOT flag:**
46
+ - Public third-party API endpoints
47
+ - Stable application constants
48
+
49
+ ---
50
+
51
+ ## Pattern 3 — Pattern Inconsistency
52
+
53
+ Multiple distinct patterns for the same cross-cutting concern.
54
+
55
+ **What to flag:**
56
+ - Multiple patterns for DB access
57
+ - Multiple error response formats
58
+ - Multiple logging styles
59
+ - Multiple validation approaches
60
+
61
+ ---
62
+
63
+ ## Pattern 4 — Dependency Direction Violation
64
+
65
+ Outer layers depend on inner layers — never the reverse.
66
+
67
+ **What to flag:**
68
+ - Domain importing from infrastructure
69
+ - Inner layer depending on outer layer concrete implementations
70
+
71
+ ---
72
+
73
+ ## Pattern 5 — Configuration Slop
74
+
75
+ Values that vary between environments hardcoded in source.
76
+
77
+ **What to flag:**
78
+ - Database URLs
79
+ - Internal service URLs
80
+ - API keys
81
+ - DEBUG flags
82
+ - ALLOWED_HOSTS
83
+
84
+ **Do NOT flag:**
85
+ - Stable application constants
86
+
87
+ ---
88
+
89
+ ## Pattern 6 — Async/Sync Mismatch
90
+
91
+ **What to flag:**
92
+ - Blocking call inside an async function
93
+ - Unnecessary async function with no await statements
94
+
95
+ ---
96
+
97
+ ## Detection Checklist
98
+
99
+ ```
100
+ □ Is there DB access / HTTP calls inside a controller or route handler?
101
+ □ Is there business logic inside a repository?
102
+ □ Does a domain model import from infrastructure?
103
+ □ Are there multiple patterns for the same cross-cutting concern?
104
+ □ Are there multiple error response formats?
105
+ □ Are there hardcoded credentials, URLs, or environment-specific values?
106
+ □ Are there blocking calls inside async functions?
107
+ □ Are there unnecessary async functions with no await statements?
108
+ □ Are there magic numbers or strings without named constants?
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Severity Guide
114
+
115
+ | Finding | Bucket |
116
+ |-----------------------------------------------|--------------|
117
+ | Magic number or string (per occurrence) | 🟡 Moderate |
118
+ | DB access in controller | 🔴 Critical |
119
+ | Business logic in repository | 🔴 Critical |
120
+ | Domain importing infrastructure | 🔴 Critical |
121
+ | Multiple patterns for same concern | 🟠 Important |
122
+ | Multiple error response formats | 🟡 Moderate |
123
+ | Hardcoded credential / secret / API key | 🔴 Critical |
124
+ | Hardcoded env-specific value (non-credential) | 🟡 Moderate |
125
+ | Blocking call inside async function | 🔴 Critical |
126
+ | Unnecessary async function | 🟡 Moderate |
@@ -0,0 +1,107 @@
1
+ # Layer 5 — Dead Code Slop Reference
2
+
3
+ AI generates code in bulk. It doesn't prune. Dead code accumulates silently.
4
+
5
+ ---
6
+
7
+ ## Pattern 1 — Unused Imports
8
+
9
+ Imports that are never referenced in the file.
10
+
11
+ **What to flag:**
12
+ - Any import statement where the imported name is never used
13
+
14
+ ---
15
+
16
+ ## Pattern 2 — Unreachable Code
17
+
18
+ Code that can never execute.
19
+
20
+ **What to flag:**
21
+ - Statements after an unconditional return/exit/break/continue
22
+ - Branches that can never be true given the surrounding logic
23
+ - Exception handlers for exceptions that the try block cannot raise
24
+
25
+ ---
26
+
27
+ ## Pattern 3 — Unused Variables and Parameters
28
+
29
+ Variables assigned but never read. Parameters declared but never used.
30
+
31
+ **What to flag:**
32
+ - Variable assigned at the top of a function and never referenced
33
+ - Parameter in a function signature that the body ignores entirely
34
+ - Loop variable assigned but only the loop side-effect matters
35
+
36
+ **Do NOT flag:**
37
+ - Variables prefixed with underscore (intentionally unused)
38
+ - Parameters required by an interface or callback contract
39
+ - Unused parameters in test fixtures or framework callbacks
40
+
41
+ ---
42
+
43
+ ## Pattern 4 — Dead Feature Flags and Stale Config
44
+
45
+ Hard-coded boolean flags that always evaluate to the same value.
46
+
47
+ **What to flag:**
48
+ - if True: / if False: blocks
49
+ - ENABLE_*, USE_*, FLAG_* constants that are never toggled
50
+ - Config values that are overridden immediately
51
+ - Feature toggles from completed migrations
52
+
53
+ ---
54
+
55
+ ## Pattern 5 — Debug Artifacts
56
+
57
+ Logging, printing, or assertions left from development.
58
+
59
+ **What to flag:**
60
+ - print() / console.log() / System.out statements
61
+ - debugger; / pdb.set_trace() / breakpoint() calls
62
+ - panic() calls used for debugging
63
+ - DEBUG / TEMP / REMOVE / HACK comments
64
+
65
+ **Do NOT flag:**
66
+ - Structured logging through the project's logger
67
+
68
+ ---
69
+
70
+ ## Pattern 6 — Commented-Out Code
71
+
72
+ Blocks of code that have been commented out instead of deleted.
73
+
74
+ **What to flag:**
75
+ - Multi-line comment blocks that contain code
76
+
77
+ **Do NOT flag:**
78
+ - Single-line comments that explain why something is NOT done
79
+ - Commented-out code with an explicit explanation of why it is kept
80
+
81
+ ---
82
+
83
+ ## Detection Checklist
84
+
85
+ ```
86
+ □ Any imports that are never used in the file?
87
+ □ Any code after an unconditional return/exit/break?
88
+ □ Any variables assigned but never read?
89
+ □ Any parameters declared but never used (without _ prefix)?
90
+ □ Any boolean constants that are always true or always false?
91
+ □ Any print/console.log/debugger statements?
92
+ □ Any DEBUG / TEMP / REMOVE comments?
93
+ □ Any large commented-out code blocks?
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Severity Guide
99
+
100
+ | Finding | Bucket |
101
+ |---------------------------------------------|--------------|
102
+ | Unused import | 🟡 Moderate |
103
+ | Unreachable code after unconditional exit | 🟠 Important |
104
+ | Unused variable or parameter | 🟡 Moderate |
105
+ | Dead feature flag (always true/false) | 🟠 Important |
106
+ | Debug artifact (print, console.log, etc.) | 🟠 Important |
107
+ | Commented-out code block | 🟡 Moderate |
@@ -0,0 +1,101 @@
1
+ # Layer 3 — Error Handling Slop Reference
2
+
3
+ AI adds error handling blocks to make code "look safe" — but silently swallows
4
+ errors, returns null/None to callers who don't expect it, and makes production
5
+ debugging nearly impossible.
6
+
7
+ ---
8
+
9
+ ## Pattern 1 — Silent Swallow
10
+
11
+ Catching an exception and doing nothing.
12
+
13
+ **What to flag:**
14
+ - except Exception: pass
15
+ - except: pass
16
+ - Empty catch blocks
17
+ - Ignoring error results (Go: `_ = someCall()`, Rust: `let _ = some_call()`)
18
+
19
+ ---
20
+
21
+ ## Pattern 2 — Null Return on Failure
22
+
23
+ Catching an exception and returning None/null/nil without documented contract.
24
+
25
+ **What to flag:**
26
+ - Return None/null/nil on exception without documented contract
27
+
28
+ **Do NOT flag:**
29
+ - Returning default on "not found" errors when the value is genuinely optional
30
+ - Caller's contract explicitly treats absence as "use defaults"
31
+
32
+ ---
33
+
34
+ ## Pattern 3 — Catch-All Exception
35
+
36
+ Catching the broadest possible exception instead of the specific exception the
37
+ code can actually handle.
38
+
39
+ **What to flag:**
40
+ - except Exception as e
41
+ - catch (e) without specificity
42
+ - catch (Exception e)
43
+
44
+ ---
45
+
46
+ ## Pattern 4 — Missing Context in Logs
47
+
48
+ Error logs without identity, operation, or input context.
49
+
50
+ **What to flag:**
51
+ - logger.error("Error: %s", e) without context variables
52
+ - console.error("Error:", e) without identity information
53
+ - Log statements that only print the exception message
54
+
55
+ ---
56
+
57
+ ## Pattern 5 — Resource Leak
58
+
59
+ File, connection, or socket opened without structured cleanup.
60
+
61
+ **What to flag:**
62
+ - Files opened without context manager or try/finally
63
+ - Database connections without cleanup
64
+ - Sockets/HTTP clients without proper close
65
+
66
+ ---
67
+
68
+ ## Pattern 6 — Inconsistent Error Contract
69
+
70
+ Different functions in the same module handle errors differently.
71
+
72
+ **What to flag:**
73
+ - Some functions raise on failure, others return null/None
74
+ - Some functions return error objects, others raise
75
+ - The same error condition handled differently in different functions
76
+
77
+ ---
78
+
79
+ ## Detection Checklist
80
+
81
+ ```
82
+ □ Any bare catch/except without re-raise or logging?
83
+ □ Any catch block ending with return None/null/nil?
84
+ □ Any log statement without identity/context variables?
85
+ □ Any file/connection/socket opened without structured cleanup?
86
+ □ Any catch block catching broader than necessary?
87
+ □ Does the module mix raise/throw and return null for the same class of failure?
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Severity Guide
93
+
94
+ | Finding | Bucket |
95
+ |-------------------------------------------|--------------|
96
+ | Bare pass/empty in except block | 🔴 Critical |
97
+ | Return null on exception (no contract) | 🟠 Important |
98
+ | Bare catch-all exception | 🔴 Critical |
99
+ | Log without context (no ids/values) | 🟡 Moderate |
100
+ | Resource leak (no structured cleanup) | 🟠 Important |
101
+ | Inconsistent error contract within module | 🟠 Important |
@@ -0,0 +1,55 @@
1
+ # Final Report Template
2
+
3
+ Write this structure to `docs/sdd/code-slop/report.md`.
4
+ Fill every `<placeholder>` from the aggregated layer data.
5
+
6
+ ---
7
+
8
+ ```markdown
9
+ # Code Slop Review Report
10
+
11
+ **Date:** <ISO date>
12
+ **Scope:** <scope descriptor>
13
+ **Files reviewed:** <N>
14
+ **Slop level:** <emoji + label>
15
+ **Findings:** Critical: <C>, Important: <I>, Moderate: <M>
16
+
17
+ ---
18
+
19
+ ## 🔴 Critical (fix before merge)
20
+ - `<file>:<line>` — <description> [Layer <N>]
21
+ → Fix: <one-line fix suggestion>
22
+
23
+ ## 🟠 Important
24
+ - `<file>:<line>` — <description> [Layer <N>]
25
+ → Fix: <one-line fix suggestion>
26
+ <!-- Show a representative subset. If more: "…and N more — see layer report." -->
27
+
28
+ ## 🟡 Moderate
29
+ - `<file>:<line>` — <description> [Layer <N>]
30
+ → Fix: <one-line fix suggestion>
31
+ <!-- Show a representative subset. If more: "…and N more — see layer report." -->
32
+
33
+ ## 💡 Architecture Notes
34
+ <!-- Aggregated from docs/sdd/code-slop/layer-4-architecture.md Notes section.
35
+ Omit this section if Layer 4 did not run. -->
36
+
37
+ ## 📊 Summary by Layer
38
+
39
+ | Layer | 🔴 Critical | 🟠 Important | 🟡 Moderate |
40
+ |-------|-------------|--------------|-------------|
41
+ | 1 — Structural | <N> | <N> | <N> |
42
+ | 2 — Tests | <N> | <N> | <N> |
43
+ | 3 — Error Handling | <N> | <N> | <N> |
44
+ | 4 — Architecture | <N> | <N> | <N> |
45
+ | 5 — Dead Code | <N> | <N> | <N> |
46
+ | **Total (after dedup)** | **<C>** | **<I>** | **<M>** |
47
+
48
+ ## Layer Reports
49
+ <!-- Omit links for layers that were skipped (no output file exists) -->
50
+ - [Layer 1 — Structural](layer-1-structural.md)
51
+ - [Layer 2 — Tests](layer-2-tests.md)
52
+ - [Layer 3 — Error Handling](layer-3-error-handling.md)
53
+ - [Layer 4 — Architecture](layer-4-architecture.md)
54
+ - [Layer 5 — Dead Code](layer-5-dead-code.md)
55
+ ```
@@ -0,0 +1,68 @@
1
+ # Fix Mode
2
+
3
+ Apply when the user says "fix", "refactor", or "apply".
4
+
5
+ ---
6
+
7
+ ## Pre-Fix: Behavior Lock
8
+
9
+ Before applying any change, identify what behavior must stay the same:
10
+
11
+ 1. Run existing tests — confirm they pass before touching any code
12
+ 2. If a finding affects a function with no tests, note it explicitly:
13
+ > "No test coverage for `<function>` — behavior lock not possible. Apply with caution."
14
+ 3. For Critical and Important findings that change control flow or error
15
+ handling, confirm the user is aware: "This change may affect observable
16
+ behavior. Confirm?"
17
+
18
+ Do not skip the behavior lock step. If tests cannot be run, record the
19
+ verification plan explicitly before proceeding.
20
+
21
+ ---
22
+
23
+ ## Process
24
+
25
+ 1. Read `docs/sdd/code-slop/report.md` to get the full findings list.
26
+ If the report shows "…and N more — see layer report", also read the relevant
27
+ `docs/sdd/code-slop/layer-N-<name>.md` files to get the complete findings.
28
+
29
+ 2. **Lock behavior before editing:**
30
+ Before applying any fix, confirm that the current behavior is covered by
31
+ tests. If tests are missing for the code about to be changed, write the
32
+ narrowest regression test first. If writing tests is not possible, state
33
+ explicitly what verification will be run after each fix.
34
+
35
+ 3. For each finding, the format is:
36
+ ```
37
+ # Before
38
+ <original code>
39
+
40
+ # After
41
+ <corrected code>
42
+ ```
43
+
44
+ 3. Work through Critical findings first — show each one as a before/after block
45
+ and wait for confirmation before applying.
46
+
47
+ 4. After all Critical findings are processed, work through Important findings
48
+ the same way.
49
+
50
+ 5. After all Important findings are processed, ask:
51
+ "There are N Moderate findings — apply those too?"
52
+ Apply Moderate findings only with explicit user confirmation.
53
+
54
+ 6. Before any structural change (splitting a function, moving a file,
55
+ renaming a module) — pause and ask for explicit confirmation even if
56
+ the user has already confirmed the finding.
57
+
58
+ 7. After each applied change: `⚠️ Run tests before continuing.`
59
+
60
+ ---
61
+
62
+ ## Constraints
63
+
64
+ - Do not change behavior — refactors must be semantically equivalent
65
+ - Do not apply Moderate findings automatically — ask first
66
+ - Apply one finding at a time, not all at once
67
+ - If a finding spans multiple files, show all affected files before applying
68
+ - If the user says "skip" on any finding, move to the next without applying