claude-code-workflow 7.2.30 → 7.3.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 (183) hide show
  1. package/.claude/commands/workflow-skill.md +130 -0
  2. package/.claude/skills/ccw-chain/SKILL.md +44 -71
  3. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +13 -3
  4. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +33 -22
  5. package/.claude/skills/ccw-chain/chains/ccw-issue.json +23 -12
  6. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +23 -9
  7. package/.claude/skills/ccw-chain/chains/ccw-main.json +15 -2
  8. package/.claude/skills/ccw-chain/chains/ccw-standard.json +28 -16
  9. package/.claude/skills/ccw-chain/chains/ccw-team.json +7 -2
  10. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +25 -9
  11. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -53
  12. package/.claude/skills/chain-loader/specs/chain-schema.md +30 -3
  13. package/.claude/skills/chain-loader/templates/chain-json.md +63 -63
  14. package/.claude/skills/workflow-plan/SKILL.md +1 -0
  15. package/.claude/skills/workflow-plan/phases/01-session-discovery.md +19 -2
  16. package/.claude/skills/workflow-plan/phases/02-context-gathering.md +2 -2
  17. package/.claude/skills/workflow-plan/phases/04-task-generation.md +9 -1
  18. package/.codex/skills/analyze-with-file/SKILL.md +383 -134
  19. package/.codex/skills/brainstorm/SKILL.md +3 -3
  20. package/.codex/skills/brainstorm-with-file/SKILL.md +208 -88
  21. package/.codex/skills/clean/SKILL.md +1 -1
  22. package/.codex/skills/csv-wave-pipeline/SKILL.md +2 -2
  23. package/.codex/skills/investigate/orchestrator.md +24 -0
  24. package/.codex/skills/issue-discover/SKILL.md +374 -361
  25. package/.codex/skills/issue-discover/phases/01-issue-new.md +1 -1
  26. package/.codex/skills/issue-discover/phases/02-discover.md +2 -2
  27. package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +1 -1
  28. package/.codex/skills/issue-discover/phases/04-quick-execute.md +2 -2
  29. package/.codex/skills/parallel-dev-cycle/SKILL.md +44 -37
  30. package/.codex/skills/project-documentation-workflow/SKILL.md +1 -1
  31. package/.codex/skills/review-cycle/SKILL.md +31 -12
  32. package/.codex/skills/roadmap-with-file/SKILL.md +141 -133
  33. package/.codex/skills/security-audit/orchestrator.md +29 -0
  34. package/.codex/skills/session-sync/SKILL.md +1 -1
  35. package/.codex/skills/ship/orchestrator.md +24 -0
  36. package/.codex/skills/spec-add/SKILL.md +5 -5
  37. package/.codex/skills/spec-generator/SKILL.md +33 -2
  38. package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +3 -3
  39. package/.codex/skills/spec-generator/phases/01-discovery.md +1 -1
  40. package/.codex/skills/spec-generator/phases/02-product-brief.md +1 -1
  41. package/.codex/skills/spec-generator/phases/03-requirements.md +1 -1
  42. package/.codex/skills/spec-generator/phases/04-architecture.md +1 -1
  43. package/.codex/skills/spec-generator/phases/05-epics-stories.md +1 -1
  44. package/.codex/skills/spec-generator/phases/06-readiness-check.md +1 -1
  45. package/.codex/skills/spec-generator/phases/07-issue-export.md +1 -1
  46. package/.codex/skills/spec-setup/SKILL.md +669 -669
  47. package/.codex/skills/team-arch-opt/specs/team-config.json +1 -1
  48. package/.codex/skills/team-brainstorm/SKILL.md +259 -259
  49. package/.codex/skills/team-coordinate/SKILL.md +359 -359
  50. package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +1 -1
  51. package/.codex/skills/team-designer/SKILL.md +27 -1
  52. package/.codex/skills/team-designer/phases/01-requirements-analysis.md +2 -2
  53. package/.codex/skills/team-designer/phases/02-scaffold-generation.md +1 -1
  54. package/.codex/skills/team-designer/phases/04-validation.md +1 -1
  55. package/.codex/skills/team-executor/SKILL.md +218 -218
  56. package/.codex/skills/team-frontend/SKILL.md +227 -227
  57. package/.codex/skills/team-frontend-debug/SKILL.md +278 -278
  58. package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +2 -2
  59. package/.codex/skills/team-interactive-craft/SKILL.md +220 -220
  60. package/.codex/skills/team-interactive-craft/roles/coordinator/role.md +209 -209
  61. package/.codex/skills/team-issue/SKILL.md +269 -269
  62. package/.codex/skills/team-issue/roles/coordinator/role.md +1 -1
  63. package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -305
  64. package/.codex/skills/team-motion-design/SKILL.md +222 -222
  65. package/.codex/skills/team-motion-design/roles/coordinator/role.md +210 -210
  66. package/.codex/skills/team-perf-opt/SKILL.md +258 -258
  67. package/.codex/skills/team-perf-opt/specs/team-config.json +1 -1
  68. package/.codex/skills/team-planex/SKILL.md +216 -216
  69. package/.codex/skills/team-quality-assurance/SKILL.md +229 -229
  70. package/.codex/skills/team-review/SKILL.md +227 -227
  71. package/.codex/skills/team-roadmap-dev/SKILL.md +238 -238
  72. package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/roadmap-discuss.md +5 -5
  73. package/.codex/skills/team-tech-debt/SKILL.md +206 -206
  74. package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
  75. package/.codex/skills/team-testing/SKILL.md +237 -237
  76. package/.codex/skills/team-ui-polish/SKILL.md +218 -218
  77. package/.codex/skills/team-ui-polish/roles/coordinator/role.md +213 -213
  78. package/.codex/skills/team-uidesign/SKILL.md +219 -219
  79. package/.codex/skills/team-uidesign/roles/coordinator/role.md +2 -2
  80. package/.codex/skills/team-ultra-analyze/SKILL.md +260 -260
  81. package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +1 -1
  82. package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +1 -1
  83. package/.codex/skills/team-ux-improve/SKILL.md +227 -227
  84. package/.codex/skills/team-ux-improve/roles/coordinator/role.md +1 -1
  85. package/.codex/skills/team-ux-improve/specs/team-config.json +1 -1
  86. package/.codex/skills/team-visual-a11y/SKILL.md +319 -319
  87. package/.codex/skills/team-visual-a11y/roles/coordinator/role.md +213 -213
  88. package/.codex/skills/workflow-execute/SKILL.md +5 -5
  89. package/.codex/skills/workflow-lite-planex/SKILL.md +3 -3
  90. package/.codex/skills/workflow-plan/SKILL.md +3 -3
  91. package/.codex/skills/workflow-tdd-plan/SKILL.md +4 -4
  92. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +403 -402
  93. package/ccw/dist/cli.d.ts.map +1 -1
  94. package/ccw/dist/cli.js +16 -0
  95. package/ccw/dist/cli.js.map +1 -1
  96. package/ccw/dist/commands/chain-loader.d.ts +2 -0
  97. package/ccw/dist/commands/chain-loader.d.ts.map +1 -0
  98. package/ccw/dist/commands/chain-loader.js +11 -0
  99. package/ccw/dist/commands/chain-loader.js.map +1 -0
  100. package/ccw/dist/commands/install.d.ts.map +1 -1
  101. package/ccw/dist/commands/install.js +52 -1
  102. package/ccw/dist/commands/install.js.map +1 -1
  103. package/ccw/dist/commands/launcher.d.ts +2 -0
  104. package/ccw/dist/commands/launcher.d.ts.map +1 -0
  105. package/ccw/dist/commands/launcher.js +434 -0
  106. package/ccw/dist/commands/launcher.js.map +1 -0
  107. package/ccw/dist/tools/chain-loader.d.ts.map +1 -1
  108. package/ccw/dist/tools/chain-loader.js +457 -45
  109. package/ccw/dist/tools/chain-loader.js.map +1 -1
  110. package/ccw/dist/tools/skill-context-loader.d.ts.map +1 -1
  111. package/ccw/dist/tools/skill-context-loader.js +12 -26
  112. package/ccw/dist/tools/skill-context-loader.js.map +1 -1
  113. package/ccw/dist/types/chain-types.d.ts +41 -1
  114. package/ccw/dist/types/chain-types.d.ts.map +1 -1
  115. package/ccw/dist/utils/chain-visualizer.d.ts +13 -0
  116. package/ccw/dist/utils/chain-visualizer.d.ts.map +1 -0
  117. package/ccw/dist/utils/chain-visualizer.js +164 -0
  118. package/ccw/dist/utils/chain-visualizer.js.map +1 -0
  119. package/package.json +1 -1
  120. package/.claude/commands/cli/cli-init.md +0 -441
  121. package/.claude/commands/cli/codex-review.md +0 -361
  122. package/.claude/commands/flow-create.md +0 -663
  123. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +0 -788
  124. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +0 -408
  125. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +0 -207
  126. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +0 -567
  127. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +0 -748
  128. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +0 -827
  129. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +0 -482
  130. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +0 -639
  131. package/.claude/skills/ccw-chain/phases/debug-with-file.md +0 -656
  132. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +0 -936
  133. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +0 -720
  134. package/.claude/skills/ccw-chain/phases/issue-discover.md +0 -483
  135. package/.claude/skills/ccw-chain/phases/issue-execute.md +0 -629
  136. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +0 -382
  137. package/.claude/skills/ccw-chain/phases/issue-plan.md +0 -343
  138. package/.claude/skills/ccw-chain/phases/issue-queue.md +0 -464
  139. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +0 -852
  140. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +0 -132
  141. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +0 -760
  142. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +0 -764
  143. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +0 -775
  144. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +0 -544
  145. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +0 -338
  146. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +0 -404
  147. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +0 -257
  148. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +0 -274
  149. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +0 -184
  150. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +0 -248
  151. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +0 -178
  152. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +0 -144
  153. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +0 -480
  154. package/.claude/skills/ccw-chain/phases/team-planex.md +0 -123
  155. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +0 -678
  156. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +0 -870
  157. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +0 -625
  158. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +0 -215
  159. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +0 -616
  160. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +0 -424
  161. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +0 -466
  162. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +0 -99
  163. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +0 -338
  164. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +0 -422
  165. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +0 -440
  166. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +0 -395
  167. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +0 -594
  168. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +0 -527
  169. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +0 -57
  170. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +0 -407
  171. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +0 -172
  172. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +0 -426
  173. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +0 -473
  174. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +0 -189
  175. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +0 -635
  176. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +0 -482
  177. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +0 -60
  178. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +0 -493
  179. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +0 -150
  180. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +0 -346
  181. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +0 -538
  182. package/.claude/skills/ccw-chain/specs/intent-patterns.md +0 -60
  183. package/.claude/skills/team-edict.zip +0 -0
@@ -1,852 +0,0 @@
1
- ---
2
- name: refactor-cycle
3
- description: Tech debt discovery and self-iterating refactoring with multi-dimensional analysis, prioritized execution, regression validation, and reflection-driven adjustment
4
- argument-hint: "[-y|--yes] [-c|--continue] [--scope=module|project] \"module or refactoring goal\""
5
- allowed-tools: TodoWrite(*), Agent(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*)
6
- ---
7
-
8
- ## Auto Mode
9
-
10
- When `--yes` or `-y`: Auto-confirm prioritization, use recommended refactoring strategy, skip interactive checkpoints.
11
-
12
- # Workflow Refactor-Cycle Command
13
-
14
- ## Quick Start
15
-
16
- ```bash
17
- # Discover and fix tech debt in a module
18
- /workflow:refactor-cycle "src/auth 模块的技术债务清理"
19
-
20
- # Auto mode - fully autonomous
21
- /workflow:refactor-cycle -y "支付服务重构优化"
22
-
23
- # Project-wide scan
24
- /workflow:refactor-cycle --scope=project "全项目技术债务扫描与重构"
25
-
26
- # Continue interrupted session
27
- /workflow:refactor-cycle --continue "认证模块"
28
- ```
29
-
30
- **Context Source**: cli-explore-agent + Gemini/Codex multi-dimensional analysis
31
- **Output Directory**: `.workflow/.refactor/{session-id}/`
32
- **Core Innovation**: Debt-driven refactoring with regression-safe iterative execution and reflection
33
-
34
- ## What & Why
35
-
36
- ### Core Concept
37
-
38
- Closed-loop tech debt lifecycle: **Discover → Assess → Plan → Refactor → Validate → Reflect → Next** — each refactoring item is executed, validated against regression, and reflected upon before proceeding.
39
-
40
- **vs Existing Commands**:
41
- - **workflow:lite-fix**: Single bug fix, no systematic debt analysis
42
- - **workflow-plan + execute**: Generic implementation, no debt-aware prioritization or regression validation
43
- - **This command**: Full debt lifecycle — discovery through multi-dimensional scan, prioritized execution with per-item regression validation
44
-
45
- ### Value Proposition
46
- 1. **Systematic Discovery**: Multi-dimensional scan (code quality, architecture, dependencies, test gaps, performance)
47
- 2. **Risk-Aware Prioritization**: Impact × effort matrix with dependency-aware ordering
48
- 3. **Regression-Safe**: Each refactoring item validated before proceeding to next
49
- 4. **Documented Reasoning**: Every debt item, prioritization decision, and refactoring outcome recorded
50
-
51
- ## Output Artifacts
52
-
53
- **2 core files + 1 trace directory**:
54
-
55
- | Artifact | Type | Description |
56
- |----------|------|-------------|
57
- | `reflection-log.md` | Human-readable | ⭐ Debt inventory, prioritization rationale, per-item refactoring reflections, conclusions |
58
- | `state.json` | Machine-readable | Debt items, priority queue, refactoring plans, validation results, iteration state |
59
- | `.trace/` | Raw logs | CLI analysis outputs, test outputs, diagnostics snapshots |
60
-
61
- ```
62
- .workflow/.refactor/RFT-{slug}-{date}/
63
- ├── reflection-log.md # ⭐ Debt discovery + prioritization + per-item reflections + conclusions
64
- ├── state.json # Debt inventory + queue + plans + validation + iteration state
65
- └── .trace/ # Raw logs (CLI outputs, test results, diagnostics)
66
- ├── discovery-cli.txt
67
- ├── item-{N}-cli.txt
68
- └── test-output.log
69
- ```
70
-
71
- ## Overview
72
-
73
- ```
74
- ┌─────────────────────────────────────────────────────────────────────────┐
75
- │ TECH DEBT REFACTORING CYCLE │
76
- ├─────────────────────────────────────────────────────────────────────────┤
77
- │ │
78
- │ Phase 1: Session Initialization │
79
- │ ├─ Parse input (module/goal) │
80
- │ ├─ Create session directory │
81
- │ └─ Initialize reflection-log.md + state.json │
82
- │ │
83
- │ Phase 2: Debt Discovery │
84
- │ ├─ cli-explore-agent: Codebase structure & patterns │
85
- │ ├─ CLI multi-dimensional scan: │
86
- │ │ ├─ Code quality (complexity, duplication, dead code) │
87
- │ │ ├─ Architecture (coupling, cohesion, layering violations) │
88
- │ │ ├─ Dependencies (outdated, circular, unused) │
89
- │ │ ├─ Test gaps (untested paths, fragile tests) │
90
- │ │ └─ Maintainability (naming, documentation, type safety) │
91
- │ ├─ Build debt inventory → state.json.debt_items │
92
- │ └─ Append findings to reflection-log.md │
93
- │ │
94
- │ Phase 3: Assessment & Prioritization │
95
- │ ├─ Score each item: impact (1-5) × effort (1-5) │
96
- │ ├─ Analyze dependency ordering (what must refactor first) │
97
- │ ├─ [Interactive] User confirms/adjusts priorities │
98
- │ ├─ Build execution queue → state.json.queue │
99
- │ └─ Append prioritization rationale to reflection-log.md │
100
- │ │
101
- │ Phase 4: Iterative Refactoring Cycle ◄─── CORE LOOP ──┐ │
102
- │ │ For each item in queue: │ │
103
- │ ├─ Snapshot: Capture baseline (diagnostics + tests) │ │
104
- │ ├─ Refactor: @code-developer applies changes │ │
105
- │ ├─ Validate: │ │
106
- │ │ ├─ Tests pass? (no regression) │ │
107
- │ │ ├─ Diagnostics clean? (no new errors) │ │
108
- │ │ └─ Quality improved? (metrics comparison) │ │
109
- │ ├─ Decision: │ │
110
- │ │ ├─ PASS → Commit, reflect, next item │ │
111
- │ │ ├─ PARTIAL → Fix issues, re-validate ───────────→│ │
112
- │ │ └─ FAIL → Rollback, reflect, skip/retry │ │
113
- │ ├─ Reflect: Record what changed, what broke, why │ │
114
- │ └─ Commit: git add + commit per completed item │ │
115
- │ │
116
- │ Phase 5: Completion │
117
- │ ├─ Final metrics comparison (before vs after) │
118
- │ ├─ Finalize reflection-log.md with conclusions │
119
- │ └─ Offer next steps │
120
- │ │
121
- └─────────────────────────────────────────────────────────────────────────┘
122
- ```
123
-
124
- ## Implementation
125
-
126
- ### Session Initialization
127
-
128
- **Objective**: Create session context and initialize 2 core files.
129
-
130
- **Required Actions**:
131
- 1. Extract module/goal from `$ARGUMENTS`
132
- 2. Generate session ID: `RFT-{slug}-{date}`
133
- - slug: lowercase, alphanumeric + Chinese, max 40 chars
134
- - date: YYYY-MM-DD (UTC+8)
135
- 3. Session folder: `.workflow/.refactor/{session-id}`
136
- 4. Parse options:
137
- - `-c` / `--continue`: Resume existing session
138
- - `-y` / `--yes`: Auto-approval mode
139
- - `--scope=module|project` (default: module)
140
- 5. Auto-detect: If session folder + reflection-log.md exist → continue mode
141
- 6. Create: `{sessionFolder}/`, `{sessionFolder}/.trace/`
142
-
143
- **Initialize reflection-log.md**:
144
-
145
- ```markdown
146
- # Tech Debt Refactoring Log
147
-
148
- ## Session: {sessionId}
149
- - **Target**: {module_or_goal}
150
- - **Scope**: {module|project}
151
- - **Started**: {timestamp}
152
-
153
- ---
154
-
155
- ## Phase 2: Debt Discovery
156
- > Pending...
157
-
158
- ## Phase 3: Prioritization
159
- > Pending...
160
-
161
- ## Refactoring Timeline
162
- > Per-item reflections will be appended here...
163
-
164
- ## Cumulative Learnings
165
- > (Replaced and updated after each refactoring item — not appended)
166
-
167
- ## Conclusions
168
- > Final synthesis after completion...
169
- ```
170
-
171
- **Initialize state.json**:
172
-
173
- ```json
174
- {
175
- "session_id": "RFT-xxx",
176
- "target": "module or goal",
177
- "scope": "module|project",
178
- "started": "timestamp",
179
- "phase": "init",
180
-
181
- "exploration": null,
182
- "debt_items": [],
183
- "queue": [],
184
- "current_item": null,
185
- "completed_items": [],
186
- "skipped_items": [],
187
- "baseline": null,
188
- "summary": null
189
- }
190
- ```
191
-
192
- ---
193
-
194
- ### Phase 2: Debt Discovery
195
-
196
- **Objective**: Systematically scan the codebase and build a debt inventory across multiple dimensions.
197
-
198
- **Workflow Steps**:
199
-
200
- 1. **Codebase Exploration via cli-explore-agent**
201
-
202
- ```javascript
203
- Agent({
204
- subagent_type: "cli-explore-agent",
205
- run_in_background: false,
206
- description: `Explore codebase for debt: ${topicSlug}`,
207
- prompt: `
208
- ## Analysis Context
209
- Target: ${module_or_goal}
210
- Scope: ${scope}
211
- Session: ${sessionFolder}
212
-
213
- ## MANDATORY FIRST STEPS
214
- 1. Run: ccw tool exec get_modules_by_depth '{}'
215
- 2. Read: .workflow/project-tech.json (if exists)
216
- 3. Search for: complex functions, long files, TODO/FIXME/HACK comments, suppression patterns (@ts-ignore, eslint-disable)
217
-
218
- ## Exploration Focus
219
- - **Module Structure**: File organization, module boundaries, public APIs
220
- - **Code Metrics**: Longest files, deepest nesting, most complex functions
221
- - **Dependency Graph**: Import chains, circular dependencies, external deps
222
- - **Test Coverage**: Test file mapping, untested modules
223
- - **Pattern Violations**: Inconsistent naming, mixed paradigms, dead exports
224
-
225
- ## Output
226
- Update state.json field "exploration" with:
227
- {
228
- "structure": { "files": [], "modules": [], "total_loc": 0 },
229
- "metrics": { "largest_files": [], "most_complex": [], "deepest_nesting": [] },
230
- "dependency_issues": { "circular": [], "unused_imports": [], "outdated_deps": [] },
231
- "test_mapping": { "tested": [], "untested": [], "coverage_estimate": "" },
232
- "pattern_violations": { "suppressions": [], "todos": [], "inconsistencies": [] },
233
- "_metadata": { "files_analyzed": 0, "timestamp": "" }
234
- }
235
- Also set state.json "phase" to "explored".
236
- `
237
- })
238
- ```
239
-
240
- 2. **Multi-Dimensional CLI Debt Scan**
241
-
242
- ```javascript
243
- Bash({
244
- command: `ccw cli -p "
245
- PURPOSE: Comprehensive tech debt analysis for '${module_or_goal}'
246
- Success: Actionable debt inventory with concrete file:line references
247
-
248
- EXPLORATION CONTEXT:
249
- ${JSON.stringify(state.exploration, null, 2)}
250
-
251
- TASK:
252
- • **Code Quality**: Identify high-complexity functions (cyclomatic >10), duplicated logic (>20 lines), dead code (unreachable/unused exports), overly long files (>500 lines)
253
- • **Architecture**: Detect tight coupling (>5 imports from one module), layering violations (UI→DB direct), god classes/modules, missing abstractions
254
- • **Dependencies**: Flag circular imports, unused dependencies, outdated packages with known vulnerabilities
255
- • **Test Gaps**: Untested critical paths, fragile tests (mock-heavy, timing-dependent), missing edge case coverage
256
- • **Maintainability**: Inconsistent naming conventions, missing types (any/unknown abuse), misleading comments, magic numbers/strings
257
-
258
- For each debt item provide:
259
- - id: D-{NNN}
260
- - dimension: code_quality|architecture|dependencies|test_gaps|maintainability
261
- - title: Short description
262
- - location: file:line or module path
263
- - severity: critical|high|medium|low
264
- - description: What's wrong and why it matters
265
- - suggested_fix: How to address it
266
-
267
- MODE: analysis
268
- CONTEXT: @**/*
269
- EXPECTED: JSON array of debt items with all fields populated, severity distribution, dimension summary
270
- CONSTRAINTS: Focus on ${scope === 'project' ? 'project-wide patterns' : 'target module and direct dependencies'}
271
- " --tool gemini --mode analysis --rule analysis-review-code-quality`,
272
- run_in_background: true
273
- })
274
- ```
275
-
276
- 3. **Build debt inventory** — parse CLI output, write `state.json.debt_items`:
277
-
278
- ```json
279
- [
280
- {
281
- "id": "D-001",
282
- "dimension": "architecture",
283
- "title": "Circular dependency between auth and user modules",
284
- "location": "src/auth/index.ts ↔ src/user/index.ts",
285
- "severity": "high",
286
- "description": "Bidirectional import creates tight coupling",
287
- "suggested_fix": "Extract shared types to common module",
288
- "impact": 0,
289
- "effort": 0,
290
- "priority_score": 0,
291
- "status": "discovered",
292
- "refactor_plan": null,
293
- "validation_result": null
294
- }
295
- ]
296
- ```
297
-
298
- Save CLI output to `.trace/discovery-cli.txt`.
299
-
300
- 4. **Append to reflection-log.md** (replace `## Phase 2: Debt Discovery` placeholder):
301
-
302
- ```markdown
303
- ## Phase 2: Debt Discovery - {timestamp}
304
-
305
- ### Scan Summary
306
- - **Total Items Found**: {N}
307
- - **By Dimension**: Code Quality ({N}), Architecture ({N}), Dependencies ({N}), Test Gaps ({N}), Maintainability ({N})
308
- - **By Severity**: Critical ({N}), High ({N}), Medium ({N}), Low ({N})
309
-
310
- ### Key Findings
311
- - {top finding 1 with location}
312
- - {top finding 2 with location}
313
- - {top finding 3 with location}
314
-
315
- ### Initial Assessment
316
- > **Observation**: {overall health assessment}
317
- > **Biggest Risk**: {highest severity pattern}
318
- > **Quick Wins**: {low-effort high-impact items}
319
- ```
320
-
321
- ---
322
-
323
- ### Phase 3: Assessment & Prioritization
324
-
325
- **Objective**: Score, prioritize, and build an execution queue.
326
-
327
- **Workflow Steps**:
328
-
329
- 1. **Score Each Debt Item**
330
-
331
- For each item, assign via CLI analysis or heuristics:
332
- - **Impact** (1-5): How much does this hurt? (5 = blocks development, causes bugs)
333
- - **Effort** (1-5): How hard to fix? (1 = trivial, 5 = major rewrite)
334
- - **Priority Score** = impact × (6 - effort) — favors high-impact low-effort items (e.g., impact=5 effort=1 → score=25; impact=2 effort=5 → score=2)
335
-
336
- 2. **Dependency-Aware Ordering**
337
-
338
- Some items must be refactored before others:
339
- - Extract shared types → then break circular dependency
340
- - Fix base class → then fix subclasses
341
-
342
- Build `state.json.queue` as an ordered array of item IDs.
343
-
344
- 3. **Interactive Prioritization** (skip in auto mode)
345
-
346
- ```javascript
347
- AskUserQuestion({
348
- questions: [{
349
- question: "技术债务优先级如何调整?",
350
- header: "Priorities",
351
- options: [
352
- { label: "确认优先级,开始重构", description: "按当前评分排序执行" },
353
- { label: "只处理 Critical/High", description: "跳过 Medium/Low 项,聚焦高优先级" },
354
- { label: "自定义选择", description: "手动选择要处理的债务项" },
355
- { label: "调整评分", description: "对某些项的 impact/effort 评分有不同意见" }
356
- ],
357
- multiSelect: false
358
- }]
359
- })
360
- ```
361
-
362
- 4. **Update state.json** — write `queue` and update items with scores:
363
-
364
- ```json
365
- {
366
- "queue": ["D-003", "D-001", "D-007", "D-002"],
367
- "phase": "prioritized"
368
- }
369
- ```
370
-
371
- 5. **Capture baseline metrics** — run tests + diagnostics before any changes:
372
-
373
- ```javascript
374
- // Run tests to get baseline pass count
375
- // Run mcp__ide__getDiagnostics for baseline error count
376
- // Save as state.json.baseline
377
- {
378
- "baseline": {
379
- "test_pass_rate": 100,
380
- "test_count": 42,
381
- "diagnostic_errors": 3,
382
- "diagnostic_warnings": 15,
383
- "timestamp": ""
384
- }
385
- }
386
- ```
387
-
388
- 6. **Append to reflection-log.md** (replace `## Phase 3: Prioritization` placeholder):
389
-
390
- ```markdown
391
- ## Phase 3: Prioritization - {timestamp}
392
-
393
- ### Priority Queue ({N} items)
394
- | Rank | ID | Title | Severity | Impact | Effort | Score |
395
- |------|----|-------|----------|--------|--------|-------|
396
- | 1 | D-003 | ... | critical | 5 | 2 | 20 |
397
- | 2 | D-001 | ... | high | 4 | 3 | 12 |
398
- | ... | ... | ... | ... | ... | ... | ... |
399
-
400
- ### Prioritization Decisions
401
- > **Decision**: {ordering rationale}
402
- > - **Dependency constraint**: {D-X must precede D-Y because...}
403
- > - **User adjustment**: {what was changed and why}
404
-
405
- ### Baseline Metrics
406
- - Tests: {pass_rate}% ({count} tests)
407
- - Diagnostics: {errors} errors, {warnings} warnings
408
- ```
409
-
410
- ---
411
-
412
- ### Phase 4: Iterative Refactoring Cycle
413
-
414
- **Objective**: Execute refactoring items one-by-one with per-item validation, reflection, and commit.
415
-
416
- **For each item in queue**:
417
-
418
- ```
419
- 1. Plan → Design specific refactoring approach
420
- 2. Refactor → @code-developer applies changes
421
- 3. Validate → Tests + diagnostics + quality check
422
- 4. Decision → PASS (commit + next) | PARTIAL (fix + retry) | FAIL (rollback + skip)
423
- 5. Reflect → Record outcome in reflection-log.md
424
- 6. Commit → Safe checkpoint
425
- ```
426
-
427
- **Max retries per item**: 3 (then skip with note)
428
-
429
- #### Step 4.1: Plan Refactoring
430
-
431
- For each item, generate a focused refactoring plan:
432
-
433
- ```javascript
434
- Bash({
435
- command: `ccw cli -p "
436
- PURPOSE: Design refactoring approach for debt item ${item.id}: ${item.title}
437
- Success: Specific, minimal changes that resolve the debt without regression
438
-
439
- DEBT ITEM:
440
- ${JSON.stringify(item, null, 2)}
441
-
442
- CODEBASE CONTEXT:
443
- ${JSON.stringify(state.exploration, null, 2)}
444
-
445
- TASK:
446
- • Analyze the specific code at ${item.location}
447
- • Design minimal refactoring approach (smallest change that fixes the debt)
448
- • List exact files and functions to modify
449
- • Identify regression risks and how to mitigate
450
- • Define validation criteria (how to know it worked)
451
-
452
- MODE: analysis
453
- CONTEXT: @**/*
454
- EXPECTED: Refactoring plan with: approach, modification_points [{file, function, change_description}], regression_risks, validation_criteria
455
- CONSTRAINTS: Minimal changes | No behavior change | Preserve backward compatibility
456
- " --tool gemini --mode analysis --rule development-refactor-codebase`,
457
- run_in_background: true
458
- })
459
- ```
460
-
461
- Save CLI output to `.trace/item-${N}-cli.txt`.
462
- Update `state.json.debt_items[item].refactor_plan` with parsed plan.
463
- Set `state.json.current_item` to item ID.
464
-
465
- #### Step 4.2: Execute Refactoring
466
-
467
- ```javascript
468
- Agent({
469
- subagent_type: "code-developer",
470
- run_in_background: false,
471
- description: `Refactor ${item.id}: ${item.title}`,
472
- prompt: `
473
- ## Task Objective
474
- Apply refactoring for debt item ${item.id}: ${item.title}
475
-
476
- ## MANDATORY FIRST STEPS
477
- 1. Read state.json: ${sessionFolder}/state.json — use current_item and its refactor_plan
478
- 2. Read the source files at the modification points
479
- 3. Understand the existing behavior before changing anything
480
-
481
- ## Refactoring Plan
482
- ${JSON.stringify(item.refactor_plan, null, 2)}
483
-
484
- ## Critical Rules
485
- - **No behavior change**: Refactoring must preserve existing functionality
486
- - **Minimal diff**: Only change what's necessary to resolve the debt
487
- - **Follow existing patterns**: Match naming, formatting, import style
488
- - **No new dependencies**: Don't introduce new libraries
489
- - **Backward compatible**: Preserve all public APIs and exports
490
-
491
- ## After Changes
492
- - Verify syntax: Run tsc --noEmit or equivalent
493
- - Check imports: Ensure no broken references
494
- `
495
- })
496
- ```
497
-
498
- #### Step 4.3: Validate
499
-
500
- ```javascript
501
- // 1. Run tests
502
- Agent({
503
- subagent_type: "test-fix-agent",
504
- run_in_background: false,
505
- description: `Validate refactoring: ${item.id}`,
506
- prompt: `
507
- ## Task Objective
508
- Validate that refactoring ${item.id} causes no regression.
509
-
510
- ## Validation Steps
511
- 1. Run full test suite — compare against baseline: ${state.baseline.test_pass_rate}% (${state.baseline.test_count} tests)
512
- 2. Check for new test failures (any failure not in baseline = regression)
513
- 3. Run syntax check (tsc --noEmit or equivalent)
514
-
515
- ## Output
516
- Update state.json field "debt_items[${item.id}].validation_result" with:
517
- {
518
- "tests_passed": true|false,
519
- "test_pass_rate": 0,
520
- "new_failures": [],
521
- "diagnostics_delta": { "errors": 0, "warnings": 0 },
522
- "regression_detected": false,
523
- "validation_criteria_met": true|false,
524
- "timestamp": ""
525
- }
526
- Save test output to: ${sessionFolder}/.trace/test-output.log
527
- `
528
- })
529
-
530
- // 2. Check diagnostics
531
- // mcp__ide__getDiagnostics — compare against baseline
532
- ```
533
-
534
- #### Step 4.4: Decision & Retry
535
-
536
- ```javascript
537
- const result = item.validation_result;
538
-
539
- if (result.tests_passed && !result.regression_detected && result.validation_criteria_met) {
540
- // PASS → commit, reflect, next item
541
- item.status = "completed";
542
- } else if (retryCount < 3) {
543
- // PARTIAL → analyze failure, fix, retry
544
- // Use @test-fix-agent to fix regression
545
- retryCount++;
546
- // Loop back to 4.2 with fix context
547
- } else {
548
- // FAIL → rollback, skip
549
- // git revert to last checkpoint
550
- item.status = "skipped";
551
- item.skip_reason = "Max retries reached, regression not resolved";
552
- }
553
- ```
554
-
555
- #### Step 4.5: Reflect
556
-
557
- Append to reflection-log.md `## Refactoring Timeline`:
558
-
559
- ```markdown
560
- ### Item {item.id}: {item.title} — {COMPLETED|SKIPPED} ({timestamp})
561
-
562
- **Changes**: {files modified}
563
- **Validation**: Tests {pass_rate}% | Diagnostics delta: {errors_delta} errors, {warnings_delta} warnings
564
- **Regression**: {none detected | description of regression}
565
-
566
- **What Changed**: {concrete description of refactoring}
567
- **What Broke** (if any): {regression details}
568
- **What We Learned**: {insight about this debt pattern}
569
- **Impact on Remaining Items**: {does this affect other queue items?}
570
- ```
571
-
572
- Update `## Cumulative Learnings` (replace, not append):
573
-
574
- ```markdown
575
- ## Cumulative Learnings (Updated: Item {item.id})
576
-
577
- ### Safe Patterns
578
- - {refactoring pattern that worked without regression}
579
-
580
- ### Risky Patterns
581
- - {pattern that caused regression — avoid or handle carefully}
582
-
583
- ### Dependency Insights
584
- - {discovered hidden dependencies during refactoring}
585
-
586
- ### Code Health Trend
587
- - Items completed: {N}/{total}
588
- - Regressions encountered: {N}
589
- - Test health: {baseline → current}
590
- ```
591
-
592
- #### Step 4.6: Commit
593
-
594
- ```bash
595
- git add <modified_files>
596
- git commit -m "refactor(${item.dimension}): ${item.title} [${item.id}]"
597
- ```
598
-
599
- Move to next item in queue.
600
-
601
- ---
602
-
603
- ### Phase 5: Completion
604
-
605
- **Objective**: Compare final metrics against baseline, finalize reflection log.
606
-
607
- **Workflow Steps**:
608
-
609
- 1. **Final Metrics Capture** — run tests + diagnostics again
610
-
611
- 2. **Update state.json** — write `summary`:
612
-
613
- ```json
614
- {
615
- "summary": {
616
- "result": "success|partial|incomplete",
617
- "items_completed": 0,
618
- "items_skipped": 0,
619
- "items_total": 0,
620
- "metrics_before": { "test_pass_rate": 0, "diagnostic_errors": 0, "diagnostic_warnings": 0 },
621
- "metrics_after": { "test_pass_rate": 0, "diagnostic_errors": 0, "diagnostic_warnings": 0 },
622
- "dimensions_addressed": { "code_quality": 0, "architecture": 0, "dependencies": 0, "test_gaps": 0, "maintainability": 0 },
623
- "regressions_encountered": 0,
624
- "key_learnings": [],
625
- "remaining_debt": [],
626
- "completed": "timestamp"
627
- },
628
- "phase": "completed"
629
- }
630
- ```
631
-
632
- 3. **Finalize reflection-log.md** — replace `## Conclusions` placeholder:
633
-
634
- ```markdown
635
- ## Conclusions - {timestamp}
636
-
637
- ### Result: {SUCCESS|PARTIAL|INCOMPLETE}
638
-
639
- ### Metrics Comparison
640
- | Metric | Before | After | Delta |
641
- |--------|--------|-------|-------|
642
- | Test Pass Rate | {X}% | {Y}% | {+/-Z}% |
643
- | Diagnostic Errors | {X} | {Y} | {+/-Z} |
644
- | Diagnostic Warnings | {X} | {Y} | {+/-Z} |
645
-
646
- ### Completed ({N}/{total})
647
- | ID | Title | Dimension |
648
- |----|-------|-----------|
649
- | D-001 | ... | architecture |
650
- | ... | ... | ... |
651
-
652
- ### Skipped ({N})
653
- | ID | Title | Reason |
654
- |----|-------|--------|
655
- | D-005 | ... | Regression not resolvable in 3 retries |
656
-
657
- ### Remaining Debt
658
- - {items not in queue or deferred}
659
-
660
- ### Key Insights
661
- - {insight about codebase health}
662
- - {pattern for future refactoring}
663
-
664
- ### Recommendations
665
- - {what to address next}
666
- - {process improvement}
667
- ```
668
-
669
- 4. **Post-Completion Options** (AskUserQuestion)
670
-
671
- ```javascript
672
- AskUserQuestion({
673
- questions: [{
674
- question: "重构完成,下一步?",
675
- header: "Next Steps",
676
- options: [
677
- { label: "创建Issue", description: "将剩余债务/跳过项创建为Issue跟踪" },
678
- { label: "继续处理", description: "处理跳过项或剩余低优先级债务" },
679
- { label: "生成报告", description: "导出完整的技术债务报告" },
680
- { label: "完成", description: "无需进一步操作" }
681
- ],
682
- multiSelect: false
683
- }]
684
- })
685
- ```
686
-
687
- ---
688
-
689
- ## Debt Dimensions Reference
690
-
691
- | Dimension | What to Scan | Severity Signals |
692
- |-----------|-------------|------------------|
693
- | **Code Quality** | Cyclomatic complexity >10, duplication >20 lines, dead code, long files >500 lines, deep nesting >4 | Critical: dead code in critical path; High: >15 complexity |
694
- | **Architecture** | Coupling >5 imports from one module, layering violations, god classes >300 lines, missing abstractions | Critical: circular dependency in core; High: layering violation |
695
- | **Dependencies** | Circular imports, unused deps, outdated with CVEs, version conflicts | Critical: known CVE; High: circular in core modules |
696
- | **Test Gaps** | Untested critical paths, fragile tests, missing edge cases, mock leakage | Critical: no tests for auth/payment; High: flaky CI tests |
697
- | **Maintainability** | `any`/`@ts-ignore` abuse, magic numbers, misleading names, missing types | High: >10 suppressions in one file; Medium: inconsistent naming |
698
-
699
- ---
700
-
701
- ## state.json Full Schema
702
-
703
- ```json
704
- {
705
- "session_id": "RFT-xxx",
706
- "target": "description",
707
- "scope": "module|project",
708
- "started": "timestamp",
709
- "phase": "init|explored|prioritized|refactoring|completed",
710
-
711
- "exploration": {
712
- "structure": { "files": [], "modules": [], "total_loc": 0 },
713
- "metrics": { "largest_files": [], "most_complex": [], "deepest_nesting": [] },
714
- "dependency_issues": { "circular": [], "unused_imports": [], "outdated_deps": [] },
715
- "test_mapping": { "tested": [], "untested": [], "coverage_estimate": "" },
716
- "pattern_violations": { "suppressions": [], "todos": [], "inconsistencies": [] },
717
- "_metadata": { "files_analyzed": 0, "timestamp": "" }
718
- },
719
-
720
- "debt_items": [{
721
- "id": "D-001",
722
- "dimension": "architecture",
723
- "title": "",
724
- "location": "",
725
- "severity": "critical|high|medium|low",
726
- "description": "",
727
- "suggested_fix": "",
728
- "impact": 0,
729
- "effort": 0,
730
- "priority_score": 0,
731
- "status": "discovered|queued|in_progress|completed|skipped",
732
- "refactor_plan": { "approach": "", "modification_points": [], "regression_risks": [], "validation_criteria": [] },
733
- "validation_result": { "tests_passed": false, "regression_detected": false, "diagnostics_delta": {} },
734
- "skip_reason": null
735
- }],
736
-
737
- "queue": [],
738
- "current_item": null,
739
- "completed_items": [],
740
- "skipped_items": [],
741
-
742
- "baseline": {
743
- "test_pass_rate": 0,
744
- "test_count": 0,
745
- "diagnostic_errors": 0,
746
- "diagnostic_warnings": 0,
747
- "timestamp": ""
748
- },
749
-
750
- "summary": {
751
- "result": "success|partial|incomplete",
752
- "items_completed": 0,
753
- "items_skipped": 0,
754
- "items_total": 0,
755
- "metrics_before": {},
756
- "metrics_after": {},
757
- "dimensions_addressed": {},
758
- "regressions_encountered": 0,
759
- "key_learnings": [],
760
- "remaining_debt": [],
761
- "completed": ""
762
- }
763
- }
764
- ```
765
-
766
- ---
767
-
768
- ## Error Handling
769
-
770
- | Scenario | Action |
771
- |----------|--------|
772
- | cli-explore-agent fails | Fallback to Grep/Glob manual scan |
773
- | CLI analysis timeout | Fallback: Gemini → Qwen → Codex |
774
- | Test suite crashes | Log error, retry with minimal test subset |
775
- | Regression in refactoring | Retry up to 3 times, then rollback + skip |
776
- | All items skipped | Generate failure report, recommend manual review |
777
- | Circular dependency in queue | Detect in Phase 3, break cycle with extraction item |
778
- | Diagnostics unavailable | Skip diagnostics check, rely on tests only |
779
-
780
- **CLI Fallback Chain**: Gemini → Qwen → Codex
781
-
782
- ---
783
-
784
- ## Commit Strategy
785
-
786
- 1. **Before refactoring starts** (Phase 3 baseline):
787
- ```bash
788
- git stash # Save any uncommitted work
789
- ```
790
-
791
- 2. **After each completed item**:
792
- ```bash
793
- git add <modified_files>
794
- git commit -m "refactor(${dimension}): ${title} [${id}]"
795
- ```
796
-
797
- 3. **On regression (rollback)**:
798
- ```bash
799
- git checkout -- <modified_files> # Discard changes for this item
800
- ```
801
-
802
- 4. **Final completion commit**:
803
- ```bash
804
- git add ${sessionFolder}/reflection-log.md ${sessionFolder}/state.json
805
- git commit -m "refactor: complete tech debt cycle ${sessionId} (${completed}/${total} items)"
806
- ```
807
-
808
- ---
809
-
810
- ## Best Practices
811
-
812
- 1. **Start with module scope**: Project-wide scans produce too many items; focus on one module first
813
- 2. **Trust prioritization**: Impact × effort scoring avoids analysis paralysis
814
- 3. **One item at a time**: Each refactoring is isolated, validated, and committed
815
- 4. **Rollback is not failure**: Skipping a risky item is better than introducing regression
816
- 5. **Review reflection-log.md**: Cumulative learnings help future refactoring sessions
817
- 6. **Auto mode for cleanup**: Use `-y` for straightforward tech debt (naming, dead code)
818
- 7. **Interactive for architecture**: Complex architectural refactoring benefits from user input at prioritization
819
-
820
- ---
821
-
822
- ## Usage Recommendations
823
-
824
- **Use this command when:**
825
- - Systematic tech debt cleanup needed for a module
826
- - Pre-refactoring analysis and prioritization required
827
- - Need regression-safe iterative refactoring with rollback
828
- - Want documented reasoning for each refactoring decision
829
-
830
- **Use `workflow-lite-plan` skill when:**
831
- - Single specific bug or issue to fix
832
- - No systematic debt analysis needed
833
-
834
- **Use `workflow-plan` skill + `workflow-execute` skill when:**
835
- - New feature implementation (not refactoring)
836
- - Already know exactly what to change
837
-
838
- **Use `/workflow:integration-test-cycle` when:**
839
- - Need integration tests before/after refactoring
840
- - Want to verify cross-module behavior post-refactoring
841
-
842
- ---
843
-
844
- ## Post-Completion Expansion
845
-
846
- **Auto-sync**: 执行 `/workflow:session:sync -y "{summary}"` 更新 specs/*.md + project-tech。
847
-
848
- 完成后询问用户是否扩展为issue(test/enhance/refactor/doc),选中项调用 `/issue:new "{summary} - {dimension}"`
849
-
850
- ---
851
-
852
- **Now execute refactor-cycle for**: $ARGUMENTS