prizmkit 1.1.79 → 1.1.81

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 (110) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/scripts/init-pipeline.py +2 -0
  3. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +2 -0
  4. package/bundled/skills/_metadata.json +1 -1
  5. package/bundled/skills/app-planner/SKILL.md +12 -356
  6. package/bundled/skills/app-planner/references/infrastructure-convention-discovery.md +108 -0
  7. package/bundled/skills/app-planner/references/project-conventions-discovery.md +59 -0
  8. package/bundled/skills/app-planner/references/project-state-detection.md +88 -0
  9. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +10 -0
  10. package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +9 -0
  11. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +10 -0
  12. package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +17 -0
  13. package/bundled/skills/app-planner/references/rules/frontend/template.md +19 -0
  14. package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +10 -0
  15. package/bundled/skills/app-planner/references/rules-configuration.md +46 -0
  16. package/bundled/skills/bug-fix-workflow/SKILL.md +18 -54
  17. package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +41 -0
  18. package/bundled/skills/bug-planner/SKILL.md +20 -12
  19. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +9 -108
  20. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +98 -0
  21. package/bundled/skills/feature-pipeline-launcher/SKILL.md +20 -103
  22. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +81 -0
  23. package/bundled/skills/feature-planner/SKILL.md +5 -9
  24. package/bundled/skills/feature-workflow/SKILL.md +27 -184
  25. package/bundled/skills/feature-workflow/references/brainstorm-guide.md +137 -0
  26. package/bundled/skills/prizm-kit/SKILL.md +14 -2
  27. package/bundled/skills/prizmkit-code-review/SKILL.md +67 -136
  28. package/bundled/skills/prizmkit-code-review/references/dev-agent-prompt.md +30 -0
  29. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +31 -0
  30. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +62 -0
  31. package/bundled/skills/prizmkit-code-review/scripts/check_loop.py +186 -0
  32. package/bundled/skills/prizmkit-committer/SKILL.md +8 -0
  33. package/bundled/skills/prizmkit-deploy/SKILL.md +49 -73
  34. package/bundled/skills/prizmkit-deploy/references/data-safety-examples.md +120 -0
  35. package/bundled/skills/prizmkit-deploy/references/ssh-bootstrap-flow.md +49 -0
  36. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +41 -0
  37. package/bundled/skills/prizmkit-deploy/references/ssh-takeover.md +20 -0
  38. package/bundled/skills/prizmkit-implement/SKILL.md +7 -1
  39. package/bundled/skills/prizmkit-plan/SKILL.md +1 -83
  40. package/bundled/skills/prizmkit-plan/references/examples.md +85 -0
  41. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +14 -0
  42. package/bundled/skills/prizmkit-retrospective/SKILL.md +1 -1
  43. package/bundled/skills/prizmkit-test/SKILL.md +3 -151
  44. package/bundled/skills/prizmkit-test/references/examples.md +70 -0
  45. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +49 -0
  46. package/bundled/skills/prizmkit-test/references/test-report-template.md +42 -0
  47. package/bundled/skills/recovery-workflow/SKILL.md +24 -103
  48. package/bundled/skills/recovery-workflow/references/detection.md +58 -0
  49. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +9 -96
  50. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +88 -0
  51. package/bundled/skills/refactor-planner/SKILL.md +15 -157
  52. package/bundled/skills/refactor-planner/references/fast-path.md +59 -0
  53. package/bundled/skills/refactor-planner/references/planning-phases.md +135 -0
  54. package/bundled/skills/refactor-workflow/SKILL.md +18 -178
  55. package/bundled/skills/refactor-workflow/references/brainstorm-guide.md +116 -0
  56. package/bundled/skills-windows/app-planner/SKILL.md +12 -358
  57. package/bundled/skills-windows/app-planner/references/infrastructure-convention-discovery.md +108 -0
  58. package/bundled/skills-windows/app-planner/references/project-conventions-discovery.md +59 -0
  59. package/bundled/skills-windows/app-planner/references/project-state-detection.md +90 -0
  60. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +10 -0
  61. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +9 -0
  62. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +10 -0
  63. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +17 -0
  64. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +19 -0
  65. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +10 -0
  66. package/bundled/skills-windows/app-planner/references/rules-configuration.md +46 -0
  67. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +18 -54
  68. package/bundled/skills-windows/bug-fix-workflow/references/bug-diagnosis.md +41 -0
  69. package/bundled/skills-windows/bug-planner/SKILL.md +20 -12
  70. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +6 -91
  71. package/bundled/skills-windows/bugfix-pipeline-launcher/references/configuration.md +94 -0
  72. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +19 -88
  73. package/bundled/skills-windows/feature-pipeline-launcher/references/configuration.md +77 -0
  74. package/bundled/skills-windows/feature-planner/SKILL.md +5 -9
  75. package/bundled/skills-windows/feature-workflow/SKILL.md +27 -184
  76. package/bundled/skills-windows/feature-workflow/references/brainstorm-guide.md +137 -0
  77. package/bundled/skills-windows/prizm-kit/SKILL.md +14 -2
  78. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +67 -136
  79. package/bundled/skills-windows/prizmkit-code-review/references/dev-agent-prompt.md +30 -0
  80. package/bundled/skills-windows/prizmkit-code-review/references/review-report-template.md +31 -0
  81. package/bundled/skills-windows/prizmkit-code-review/references/reviewer-agent-prompt.md +62 -0
  82. package/bundled/skills-windows/prizmkit-code-review/scripts/check_loop.py +186 -0
  83. package/bundled/skills-windows/prizmkit-committer/SKILL.md +8 -0
  84. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +50 -74
  85. package/bundled/skills-windows/prizmkit-deploy/references/data-safety-examples.md +120 -0
  86. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +3 -3
  87. package/bundled/skills-windows/prizmkit-deploy/references/ssh-bootstrap-flow.md +49 -0
  88. package/bundled/skills-windows/prizmkit-deploy/references/ssh-execution-flow.md +41 -0
  89. package/bundled/skills-windows/prizmkit-deploy/references/ssh-takeover.md +20 -0
  90. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +2 -2
  91. package/bundled/skills-windows/prizmkit-implement/SKILL.md +7 -1
  92. package/bundled/skills-windows/prizmkit-plan/SKILL.md +1 -83
  93. package/bundled/skills-windows/prizmkit-plan/references/examples.md +85 -0
  94. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +14 -0
  95. package/bundled/skills-windows/prizmkit-retrospective/SKILL.md +1 -1
  96. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +1 -1
  97. package/bundled/skills-windows/prizmkit-test/SKILL.md +3 -151
  98. package/bundled/skills-windows/prizmkit-test/references/examples.md +70 -0
  99. package/bundled/skills-windows/prizmkit-test/references/test-generation-steps.md +49 -0
  100. package/bundled/skills-windows/prizmkit-test/references/test-report-template.md +42 -0
  101. package/bundled/skills-windows/recovery-workflow/SKILL.md +24 -125
  102. package/bundled/skills-windows/recovery-workflow/references/detection.md +58 -0
  103. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +8 -77
  104. package/bundled/skills-windows/refactor-pipeline-launcher/references/configuration.md +82 -0
  105. package/bundled/skills-windows/refactor-planner/SKILL.md +15 -157
  106. package/bundled/skills-windows/refactor-planner/references/fast-path.md +59 -0
  107. package/bundled/skills-windows/refactor-planner/references/planning-phases.md +135 -0
  108. package/bundled/skills-windows/refactor-workflow/SKILL.md +18 -178
  109. package/bundled/skills-windows/refactor-workflow/references/brainstorm-guide.md +116 -0
  110. package/package.json +1 -1
@@ -0,0 +1,135 @@
1
+ # Planning Phases — Refactor Planner
2
+
3
+ Detailed procedures for Phases 4-6 of the refactor-planner interactive workflow, plus refactoring-specific assessment rules and browser verification guidance.
4
+
5
+ ---
6
+
7
+ ## Phase 4: Item Decomposition Procedure
8
+
9
+ Read `${SKILL_DIR}/assets/planning-guide.md` for decomposition patterns and dependency ordering rules.
10
+
11
+ For each refactoring goal:
12
+ 1. Identify atomic refactoring operations
13
+ 2. Determine inter-item dependencies (safe renames first, structural changes later)
14
+ 3. Assess complexity per item (file count, cross-module scope, test coverage)
15
+ 4. Assign behavior preservation strategy per item (read `${SKILL_DIR}/references/behavior-preservation.md`)
16
+
17
+ ---
18
+
19
+ ## Phase 5: Per-Item Confirmation Loop
20
+
21
+ For each item, display:
22
+
23
+ ```
24
+ Refactor Item R-001:
25
+ Title: [title]
26
+ Type: [extract/rename/restructure/simplify/decouple/migrate]
27
+ Scope: [files list]
28
+ Priority: [critical/high/medium/low]
29
+ Complexity: [low/medium/high]
30
+ Behavior Preservation: [test-gate/snapshot/manual]
31
+ Acceptance Criteria:
32
+ - [criterion 1]
33
+ - [criterion 2]
34
+ Dependencies: [none / R-002, R-003]
35
+
36
+ Confirm? (Y/modify/skip)
37
+ ```
38
+
39
+ - **Y**: Accept item as-is
40
+ - **modify**: User provides changes, update item, re-display for confirmation
41
+ - **skip**: Remove item from the list
42
+
43
+ Continue until all items are confirmed or skipped.
44
+
45
+ ---
46
+
47
+ ## Phase 6: Completeness Review Checklist
48
+
49
+ 1. **Dependency ordering check**: Verify items form a valid DAG (no cycles). Items should be ordered: safe renames -> extract/inline -> structural changes -> migrations
50
+ 2. **Behavior preservation check**: Every item must have a declared preservation strategy. Flag any item with `manual` strategy and no test coverage.
51
+ 3. **Gap detection**: Are there intermediate steps needed between items? Does item A's output match item B's input assumption?
52
+ 4. **Cross-module impact**: Do any items affect modules outside the declared scope?
53
+ 5. **Headless Execution Readiness**: The refactor pipeline runs each item through an autonomous AI session with NO human interaction. For each item, verify:
54
+ - **Scope clarity**: Are all affected files explicitly listed? The AI must know exactly where to look.
55
+ - **Refactoring instructions**: Is the description specific enough to execute without ambiguity?
56
+ - ❌ "Clean up the utils module" — what exactly should change?
57
+ - ✅ "Extract validation functions (validateEmail, validatePhone, validateUrl) from src/utils/helpers.ts into src/utils/validation.ts. Update all 12 import sites. Preserve existing function signatures."
58
+ - **Behavior preservation**: Is it clear what tests to run and what behavior must be preserved?
59
+ - **Dependency context**: If item depends on earlier refactors, does the description reference what changed?
60
+
61
+ ### Review Summary Table Format
62
+
63
+ Present review summary:
64
+
65
+ ```
66
+ Item | Deps Valid | Preservation | Gaps | Status
67
+ R-001 | OK | test-gate | - | Ready
68
+ R-002 | OK | test-gate | - | Ready
69
+ R-003 | OK | manual | No test coverage| Needs attention
70
+ R-004 | OK | snapshot | - | Ready
71
+ ```
72
+
73
+ If issues found, discuss with user and resolve before proceeding.
74
+
75
+ ---
76
+
77
+ ## Behavior Preservation Check
78
+
79
+ Every item MUST declare a behavior preservation strategy. Read `${SKILL_DIR}/references/behavior-preservation.md` for strategy details.
80
+
81
+ | Strategy | When to Use |
82
+ |----------|-------------|
83
+ | `test-gate` | Target area has good test coverage. Run full test suite after each change. |
84
+ | `snapshot` | Compare output/state before and after. Used when tests are insufficient but behavior is observable. |
85
+ | `manual` | Human verification required. Last resort when neither tests nor snapshots are feasible. |
86
+
87
+ Flag items using `manual` strategy prominently — they carry the highest risk of behavior regression.
88
+
89
+ ---
90
+
91
+ ## Dependency Ordering
92
+
93
+ Auto-detect inter-item dependencies and enforce safe ordering:
94
+ 1. **Safe renames** first (lowest risk, no structural change)
95
+ 2. **Extract/inline** operations (moderate risk, changes module boundaries)
96
+ 3. **Structural changes** (higher risk, reorganizes architecture)
97
+ 4. **Migrations** last (highest risk, changes patterns/paradigms)
98
+
99
+ ---
100
+
101
+ ## Complexity Assessment
102
+
103
+ Assess each item's complexity based on:
104
+ - **File count**: 1-2 files = low, 3-5 files = medium, 6+ files = high
105
+ - **Cross-module scope**: same module = low, 2 modules = medium, 3+ modules = high
106
+ - **Test coverage**: high coverage = reduces complexity, low coverage = increases complexity
107
+ - **Pattern familiarity**: well-known pattern = low, novel restructuring = high
108
+
109
+ Take the highest of these individual assessments as the item's complexity.
110
+
111
+ ---
112
+
113
+ ## Browser Verification
114
+
115
+ **Browser verification is a feature-pipeline capability only.** Refactors use `behavior_preservation` strategy instead to ensure no external behavior changes:
116
+
117
+ - `strategy: test-gate` — Rely on existing test suite. Pipeline runs tests before and after refactoring.
118
+ - `strategy: snapshot` — Compare behavior before/after refactoring using executable snapshots (outputs, API responses, side effects)
119
+ - `strategy: manual` — Require human verification that behavior is preserved
120
+
121
+ For refactors that modify UI code (e.g., component restructuring), the test-gate or snapshot strategy ensures visual appearance is preserved. You can optionally note browser verification needs in your description or acceptance criteria:
122
+
123
+ Example:
124
+ ```
125
+ Refactor Title: Extract UserProfile component from AccountSettings
126
+ Type: extract
127
+ Strategy: snapshot
128
+ Acceptance Criteria:
129
+ 1. UserProfile component renders identically to inline version (compare snapshots)
130
+ 2. All props are correctly forwarded (unit tests pass)
131
+ 3. No visual regression (screenshot comparison)
132
+ 4. Component is reusable in other views
133
+ ```
134
+
135
+ The refactor pipeline AI will use the snapshot strategy to verify external behavior is preserved during refactoring.
@@ -26,39 +26,12 @@ User says:
26
26
 
27
27
  ## Overview
28
28
 
29
- ```
30
- refactor-workflow <target / goals>
31
-
32
- ├── Phase 1: Brainstorm → clarify type → collect materials → parallel deep read → discuss plan
33
-
34
- ├── Phase 2: Plan → refactor-planner → .prizmkit/plans/refactor-list.json
35
-
36
- ├── Phase 3: Launch → refactor-pipeline-launcher → pipeline execution
37
-
38
- └── Phase 4: Monitor → track progress → report results
39
- ```
40
-
41
- ### What This Skill Does
42
-
43
- | Phase | Action | Result |
44
- |-------|--------|--------|
45
- | 1 | **Brainstorm** — clarify type, collect reference materials, parallel deep read code & docs, discuss plan grounded in real code | Fully clarified refactoring goals |
46
- | 2 | Call `refactor-planner` with clarified goals | `.prizmkit/plans/refactor-list.json` with N refactor items |
47
- | 3 | Call `refactor-pipeline-launcher` | Pipeline started (execution mode chosen by user via launcher) |
48
- | 4 | Monitor progress | Status updates, completion report |
49
-
50
- ### Why This Skill Exists
51
-
52
- Without this skill, users must:
53
- 1. Figure out all refactoring goals and scope themselves
54
- 2. Invoke `refactor-planner` → wait for .prizmkit/plans/refactor-list.json
55
- 3. Invoke `refactor-pipeline-launcher` → wait for pipeline start
56
- 4. Manually check progress
29
+ Four phases take a rough refactoring idea to verified, behavior-preserving code so the user doesn't have to manually chain planner → launcher → monitoring:
57
30
 
58
- With this skill, users can:
59
- 1. Say "Refactor the auth module to extract shared middleware" with a rough idea
60
- 2. The skill brainstorms to fill in all gaps (scope, risks, behavior contracts)
61
- 3. All planning + execution happens automatically
31
+ 1. **Brainstorm** — clarify type, collect reference materials, parallel deep read code & docs, discuss plan grounded in real code → fully clarified refactoring goals
32
+ 2. **Plan** call `refactor-planner` `.prizmkit/plans/refactor-list.json` with N refactor items
33
+ 3. **Launch** call `refactor-pipeline-launcher` pipeline started (execution mode chosen by user via launcher)
34
+ 4. **Monitor** track progress status updates, completion report
62
35
 
63
36
  ### Branch Management
64
37
 
@@ -80,21 +53,9 @@ Natural language description of the refactoring goals. Can be:
80
53
 
81
54
  Flow: brainstorm → refactor-planner → refactor-pipeline-launcher → monitor
82
55
 
83
- **Mode B: From existing .prizmkit/plans/refactor-list.json**
56
+ **Mode B: From existing `.prizmkit/plans/refactor-list.json`** — user says "run pipeline from existing file", or the file already exists. Skip ahead per the [Resume table](#resume--interruption-recovery).
84
57
 
85
- When user says "run pipeline from existing file" or .prizmkit/plans/refactor-list.json already exists:
86
- - Skip brainstorm and `refactor-planner` (file already exists)
87
- - Invoke `refactor-pipeline-launcher` directly
88
- - Monitor and report progress
89
-
90
- **Mode C: Incremental (add to existing refactor plan)**
91
-
92
- When user says "add more refactors" or the project already has a .prizmkit/plans/refactor-list.json:
93
- - Brainstorm new refactoring goals with the user
94
- - Invoke `refactor-planner` in incremental mode (reads existing .prizmkit/plans/refactor-list.json)
95
- - Append new refactor items to existing list
96
- - Invoke `refactor-pipeline-launcher`
97
- - Monitor and report progress
58
+ **Mode C: Incremental (add to existing refactor plan)** — user says "add more refactors". Brainstorm new goals, then invoke `refactor-planner` in incremental mode (appends to existing list) launch → monitor.
98
59
 
99
60
  ---
100
61
 
@@ -139,59 +100,11 @@ Record everything the user provides — these become inputs for Step 1.3.
139
100
 
140
101
  ### Step 1.3: Parallel Deep Reading
141
102
 
142
- **Goal**: Build comprehensive understanding of the target code and context before discussing plans. Spawn multiple agents in parallel to read all relevant materials simultaneously.
143
-
144
- **Parallel reading tasks** (launch concurrently):
145
-
146
- | Agent | What to read | Purpose |
147
- |-------|-------------|---------|
148
- | Agent A | User-provided code paths — read full source files | Understand current structure, interfaces, dependencies |
149
- | Agent B | User-provided documents — design docs, proposals, wiki pages | Understand intended direction and constraints |
150
- | Agent C | `.prizmkit/prizm-docs/` for affected modules — L1/L2 docs, TRAPS, RULES | Understand existing architecture knowledge and known pitfalls |
151
- | Agent D | Test files for the target area — find and read existing tests | Understand current test coverage and behavior contracts |
152
-
153
- **Also gather** (can be included in any agent's task):
154
- - `.prizmkit/config.json` → tech stack preferences
155
- - Directory structure of the target area
156
- - Dependency relationships (imports/exports between target and other modules)
157
-
158
- **After all agents complete**: Synthesize findings into a coherent understanding before proceeding to discussion.
103
+ Read `${SKILL_DIR}/references/brainstorm-guide.md` §Step 1.3 for the parallel agent dispatch procedure spawn 4 agents (A: code paths, B: documents, C: prizm-docs, D: test files) to build comprehensive understanding before discussion. Synthesize findings before proceeding.
159
104
 
160
105
  ### Step 1.4: Discuss Refactoring Plan
161
106
 
162
- **Now** with deep knowledge of the actual code and documents discuss the refactoring plan with the user. This discussion is grounded in real code, not abstract questions.
163
-
164
- Present what you learned from the parallel reading:
165
- - Current code structure and its problems (with specific file/function references)
166
- - Existing test coverage status (which areas are safe, which are risky)
167
- - Known TRAPS and pitfalls from `.prizmkit/prizm-docs/`
168
- - Dependencies and potential impact on other modules
169
-
170
- Then ask targeted questions based on what you read. **Adapt question depth to the refactoring complexity** — a simple extract-method refactor needs fewer questions than a full module decomposition.
171
-
172
- **Code Structure:**
173
- - "I see the current structure does X — is the target state Y, or something different?"
174
- - What's the target state? What should the code look like after refactoring?
175
- - Are there specific code smells you've noticed? (duplication, deep nesting, god classes, tight coupling)
176
-
177
- **Scope:**
178
- - Based on the code I read, these modules are affected: [list]. Anything else in/out of scope?
179
- - For incremental refactoring: what's the order of priority?
180
-
181
- **Behavior Preservation:**
182
- - "These public APIs/interfaces exist: [list]. Which must remain unchanged?"
183
- - "I found these tests: [list]. Are they passing currently?"
184
- - Any undocumented behavior that callers depend on?
185
-
186
- **Risk Assessment:**
187
- - "I found these TRAPS in .prizmkit/prizm-docs/: [list]. Any other known gotchas?"
188
- - Does this code have external consumers (other teams, published APIs)?
189
- - Any concurrent development happening in the target area?
190
-
191
- **Constraints:**
192
- - Timeline or urgency? (affects whether to do incremental vs comprehensive)
193
- - Team coordination needed? (other developers working in the same area)
194
- - Deployment concerns? (feature flags, backward compatibility, migration)
107
+ Read `${SKILL_DIR}/references/brainstorm-guide.md` §Step 1.4 for the full discussion framework — code structure, scope, behavior preservation, risk assessment, and constraints. Present what was learned from parallel reading, then ask targeted questions grounded in real code. **Adapt question depth to the refactoring complexity.**
195
108
 
196
109
  ### Step 1.5: Confirm and Supplement
197
110
 
@@ -202,62 +115,11 @@ After the discussion:
202
115
  3. **Identify gaps** — if any areas are still unclear, list them explicitly and ask follow-up questions
203
116
  4. **Repeat** until the user confirms: "That covers everything" or "Let's proceed"
204
117
 
205
- **Signs that brainstorming is complete:**
206
- - All refactoring goals have concrete target state descriptions
207
- - Scope boundaries are clearly defined (in/out)
208
- - Behavior preservation contracts are identified
209
- - Risk areas are acknowledged and mitigation is discussed
210
- - The user has confirmed the summary is accurate
211
-
212
- **Signs that more questions are needed:**
213
- - User's answers contain vague terms ("clean it up", "make it better", "fix the structure")
214
- - Scope is undefined ("refactor everything" without specifics)
215
- - No awareness of test coverage for the target area
216
- - Risk areas are handwaved ("it should be fine")
217
- - User says "I'm not sure" — help them think through it with concrete options
118
+ Read `${SKILL_DIR}/references/brainstorm-guide.md` §Completion Signs for the full checklist of when brainstorming is complete vs when more questions are needed.
218
119
 
219
120
  ### Step 1.6: Requirements Summary
220
121
 
221
- Once brainstorming is complete, produce a structured goals summary:
222
-
223
- ```markdown
224
- ## Refactoring Goals Summary
225
-
226
- ### Target: [Module/area name]
227
-
228
- ### Refactoring Type: [Incremental / Comprehensive / Targeted]
229
-
230
- ### Refactoring Objectives
231
- - [Bullet list of what structural changes are needed and why]
232
-
233
- ### Current Problems
234
- - [What's wrong with the current structure — with specific code references]
235
-
236
- ### Target State
237
- - [What the code should look like after refactoring]
238
-
239
- ### Scope
240
- - **In scope**: [files, modules, directories]
241
- - **Out of scope**: [explicitly excluded areas]
242
-
243
- ### Behavior Preservation Contracts
244
- - [What behavior must remain unchanged]
245
- - [Key APIs/interfaces that must be preserved]
246
- - [Existing test coverage status]
247
-
248
- ### Risk Assessment
249
- - [Risk]: [Mitigation strategy]
250
-
251
- ### Reference Materials Reviewed
252
- - [List of code paths, documents, .prizmkit/prizm-docs/ files that were read]
253
-
254
- ### Constraints
255
- - [Timeline, coordination, deployment concerns]
256
-
257
- ### Confirmed by user: ✓
258
- ```
259
-
260
- Present this summary to the user and get explicit confirmation before proceeding.
122
+ Once brainstorming is complete, produce a structured goals summary. Read `${SKILL_DIR}/references/brainstorm-guide.md` §Refactoring Goals Summary Template for the structured output format. Present the summary to the user and get explicit confirmation before proceeding.
261
123
 
262
124
  **CHECKPOINT CP-RW-0**: Refactoring goals fully clarified and confirmed by user.
263
125
 
@@ -275,28 +137,6 @@ After confirming refactoring goals, assess whether this refactor needs the full
275
137
  - Existing tests fully cover the affected code paths
276
138
  - No risk of behavior change
277
139
 
278
- **User choice required (mandatory)** — Use `AskUserQuestion` to present interactive selectable options:
279
-
280
- ```
281
- AskUserQuestion:
282
- question: "This refactoring appears straightforward. How would you like to proceed?"
283
- header: "Approach"
284
- options:
285
- - label: "Refactor now (fast path)"
286
- description: "Plan and refactor directly in this session using /prizmkit-plan + /prizmkit-implement"
287
- - label: "Add to refactor list (pipeline)"
288
- description: "Generate .prizmkit/plans/refactor-list.json via refactor-planner, then launch pipeline for autonomous execution"
289
- ```
290
-
291
- - **Refactor now** → Fast Path Workflow:
292
- 1. Invoke `/prizmkit-plan` with the refactoring goals → generates `spec.md` + `plan.md`
293
- 2. Invoke `/prizmkit-implement` to execute the plan (behavior preservation verified by tests)
294
- 3. After implementation, run `/prizmkit-code-review` for quality check
295
- 4. Commit via `/prizmkit-committer` with `refactor(<scope>):` prefix
296
- 5. Run `/prizmkit-retrospective` to sync `.prizmkit/prizm-docs/`
297
- 6. **End workflow** — skip Phase 2/3/4
298
- - **Add to refactor list** → Continue to Phase 2 (Plan via pipeline)
299
-
300
140
  **Complex refactor → Planning Path** (ANY is true):
301
141
  - Cross-module impact (>2 modules affected)
302
142
  - Public API or interface changes required
@@ -305,21 +145,21 @@ AskUserQuestion:
305
145
  - Insufficient test coverage in target area (risk of hidden behavior changes)
306
146
  - Requires coordination with other ongoing work
307
147
 
308
- **User choice required (mandatory)** — Use `AskUserQuestion` to present interactive selectable options:
148
+ **User choice required (mandatory)** — Use `AskUserQuestion` to present interactive selectable options. Tailor the question text to the assessment ("This refactoring appears straightforward…" for simple, "This refactoring is complex and will benefit from structured planning…" for complex), but the two options are always the same:
309
149
 
310
150
  ```
311
151
  AskUserQuestion:
312
- question: "This refactoring is complex and will benefit from structured planning. How would you like to proceed?"
152
+ question: <tailored to simple vs complex assessment>
313
153
  header: "Approach"
314
154
  options:
315
- - label: "Plan and refactor now"
316
- description: "Create a plan and refactor in this session using /prizmkit-plan + /prizmkit-implement"
155
+ - label: "Refactor now (fast path)"
156
+ description: "Plan and refactor directly in this session using /prizmkit-plan + /prizmkit-implement"
317
157
  - label: "Add to refactor list (pipeline)"
318
158
  description: "Generate .prizmkit/plans/refactor-list.json via refactor-planner, then launch pipeline for autonomous execution"
319
159
  ```
320
160
 
321
- - **Plan and refactor now** → Invoke `/prizmkit-plan` with goals → `/prizmkit-implement` → `/prizmkit-code-review` → `/prizmkit-committer` → `/prizmkit-retrospective`. **End workflow** — skip Phase 2/3/4.
322
- - **Add to refactor list** → Continue to Phase 2 (Plan via pipeline)
161
+ - **Refactor now** → Fast Path: `/prizmkit-plan` (goals → `spec.md` + `plan.md`) → `/prizmkit-implement` (behavior preservation verified by tests) → `/prizmkit-code-review` → `/prizmkit-committer` (`refactor(<scope>):` prefix) → `/prizmkit-retrospective` (sync `.prizmkit/prizm-docs/`). **End workflow** — skip Phase 2/3/4.
162
+ - **Add to refactor list** → Continue to Phase 2 (Plan via pipeline).
323
163
 
324
164
  **NEVER proceed without explicit user confirmation via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
325
165
 
@@ -350,7 +190,7 @@ AskUserQuestion:
350
190
 
351
191
  **CHECKPOINT CP-RW-1**: `.prizmkit/plans/refactor-list.json` generated and validated.
352
192
 
353
- **If user says `--from <file>`**: Skip Phase 1 and Phase 2 entirely.
193
+ **If `.prizmkit/plans/refactor-list.json` already exists or user says `--from <file>`**: skip ahead per the [Resume table](#resume--interruption-recovery).
354
194
 
355
195
  ---
356
196
 
@@ -0,0 +1,116 @@
1
+ # Brainstorm Guide — Refactoring Context
2
+
3
+ Procedural details for deep code analysis and discussion during refactor-workflow Phase 1.
4
+
5
+ ## Step 1.3: Parallel Deep Reading
6
+
7
+ **Goal**: Build comprehensive understanding of the target code and context before discussing plans. Spawn multiple agents in parallel to read all relevant materials simultaneously.
8
+
9
+ **Parallel reading tasks** (launch concurrently):
10
+
11
+ | Agent | What to read | Purpose |
12
+ |-------|-------------|---------|
13
+ | Agent A | User-provided code paths — read full source files | Understand current structure, interfaces, dependencies |
14
+ | Agent B | User-provided documents — design docs, proposals, wiki pages | Understand intended direction and constraints |
15
+ | Agent C | `.prizmkit/prizm-docs/` for affected modules — L1/L2 docs, TRAPS, RULES | Understand existing architecture knowledge and known pitfalls |
16
+ | Agent D | Test files for the target area — find and read existing tests | Understand current test coverage and behavior contracts |
17
+
18
+ **Also gather** (can be included in any agent's task):
19
+ - `.prizmkit/config.json` → tech stack preferences
20
+ - Directory structure of the target area
21
+ - Dependency relationships (imports/exports between target and other modules)
22
+
23
+ **After all agents complete**: Synthesize findings into a coherent understanding before proceeding to discussion.
24
+
25
+ ## Step 1.4: Discuss Refactoring Plan
26
+
27
+ **Now** — with deep knowledge of the actual code and documents — discuss the refactoring plan with the user. This discussion is grounded in real code, not abstract questions.
28
+
29
+ Present what you learned from the parallel reading:
30
+ - Current code structure and its problems (with specific file/function references)
31
+ - Existing test coverage status (which areas are safe, which are risky)
32
+ - Known TRAPS and pitfalls from `.prizmkit/prizm-docs/`
33
+ - Dependencies and potential impact on other modules
34
+
35
+ Then ask targeted questions based on what you read. **Adapt question depth to the refactoring complexity** — a simple extract-method refactor needs fewer questions than a full module decomposition.
36
+
37
+ ### Code Structure
38
+ - "I see the current structure does X — is the target state Y, or something different?"
39
+ - What's the target state? What should the code look like after refactoring?
40
+ - Are there specific code smells you've noticed? (duplication, deep nesting, god classes, tight coupling)
41
+
42
+ ### Scope
43
+ - Based on the code I read, these modules are affected: [list]. Anything else in/out of scope?
44
+ - For incremental refactoring: what's the order of priority?
45
+
46
+ ### Behavior Preservation
47
+ - "These public APIs/interfaces exist: [list]. Which must remain unchanged?"
48
+ - "I found these tests: [list]. Are they passing currently?"
49
+ - Any undocumented behavior that callers depend on?
50
+
51
+ ### Risk Assessment
52
+ - "I found these TRAPS in .prizmkit/prizm-docs/: [list]. Any other known gotchas?"
53
+ - Does this code have external consumers (other teams, published APIs)?
54
+ - Any concurrent development happening in the target area?
55
+
56
+ ### Constraints
57
+ - Timeline or urgency? (affects whether to do incremental vs comprehensive)
58
+ - Team coordination needed? (other developers working in the same area)
59
+ - Deployment concerns? (feature flags, backward compatibility, migration)
60
+
61
+ ## Completion Signs
62
+
63
+ **Signs that brainstorming is complete:**
64
+ - All refactoring goals have concrete target state descriptions
65
+ - Scope boundaries are clearly defined (in/out)
66
+ - Behavior preservation contracts are identified
67
+ - Risk areas are acknowledged and mitigation is discussed
68
+ - The user has confirmed the summary is accurate
69
+
70
+ **Signs that more questions are needed:**
71
+ - User's answers contain vague terms ("clean it up", "make it better", "fix the structure")
72
+ - Scope is undefined ("refactor everything" without specifics)
73
+ - No awareness of test coverage for the target area
74
+ - Risk areas are handwaved ("it should be fine")
75
+ - User says "I'm not sure" — help them think through it with concrete options
76
+
77
+ ## Refactoring Goals Summary Template
78
+
79
+ Once brainstorming is complete, produce a structured goals summary using this template:
80
+
81
+ ```markdown
82
+ ## Refactoring Goals Summary
83
+
84
+ ### Target: [Module/area name]
85
+
86
+ ### Refactoring Type: [Incremental / Comprehensive / Targeted]
87
+
88
+ ### Refactoring Objectives
89
+ - [Bullet list of what structural changes are needed and why]
90
+
91
+ ### Current Problems
92
+ - [What's wrong with the current structure — with specific code references]
93
+
94
+ ### Target State
95
+ - [What the code should look like after refactoring]
96
+
97
+ ### Scope
98
+ - **In scope**: [files, modules, directories]
99
+ - **Out of scope**: [explicitly excluded areas]
100
+
101
+ ### Behavior Preservation Contracts
102
+ - [What behavior must remain unchanged]
103
+ - [Key APIs/interfaces that must be preserved]
104
+ - [Existing test coverage status]
105
+
106
+ ### Risk Assessment
107
+ - [Risk]: [Mitigation strategy]
108
+
109
+ ### Reference Materials Reviewed
110
+ - [List of code paths, documents, .prizmkit/prizm-docs/ files that were read]
111
+
112
+ ### Constraints
113
+ - [Timeline, coordination, deployment concerns]
114
+
115
+ ### Confirmed by user: ✓
116
+ ```