@lvlup-sw/exarchos 2.0.1

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 (153) hide show
  1. package/.claude-plugin/marketplace.json +22 -0
  2. package/.claude-plugin/plugin.json +17 -0
  3. package/.mcp.json +17 -0
  4. package/AGENTS.md +59 -0
  5. package/CLAUDE.md.template +62 -0
  6. package/LICENSE +202 -0
  7. package/README.md +258 -0
  8. package/commands/autocompact.md +37 -0
  9. package/commands/checkpoint.md +85 -0
  10. package/commands/cleanup.md +99 -0
  11. package/commands/debug.md +145 -0
  12. package/commands/delegate.md +56 -0
  13. package/commands/ideate.md +82 -0
  14. package/commands/plan.md +150 -0
  15. package/commands/refactor.md +139 -0
  16. package/commands/reload.md +37 -0
  17. package/commands/resume.md +130 -0
  18. package/commands/review.md +51 -0
  19. package/commands/sync-schemas.md +74 -0
  20. package/commands/synthesize.md +122 -0
  21. package/commands/tdd.md +58 -0
  22. package/dist/exarchos-cli.js +8828 -0
  23. package/dist/exarchos-mcp.js +50 -0
  24. package/hooks/hooks.json +53 -0
  25. package/package.json +59 -0
  26. package/rules/coding-standards.md +46 -0
  27. package/rules/mcp-tool-guidance.md +26 -0
  28. package/rules/pr-descriptions.md +12 -0
  29. package/rules/rm-safety.md +9 -0
  30. package/rules/skill-path-resolution.md +10 -0
  31. package/rules/tdd.md +41 -0
  32. package/rules/telemetry-awareness.md +9 -0
  33. package/scripts/assess-refactor-scope.sh +239 -0
  34. package/scripts/check-benchmark-regression.sh +229 -0
  35. package/scripts/check-coderabbit.sh +288 -0
  36. package/scripts/check-coverage-thresholds.sh +194 -0
  37. package/scripts/check-polish-scope.sh +245 -0
  38. package/scripts/check-property-tests.sh +167 -0
  39. package/scripts/check-tdd-compliance.sh +265 -0
  40. package/scripts/coderabbit-review-gate.sh +518 -0
  41. package/scripts/debug-review-gate.sh +201 -0
  42. package/scripts/extract-fix-tasks.sh +179 -0
  43. package/scripts/extract-task.sh +67 -0
  44. package/scripts/generate-traceability.sh +209 -0
  45. package/scripts/investigation-timer.sh +171 -0
  46. package/scripts/needs-schema-sync.sh +174 -0
  47. package/scripts/new-project.sh +103 -0
  48. package/scripts/post-delegation-check.sh +317 -0
  49. package/scripts/pre-synthesis-check.sh +440 -0
  50. package/scripts/reconcile-state.sh +346 -0
  51. package/scripts/reconstruct-stack.sh +432 -0
  52. package/scripts/review-diff.sh +63 -0
  53. package/scripts/review-verdict.sh +169 -0
  54. package/scripts/security-scan.sh +248 -0
  55. package/scripts/select-debug-track.sh +186 -0
  56. package/scripts/setup-worktree.sh +323 -0
  57. package/scripts/spec-coverage-check.sh +230 -0
  58. package/scripts/static-analysis-gate.sh +236 -0
  59. package/scripts/sync-labels.sh +122 -0
  60. package/scripts/validate-companion.sh +161 -0
  61. package/scripts/validate-dotnet-standards.sh +267 -0
  62. package/scripts/validate-installation.sh +101 -0
  63. package/scripts/validate-plugin.sh +223 -0
  64. package/scripts/validate-refactor.sh +234 -0
  65. package/scripts/validate-rm.sh +93 -0
  66. package/scripts/verify-delegation-saga.sh +240 -0
  67. package/scripts/verify-doc-links.sh +211 -0
  68. package/scripts/verify-ideate-artifacts.sh +296 -0
  69. package/scripts/verify-plan-coverage.sh +228 -0
  70. package/scripts/verify-review-triage.sh +219 -0
  71. package/scripts/verify-worktree-baseline.sh +159 -0
  72. package/scripts/verify-worktree.sh +84 -0
  73. package/settings.json +47 -0
  74. package/skills/brainstorming/SKILL.md +127 -0
  75. package/skills/brainstorming/references/design-template.md +65 -0
  76. package/skills/cleanup/SKILL.md +147 -0
  77. package/skills/cleanup/references/merge-verification.md +40 -0
  78. package/skills/debug/SKILL.md +204 -0
  79. package/skills/debug/references/hotfix-track.md +134 -0
  80. package/skills/debug/references/investigation-checklist.md +217 -0
  81. package/skills/debug/references/rca-template.md +150 -0
  82. package/skills/debug/references/state-schema.md +294 -0
  83. package/skills/debug/references/thorough-track.md +194 -0
  84. package/skills/debug/references/triage-questions.md +155 -0
  85. package/skills/debug/references/troubleshooting.md +47 -0
  86. package/skills/delegation/SKILL.md +150 -0
  87. package/skills/delegation/references/adaptive-orchestration.md +31 -0
  88. package/skills/delegation/references/agent-teams-saga.md +248 -0
  89. package/skills/delegation/references/fix-mode.md +74 -0
  90. package/skills/delegation/references/fixer-prompt.md +162 -0
  91. package/skills/delegation/references/implementer-prompt.md +322 -0
  92. package/skills/delegation/references/parallel-strategy.md +124 -0
  93. package/skills/delegation/references/pbt-patterns.md +172 -0
  94. package/skills/delegation/references/pr-fixes-mode.md +154 -0
  95. package/skills/delegation/references/state-management.md +51 -0
  96. package/skills/delegation/references/testing-patterns.md +129 -0
  97. package/skills/delegation/references/troubleshooting.md +33 -0
  98. package/skills/delegation/references/workflow-steps.md +127 -0
  99. package/skills/delegation/references/worktree-enforcement.md +64 -0
  100. package/skills/dotnet-standards/SKILL.md +269 -0
  101. package/skills/dotnet-standards/references/csharp-standards.md +120 -0
  102. package/skills/dotnet-standards/templates/.editorconfig +366 -0
  103. package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
  104. package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
  105. package/skills/dotnet-standards/templates/global.json +6 -0
  106. package/skills/dotnet-standards/templates/nuget.config +9 -0
  107. package/skills/dotnet-standards/templates/stylecop.json +37 -0
  108. package/skills/git-worktrees/SKILL.md +255 -0
  109. package/skills/implementation-planning/SKILL.md +233 -0
  110. package/skills/implementation-planning/references/plan-document-template.md +42 -0
  111. package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
  112. package/skills/implementation-planning/references/task-template.md +43 -0
  113. package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
  114. package/skills/quality-review/SKILL.md +278 -0
  115. package/skills/quality-review/references/code-quality-checklist.md +159 -0
  116. package/skills/quality-review/references/review-report-template.md +65 -0
  117. package/skills/quality-review/references/security-checklist.md +79 -0
  118. package/skills/quality-review/references/typescript-standards.md +24 -0
  119. package/skills/refactor/COMMAND.md +67 -0
  120. package/skills/refactor/SKILL.md +198 -0
  121. package/skills/refactor/phases/auto-chain.md +262 -0
  122. package/skills/refactor/phases/brief.md +176 -0
  123. package/skills/refactor/phases/explore.md +132 -0
  124. package/skills/refactor/phases/overhaul-delegate.md +136 -0
  125. package/skills/refactor/phases/overhaul-plan.md +312 -0
  126. package/skills/refactor/phases/overhaul-review.md +304 -0
  127. package/skills/refactor/phases/polish-implement.md +349 -0
  128. package/skills/refactor/phases/polish-validate.md +218 -0
  129. package/skills/refactor/phases/update-docs.md +234 -0
  130. package/skills/refactor/references/brief-template.md +81 -0
  131. package/skills/refactor/references/doc-update-checklist.md +110 -0
  132. package/skills/refactor/references/explore-checklist.md +73 -0
  133. package/skills/refactor/references/overhaul-track.md +215 -0
  134. package/skills/refactor/references/polish-track.md +170 -0
  135. package/skills/shared/prompts/context-reading.md +58 -0
  136. package/skills/shared/prompts/report-format.md +54 -0
  137. package/skills/shared/prompts/tdd-requirements.md +39 -0
  138. package/skills/shepherd/SKILL.md +264 -0
  139. package/skills/shepherd/references/assess-checklist.md +124 -0
  140. package/skills/shepherd/references/fix-strategies.md +191 -0
  141. package/skills/spec-review/SKILL.md +229 -0
  142. package/skills/spec-review/references/review-checklist.md +60 -0
  143. package/skills/sync-schemas/SKILL.md +114 -0
  144. package/skills/sync-schemas/references/configuration.md +73 -0
  145. package/skills/synthesis/SKILL.md +129 -0
  146. package/skills/synthesis/references/pr-descriptions.md +87 -0
  147. package/skills/synthesis/references/synthesis-steps.md +109 -0
  148. package/skills/synthesis/references/troubleshooting.md +115 -0
  149. package/skills/validate-all-skills.sh +57 -0
  150. package/skills/validate-frontmatter.sh +237 -0
  151. package/skills/workflow-state/SKILL.md +210 -0
  152. package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
  153. package/skills/workflow-state/references/phase-transitions.md +141 -0
@@ -0,0 +1,218 @@
1
+ # Polish Track Validate Phase
2
+
3
+ ## Purpose
4
+
5
+ Verify the refactor succeeded without regressions. This phase confirms all goals from the brief are achieved, tests pass, and no unintended changes were introduced.
6
+
7
+ ## Entry Conditions
8
+
9
+ - Polish implement phase complete
10
+ - Phase is `validate`
11
+ - Implementation commits are ready
12
+
13
+ ## Validation Checklist
14
+
15
+ ### 1. Test Suite Verification
16
+
17
+ Run the full test suite to ensure no regressions:
18
+
19
+ ```bash
20
+ npm run test:run
21
+ ```
22
+
23
+ **Requirements:**
24
+ - [ ] All existing tests pass
25
+ - [ ] No new test failures introduced
26
+ - [ ] Test count has not decreased (no deleted tests)
27
+
28
+ If tests fail:
29
+ 1. Identify which tests fail
30
+ 2. Determine if failure is due to refactor or pre-existing issue
31
+ 3. Fix refactor-related failures before proceeding
32
+ 4. Return to implement phase if significant fixes needed
33
+
34
+ ### 2. Goal Achievement
35
+
36
+ Review each goal from the brief and verify completion:
37
+
38
+ **Read goals:**
39
+
40
+ ```
41
+ action: "get", featureId: "refactor-<slug>", query: ".brief.goals"
42
+ ```
43
+
44
+ **For each goal:**
45
+ - [ ] Goal is fully addressed
46
+ - [ ] Evidence of completion is clear (code change, metric improvement, etc.)
47
+ - [ ] Goal was not partially implemented
48
+
49
+ **Record verified goals:**
50
+
51
+ ```
52
+ action: "set", featureId: "refactor-<slug>", updates: {
53
+ "validation.goalsVerified": ["<goal text>"]
54
+ }
55
+ ```
56
+
57
+ Note: For array values, subsequent calls can append additional goals.
58
+
59
+ ### 3. Regression Check
60
+
61
+ Verify no unintended changes outside refactor scope:
62
+
63
+ **Review affected areas:**
64
+ - [ ] Changes are limited to `affectedAreas` from brief
65
+ - [ ] No unexpected files modified
66
+ - [ ] No unrelated behavior changes
67
+
68
+ **Check git diff:**
69
+ ```bash
70
+ git diff --stat HEAD~<n> # Review files changed
71
+ git diff HEAD~<n> -- <unexpected-file> # Investigate unexpected changes
72
+ ```
73
+
74
+ If unintended changes found:
75
+ 1. Determine if they should be reverted
76
+ 2. If intentional, update brief's `affectedAreas`
77
+ 3. If accidental, revert and re-run validation
78
+
79
+ ### 4. Lint and Type Check
80
+
81
+ Run linting and type checking to ensure code quality:
82
+
83
+ ```bash
84
+ npm run lint
85
+ npm run typecheck # For TypeScript projects
86
+ ```
87
+
88
+ **Requirements:**
89
+ - [ ] No new lint errors introduced
90
+ - [ ] No new type errors introduced
91
+ - [ ] Any disabled rules are justified
92
+
93
+ If errors found:
94
+ 1. Fix lint/type errors
95
+ 2. Commit fixes separately
96
+ 3. Re-run validation
97
+
98
+ ### 5. Code Quality Spot Check
99
+
100
+ Manual review of key changes:
101
+
102
+ **Structure verification:**
103
+ - [ ] New code follows project conventions
104
+ - [ ] Naming is consistent and clear
105
+ - [ ] No obvious code smells introduced
106
+
107
+ **Brief alignment:**
108
+ - [ ] Implementation matches stated approach
109
+ - [ ] Out-of-scope items were not touched
110
+ - [ ] Success criteria are met
111
+
112
+ ## State Updates
113
+
114
+ ### Record Validation Start
115
+
116
+ **Initialize validation state:**
117
+
118
+ ```
119
+ action: "set", featureId: "refactor-<slug>", updates: {
120
+ "validation": {
121
+ "startedAt": "<ISO8601>",
122
+ "testsPass": null,
123
+ "goalsVerified": [],
124
+ "docsUpdated": false
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### Record Validation Results
130
+
131
+ **On successful validation:**
132
+
133
+ ```
134
+ action: "set", featureId: "refactor-<slug>", updates: {
135
+ "validation.testsPass": true,
136
+ "validation.completedAt": "<ISO8601>"
137
+ }, phase: "polish-update-docs"
138
+ ```
139
+
140
+ **On failed validation:**
141
+
142
+ ```
143
+ action: "set", featureId: "refactor-<slug>", updates: {
144
+ "validation.testsPass": false,
145
+ "validation.failureReason": "<reason>"
146
+ }, phase: "implement"
147
+ ```
148
+
149
+ ## Pass/Fail Handling
150
+
151
+ ### Validation Passed
152
+
153
+ All criteria met:
154
+ 1. Update state with successful validation results
155
+ 2. Transition to `update-docs` phase
156
+ 3. Auto-chain continues workflow
157
+
158
+ ### Validation Failed
159
+
160
+ If any criteria not met:
161
+
162
+ | Failure Type | Action |
163
+ |--------------|--------|
164
+ | Tests fail | Return to implement phase, fix issues |
165
+ | Goals not achieved | Return to implement phase, complete goals |
166
+ | Unintended changes | Revert changes, return to implement |
167
+ | Lint/type errors | Fix errors, re-run validation |
168
+ | Quality issues | Return to implement phase, address issues |
169
+
170
+ **Important:** Do not skip to update-docs with validation failures. All issues must be resolved first.
171
+
172
+ ## Exit Conditions
173
+
174
+ Transition to `update-docs` phase when ALL conditions are met:
175
+
176
+ - [ ] All tests pass
177
+ - [ ] Each goal from brief is verified as complete
178
+ - [ ] No unintended changes outside scope
179
+ - [ ] No new lint or type errors
180
+ - [ ] Code quality spot check passed
181
+ - [ ] State updated with validation results
182
+
183
+ ## Auto-Chain Behavior
184
+
185
+ On successful validation:
186
+ - Next action: `AUTO:refactor-update-docs`
187
+ - Automatically proceeds to update documentation
188
+
189
+ On failed validation:
190
+ - Next action: `AUTO:polish-implement` (return to fix issues)
191
+ - Does not proceed until validation passes
192
+
193
+ ## Common Issues
194
+
195
+ | Issue | Resolution |
196
+ |-------|------------|
197
+ | Flaky tests | Run tests multiple times, investigate intermittent failures |
198
+ | Pre-existing failures | Document in state, don't block on unrelated issues |
199
+ | Scope creep discovered | Either revert extra changes or update brief (prefer revert) |
200
+ | Missing test coverage | Add tests for changed behavior before proceeding |
201
+
202
+ ## Validation Output
203
+
204
+ Summarize validation results for the user:
205
+
206
+ ```text
207
+ Validation Results:
208
+ - Tests: All 47 tests pass
209
+ - Goals: 3/3 verified
210
+ - Extract validation logic into separate UserValidator class
211
+ - Reduce UserService to <200 lines
212
+ - Improve test isolation for validation tests
213
+ - Regressions: None detected
214
+ - Lint/Type: No new errors
215
+ - Quality: Spot check passed
216
+
217
+ Proceeding to update-docs phase...
218
+ ```
@@ -0,0 +1,234 @@
1
+ # Update Docs Phase
2
+
3
+ ## Purpose
4
+
5
+ Ensure all documentation remains accurate after refactoring. This phase updates affected documentation to reflect the new code structure, APIs, and architecture.
6
+
7
+ ## MANDATORY REQUIREMENT
8
+
9
+ **Documentation updates are NOT optional for refactors.**
10
+
11
+ Every refactor changes existing code structure. If documentation exists for that code, it MUST be updated. Skipping this phase results in documentation drift, which compounds over time and misleads future developers.
12
+
13
+ The `docsToUpdate` field in the brief identifies documents requiring updates. If this field is empty, the phase still runs to VERIFY no documentation needs updating.
14
+
15
+ ## Entry Conditions
16
+
17
+ ### Polish Track
18
+
19
+ - `validate` phase complete
20
+ - All tests passing
21
+ - Goals verified
22
+
23
+ ### Overhaul Track
24
+
25
+ - `review` phase complete
26
+ - All quality checks passed
27
+ - Code merged to feature branch
28
+
29
+ ## Process
30
+
31
+ ### Step 1: Review Documentation List
32
+
33
+ **Read docs list:**
34
+
35
+ ```
36
+ action: "get", featureId: "refactor-<slug>", query: ".brief.docsToUpdate"
37
+ ```
38
+
39
+ If the list is empty, proceed to Step 4 (Verification).
40
+
41
+ ### Step 2: Read Each Document
42
+
43
+ For each document in the list:
44
+
45
+ 1. Read the current content
46
+ 2. Identify sections affected by the refactor
47
+ 3. Note what needs to change
48
+
49
+ ```typescript
50
+ Read({ file_path: "/path/to/affected-doc.md" })
51
+ ```
52
+
53
+ ### Step 3: Update Affected Sections
54
+
55
+ Update each document to reflect the new code structure:
56
+
57
+ | Change Type | Documentation Update |
58
+ |-------------|---------------------|
59
+ | Renamed file/class | Update all references |
60
+ | Moved location | Update paths and imports |
61
+ | Changed API | Update signatures and examples |
62
+ | New architecture | Add/update diagrams |
63
+ | Removed code | Remove obsolete references |
64
+
65
+ **Update Guidelines:**
66
+
67
+ - Keep updates minimal and focused
68
+ - Match the existing document style
69
+ - Update code examples if affected
70
+ - Verify links still work
71
+
72
+ ### Step 4: Verification
73
+
74
+ Verify documentation accuracy against the new code:
75
+
76
+ | Check | How to Verify |
77
+ |-------|---------------|
78
+ | File paths | Confirm paths in docs exist |
79
+ | Code examples | Examples compile/run correctly |
80
+ | API signatures | Match actual implementation |
81
+ | Diagrams | Reflect current architecture |
82
+ | Links | All internal links resolve |
83
+
84
+ If `docsToUpdate` was empty, verify:
85
+ - Search for references to changed code
86
+ - Confirm no documentation references outdated patterns
87
+ - If documentation gaps found, update immediately
88
+
89
+ ## Documentation Types
90
+
91
+ ### Architecture Documentation
92
+
93
+ Update when:
94
+ - Module structure changes
95
+ - Dependencies change
96
+ - Component relationships change
97
+
98
+ Typical locations:
99
+ - `docs/architecture/*.md`
100
+ - `docs/adrs/*.md`
101
+ - `README.md` architecture sections
102
+
103
+ ### API Documentation
104
+
105
+ Update when:
106
+ - Function signatures change
107
+ - Types/interfaces change
108
+ - Endpoints change
109
+
110
+ Typical locations:
111
+ - Inline JSDoc/TSDoc comments
112
+ - `docs/api/*.md`
113
+ - OpenAPI/Swagger specs
114
+
115
+ ### README Files
116
+
117
+ Update when:
118
+ - Setup process changes
119
+ - Usage patterns change
120
+ - Dependencies change
121
+
122
+ Typical locations:
123
+ - Project root `README.md`
124
+ - Module-level `README.md` files
125
+
126
+ ### Inline Comments
127
+
128
+ Update when:
129
+ - Complex logic moves
130
+ - Algorithms change
131
+ - Important context relocates
132
+
133
+ **Note:** Avoid over-commenting. Only update comments that explain WHY, not WHAT.
134
+
135
+ ## State Updates
136
+
137
+ **Record docs and advance (polish track):**
138
+
139
+ ```
140
+ action: "set", featureId: "refactor-<slug>", updates: {
141
+ "artifacts.updatedDocs": ["docs/architecture/modules.md"],
142
+ "validation.docsUpdated": true
143
+ }, phase: "completed"
144
+ ```
145
+
146
+ **Record docs and advance (overhaul track):**
147
+
148
+ ```
149
+ action: "set", featureId: "refactor-<slug>", updates: {
150
+ "artifacts.updatedDocs": ["docs/architecture/modules.md"],
151
+ "validation.docsUpdated": true
152
+ }, phase: "synthesize"
153
+ ```
154
+
155
+ ## Exit Conditions
156
+
157
+ ### Polish Track
158
+
159
+ After completing documentation updates:
160
+
161
+ 1. All listed documents updated
162
+ 2. Verification complete
163
+ 3. State updated with `docsUpdated = true`
164
+ 4. **CHECKPOINT: Human approval required**
165
+
166
+ Present summary to user:
167
+ ```text
168
+ Documentation Update Complete
169
+ -----------------------------
170
+ Updated docs:
171
+ - docs/architecture/modules.md (updated paths)
172
+ - README.md (updated examples)
173
+
174
+ Verification: All links and examples verified
175
+
176
+ Ready to complete refactor? [Approve / Request changes]
177
+ ```
178
+
179
+ ### Overhaul Track
180
+
181
+ After completing documentation updates:
182
+
183
+ 1. All listed documents updated
184
+ 2. Verification complete
185
+ 3. State updated with `docsUpdated = true`
186
+ 4. **Auto-chain to synthesize phase**
187
+
188
+ **Advance to synthesize:**
189
+
190
+ ```
191
+ action: "set", featureId: "refactor-<slug>", phase: "synthesize"
192
+ ```
193
+
194
+ 5. Auto-invoke synthesize immediately:
195
+ ```typescript
196
+ Skill({ skill: "exarchos:synthesize", args: "<feature-name>" })
197
+ ```
198
+
199
+ This is NOT a human checkpoint - workflow continues autonomously.
200
+
201
+ ## Common Issues
202
+
203
+ ### No Documentation Exists
204
+
205
+ If refactored code has no documentation:
206
+ - This is acceptable for refactors
207
+ - Creating new documentation is a separate task
208
+ - Note the gap in the state for future reference
209
+
210
+ ### Documentation Scope Creep
211
+
212
+ If updating one document reveals many need updates:
213
+ - Update only what's necessary for this refactor
214
+ - Note other gaps for future work
215
+ - Stay focused on the brief's scope
216
+
217
+ ### Conflicting Documentation
218
+
219
+ If documentation conflicts with new code:
220
+ - Trust the code (you just validated it)
221
+ - Update documentation to match
222
+ - Add clarifying notes if needed
223
+
224
+ ## Checklist
225
+
226
+ Before exiting this phase:
227
+
228
+ - [ ] Reviewed all documents in `docsToUpdate`
229
+ - [ ] Updated affected sections in each document
230
+ - [ ] Verified file paths and links
231
+ - [ ] Verified code examples work
232
+ - [ ] Updated state with `artifacts.updatedDocs` list
233
+ - [ ] Set `docsUpdated = true`
234
+ - [ ] Transitioned to next phase (completed or synthesize)
@@ -0,0 +1,81 @@
1
+ # Refactor Brief Template
2
+
3
+ ## Purpose
4
+
5
+ The brief captures refactor intent without the overhead of a full design document. Store in workflow state, not as a separate file.
6
+
7
+ ## Brief Fields
8
+
9
+ ### Problem (Required)
10
+ What's wrong with the current code? Be specific.
11
+
12
+ **Polish example:** "The UserService class has grown to 500 lines with mixed responsibilities"
13
+
14
+ **Overhaul example:** "The authentication module uses callbacks throughout, making error handling inconsistent and testing difficult"
15
+
16
+ ### Goals (Required)
17
+ List specific, measurable goals. Each goal should be verifiable.
18
+
19
+ **Good goals:**
20
+ - Extract validation logic into separate UserValidator class
21
+ - Convert callback-based auth to async/await pattern
22
+ - Reduce cyclomatic complexity of processOrder from 15 to <5
23
+
24
+ **Bad goals:**
25
+ - Make the code better
26
+ - Clean things up
27
+ - Improve performance (without metrics)
28
+
29
+ ### Approach (Required)
30
+ High-level description of how you'll achieve the goals.
31
+
32
+ **Polish approach:** "Extract validation methods to new class, update callers, run tests"
33
+
34
+ **Overhaul approach:** "Phase 1: Create async wrapper around existing callbacks. Phase 2: Convert internal methods to async. Phase 3: Update public API. Phase 4: Remove callback support."
35
+
36
+ ### Affected Areas (Required)
37
+ List specific paths/modules that will change.
38
+
39
+ ### Out of Scope (Required)
40
+ Explicitly state what you're NOT changing. Prevents scope creep.
41
+
42
+ ### Success Criteria (Required)
43
+ How will you know the refactor is complete?
44
+
45
+ - All existing tests pass
46
+ - [Specific goal] is achieved
47
+ - [Metric] is improved by [amount]
48
+ - Documentation reflects new structure
49
+
50
+ ### Docs to Update (Required)
51
+ List documentation files that need updating after refactor.
52
+
53
+ ## State Update
54
+
55
+ **Save brief and advance:**
56
+
57
+ ```
58
+ action: "set", featureId: "refactor-<slug>", updates: {
59
+ "brief": {
60
+ "problem": "<problem statement>",
61
+ "goals": ["<goal 1>", "<goal 2>"],
62
+ "approach": "<approach description>",
63
+ "affectedAreas": ["<area 1>", "<area 2>"],
64
+ "outOfScope": ["<exclusion 1>", "<exclusion 2>"],
65
+ "successCriteria": ["<criterion 1>", "<criterion 2>"],
66
+ "docsToUpdate": ["<doc 1>", "<doc 2>"]
67
+ }
68
+ }, phase: "polish-implement | overhaul-plan"
69
+ ```
70
+
71
+ ## Polish vs Overhaul Brief Depth
72
+
73
+ | Field | Polish | Overhaul |
74
+ |-------|--------|----------|
75
+ | Problem | 1-2 sentences | Paragraph with context |
76
+ | Goals | 1-3 items | 3-5 items |
77
+ | Approach | 1 sentence | Paragraph with phases |
78
+ | Affected Areas | File paths | Module/package paths |
79
+ | Out of Scope | 1-2 items | 3+ items |
80
+ | Success Criteria | 2-3 items | 4+ items |
81
+ | Docs to Update | 0-2 files | 2+ files |
@@ -0,0 +1,110 @@
1
+ # Documentation Update Checklist
2
+
3
+ ## Purpose
4
+
5
+ Every refactor MUST update affected documentation. This is not optional. Code without accurate documentation creates technical debt.
6
+
7
+ ## Before Starting
8
+
9
+ 1. Review `docsToUpdate` list from brief
10
+ 2. Read each document to understand current state
11
+ 3. Note specific sections that need changes
12
+
13
+ ## Documentation Types
14
+
15
+ ### Architecture Documentation
16
+
17
+ **When to update:** Structure, module organization, or dependencies changed
18
+
19
+ **What to check:**
20
+ - [ ] Component diagrams accurate
21
+ - [ ] Module descriptions current
22
+ - [ ] Dependency arrows correct
23
+ - [ ] Technology choices documented
24
+
25
+ ### API Documentation
26
+
27
+ **When to update:** Public interfaces, method signatures, or behavior changed
28
+
29
+ **What to check:**
30
+ - [ ] Function/method signatures match code
31
+ - [ ] Parameter descriptions accurate
32
+ - [ ] Return value documentation correct
33
+ - [ ] Examples still work
34
+ - [ ] Error cases documented
35
+
36
+ ### README Files
37
+
38
+ **When to update:** Setup, usage, or configuration changed
39
+
40
+ **What to check:**
41
+ - [ ] Installation steps current
42
+ - [ ] Configuration examples valid
43
+ - [ ] Usage examples work
44
+ - [ ] Prerequisites listed
45
+
46
+ ### Inline Comments
47
+
48
+ **When to update:** Complex logic moved or rewritten
49
+
50
+ **What to check:**
51
+ - [ ] Comments explain "why" not "what"
52
+ - [ ] No stale comments referring to old code
53
+ - [ ] Complex algorithms documented
54
+ - [ ] TODO items addressed or updated
55
+
56
+ ## Verification
57
+
58
+ After updating documentation, run automated link verification:
59
+
60
+ ```bash
61
+ bash scripts/verify-doc-links.sh --docs-dir docs/
62
+ ```
63
+
64
+ **On Exit 0:** All links valid.
65
+ **On Exit 1:** Broken links found — fix before proceeding.
66
+
67
+ Additionally:
68
+
69
+ 1. [ ] Read each updated doc fresh
70
+ 2. [ ] Verify code references are accurate
71
+ 3. [ ] Test any code examples
72
+
73
+ ## State Update
74
+
75
+ **Record updated docs:**
76
+
77
+ ```
78
+ action: "set", featureId: "refactor-<slug>", updates: {
79
+ "validation.docsUpdated": true,
80
+ "artifacts.updatedDocs": ["<doc1>", "<doc2>"]
81
+ }
82
+ ```
83
+
84
+ ## If No Docs Need Updating
85
+
86
+ If `docsToUpdate` is empty, verify this is correct:
87
+
88
+ 1. Review affected areas
89
+ 2. Confirm no public interfaces changed
90
+ 3. Confirm no architectural changes made
91
+ 4. Document verification in state:
92
+
93
+ **Confirm no docs needed:**
94
+
95
+ ```
96
+ action: "set", featureId: "refactor-<slug>", updates: {
97
+ "validation.docsUpdated": true,
98
+ "artifacts.updatedDocs": []
99
+ }
100
+ ```
101
+
102
+ ## Common Mistakes
103
+
104
+ | Mistake | Correction |
105
+ |---------|------------|
106
+ | "Docs don't need updating" | Always verify; code changes usually need doc updates |
107
+ | Update code examples only | Also update prose descriptions |
108
+ | Skip architecture docs | These are often most important |
109
+ | Leave TODO comments | Address or remove them |
110
+ | Assume readers know context | Document the "why" |
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: explore-checklist
3
+ ---
4
+
5
+ # Refactor Exploration Checklist
6
+
7
+ ## Scope Assessment
8
+
9
+ ### Files Analysis
10
+ - [ ] List all files that will be modified
11
+ - [ ] Count total files affected
12
+ - [ ] Identify file types (source, test, config, docs)
13
+
14
+ ### Module Analysis
15
+ - [ ] List modules/packages affected
16
+ - [ ] Identify cross-module dependencies
17
+ - [ ] Check for circular dependencies that might complicate refactor
18
+
19
+ ### Test Coverage
20
+ - [ ] Check test coverage of affected code
21
+ - [ ] Identify test gaps
22
+ - [ ] Note tests that will need updating
23
+
24
+ ### Documentation Impact
25
+ - [ ] List documentation that references affected code
26
+ - [ ] Identify architecture docs that may need updates
27
+ - [ ] Check for API documentation impacts
28
+
29
+ ## Track Selection
30
+
31
+ ### Polish Track Indicators (all must be true)
32
+ - [ ] <=5 files affected
33
+ - [ ] Single concern being addressed
34
+ - [ ] No cross-module changes
35
+ - [ ] Good test coverage exists
36
+ - [ ] Documentation changes are minor
37
+
38
+ ### Overhaul Track Indicators (any one triggers)
39
+ - [ ] >5 files affected
40
+ - [ ] Multiple concerns being addressed
41
+ - [ ] Cross-module changes required
42
+ - [ ] Test coverage gaps exist
43
+ - [ ] Architectural documentation needs updating
44
+
45
+ ## Deterministic Scope Assessment
46
+
47
+ Run the scope assessment script for a deterministic track recommendation:
48
+
49
+ ```bash
50
+ bash scripts/assess-refactor-scope.sh --files <file1,file2,...>
51
+ # or
52
+ bash scripts/assess-refactor-scope.sh --state-file <path>
53
+ ```
54
+
55
+ **On Exit 0:** Polish recommended — scope is contained (<=5 files, single module).
56
+ **On Exit 1:** Overhaul recommended — scope exceeds polish limits (>5 files or cross-module).
57
+
58
+ ## Output
59
+
60
+ **Save assessment and advance to brief:**
61
+
62
+ ```
63
+ action: "set", featureId: "refactor-<slug>", updates: {
64
+ "explore.scopeAssessment": {
65
+ "filesAffected": ["<list>"],
66
+ "modulesAffected": ["<list>"],
67
+ "testCoverage": "good | gaps | none",
68
+ "recommendedTrack": "polish | overhaul"
69
+ },
70
+ "track": "<selected-track>",
71
+ "explore.completedAt": "<ISO8601>"
72
+ }, phase: "brief"
73
+ ```