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
@@ -156,28 +156,13 @@ Detect user intent from their message, then follow the corresponding workflow:
156
156
 
157
157
  Wait for user confirmation before proceeding.
158
158
 
159
- 5. **Ask execution mode** (first user decision — SEPARATE `AskUserQuestion` call):
159
+ 5. **Ask execution mode** (first user decision):
160
160
 
161
- **This MUST be its own standalone `AskUserQuestion` call.** Do NOT combine execution mode with step 6 config questions. The execution mode question is asked ALONE, user responds, THEN you proceed to step 6.
161
+ Present the three execution modes from the **Execution Mode** section above as a single standalone `AskUserQuestion` call (exactly 1 question, multiSelect: false). Wait for the user's response before continuing to step 6.
162
162
 
163
- Use `AskUserQuestion` with exactly 1 question:
163
+ Each `AskUserQuestion` round is a genuine gate: callers tend to merge interactive rounds and pre-fill answers, which skips real user decisions and produces wrong configs. Therefore: ask execution mode (step 5) and configuration (step 6) as SEPARATE `AskUserQuestion` calls, in order, and do not assemble or show the final command (step 7) until the user has answered both. If you find yourself writing the final command before the user has answered, STOP — you are violating this rule.
164
164
 
165
- **Question 1Execution mode** (multiSelect: false):
166
- - Foreground (Recommended) — pipeline runs in the current session via `run-refactor.ps1 run`. Visible output and direct error feedback.
167
- - Background daemon — pipeline runs fully detached via `launch-refactor-daemon.ps1`. Survives AI CLI session closure.
168
- - Manual — display the final assembled commands only. Do not execute anything. User runs them on their own.
169
-
170
- ⚠️ STOP HERE and wait for user response before continuing to step 6.
171
-
172
- 6. **Ask configuration options** ⚠️ MANDATORY INTERACTIVE STEP — applies to ALL execution modes (Foreground, Background, AND Manual). This is a SEPARATE `AskUserQuestion` call from step 5. You MUST ask the user to configure options and WAIT for their response BEFORE proceeding to step 7.
173
-
174
- ⛔ **HARD STOP**: You MUST call `AskUserQuestion` with the 3 questions below and WAIT for the user's response. You MUST NOT:
175
- - Combine step 5 and step 6 into one `AskUserQuestion` call (this is the most common violation — execution mode MUST be asked separately in step 5)
176
- - Skip this step and jump to step 7
177
- - Merge step 6 and step 7 into one response
178
- - Assume default values and show the command without asking
179
- - Show the command as text and ask "ready?" without presenting the options
180
- If you find yourself writing the final command before the user has answered these 3 questions, STOP — you are violating this rule.
165
+ 6. **Ask configuration options** a SEPARATE `AskUserQuestion` call from step 5, applies to ALL execution modes (Foreground, Background, AND Manual).
181
166
 
182
167
  Use `AskUserQuestion` to present ALL 3 configuration choices (the full 3-question budget goes to config, NOT shared with execution mode):
183
168
 
@@ -196,51 +181,11 @@ Detect user intent from their message, then follow the corresponding workflow:
196
181
 
197
182
  Note: Refactor filter defaults to all refactor items (by priority order). If the user selects "Other" on any option, handle their custom input.
198
183
 
199
- **If user chose "Yes" to Advanced config**, ask a second round of `AskUserQuestion`:
200
-
201
- **Question 1 — Session timeout** (multiSelect: false):
202
- - None (default) — No timeout
203
- - 30 min — `SESSION_TIMEOUT=1800`
204
- - 1 hour — `SESSION_TIMEOUT=3600`
205
- - 2 hours — `SESSION_TIMEOUT=7200`
206
-
207
- **Question 2 — Stop on failure** (multiSelect: false):
208
- - Off (default) — Pipeline continues to next task after failure
209
- - On — Pipeline halts immediately when a task exhausts all retries (`STOP_ON_FAILURE=1`)
210
-
211
- **Question 3 — Critic review** (multiSelect: false):
212
- - Off (default) — Skip adversarial review
213
- - On — Enable adversarial critic review: an independent AI agent reviews the refactor plan for completeness and the implementation for regressions, missing edge cases, and behavior violations. Adds ~5-10 min per refactor task.
214
-
215
- **Question 4 — Reasoning effort** (multiSelect: false):
216
- - Default (none) — Use CLI default
217
- - low — Minimize reasoning, fastest output (`PRIZMKIT_EFFORT=low`)
218
- - medium — Moderate reasoning (`PRIZMKIT_EFFORT=medium`)
219
- - high — Thorough reasoning for complex tasks (`PRIZMKIT_EFFORT=high`)
220
- - xhigh — Extensive reasoning (`PRIZMKIT_EFFORT=xhigh`)
221
- - max — Maximum reasoning, Claude Code only (`PRIZMKIT_EFFORT=max`)
222
-
223
- Default Critic to Off unless refactor items have `priority: "critical"` (in which case default to On).
224
-
225
- **Environment variable mapping** (for translating user responses → env vars):
226
-
227
- | Config choice | Environment variable |
228
- |-----------|---------------------|
229
- | Verbose: On | `VERBOSE=1` |
230
- | Verbose: Off | `VERBOSE=0` |
231
- | Max retries: N | `MAX_RETRIES=N` |
232
- | Critic: On | `ENABLE_CRITIC=true` |
233
- | Timeout: value | `SESSION_TIMEOUT=<seconds>` |
234
- | Stop on failure: On | `STOP_ON_FAILURE=1` |
235
- | Effort: value | `PRIZMKIT_EFFORT=<value>` |
236
-
237
- **Advanced environment variables** (not exposed in interactive menu, pass via `--env`):
184
+ **If user chose "Yes" to Advanced config**, run the advanced configuration round (a second `AskUserQuestion` round). It applies to a minority of sessions, so the full question set lives in `${SKILL_DIR}/references/configuration.md` → **Advanced Configuration Round**. Default Critic to Off unless refactor items have `priority: "critical"` (in which case default to On).
238
185
 
239
- | Variable | Default | Purpose |
240
- |----------|---------|---------|
241
- | `MODEL` | (none) | AI model override (e.g. `claude-opus-4.6`) |
186
+ **Environment variable mapping** and **advanced environment variables** tables — read `${SKILL_DIR}/references/configuration.md` for the full translation tables (10 config→env mappings + 8 advanced variables).
242
187
 
243
- ⚠️ STOP HERE and wait for user response before continuing to step 7.
188
+ STOP HERE and wait for user response before continuing to step 7.
244
189
 
245
190
  7. **Show final command**: After user confirms configuration in step 6, assemble the complete command from execution mode + user-confirmed configuration, and present it to the user.
246
191
 
@@ -389,21 +334,7 @@ Notes:
389
334
 
390
335
  ### Error Handling
391
336
 
392
- | Error | Action |
393
- |-------|--------|
394
- | `.prizmkit/plans/refactor-list.json` not found | Tell user to run `refactor-planner` skill first |
395
- | Circular dependencies in refactor list | Fix dependency graph in `.prizmkit/plans/refactor-list.json` before launching |
396
- | Test baseline failing | Fix failing tests before starting refactoring -- behavior preservation requires a green baseline |
397
- | JSON parsing failed | Use the bundled Python validation/status scripts instead of external JSON tools |
398
- | AI CLI not in PATH | Check Codex (`codex`), Claude (`claude`), or CodeBuddy (`cbc`) installation |
399
- | Refactor pipeline already running | Show status, ask if user wants to stop and restart |
400
- | PID file stale (process dead) | `launch-refactor-daemon.ps1` auto-cleans, retry start |
401
- | Launch failed (process died immediately) | Show last 20 lines of log: `Get-Content -Tail 20 .prizmkit/state/daemon/refactor-daemon.log` |
402
- | Refactor stuck/blocked | Use `reset-refactor.ps1 <R-XXX> --clean --run` for a fresh retry |
403
- | All refactors blocked/failed | Show status, suggest recovery: `.\.prizmkit\dev-pipeline\reset-refactor.ps1 <R-XXX> --clean --run .prizmkit/plans/refactor-list.json` |
404
- | `playwright-cli` not installed | Browser verification skipped for playwright refactors (non-blocking). Suggest: `npm install -g @playwright/cli@latest; playwright-cli install --skills` |
405
- | `opencli` not installed | Browser verification skipped for opencli refactors (non-blocking). Install opencli for Chrome session-based browser verification |
406
- | PowerShell execution policy blocks script | Run `Set-ExecutionPolicy -Scope Process Bypass` for the current terminal |
337
+ Read the error-handling table in `${SKILL_DIR}/references/configuration.md` for the full list of errors and recovery actions.
407
338
 
408
339
  ### Integration Notes
409
340
 
@@ -0,0 +1,82 @@
1
+ # Configuration Reference — Refactor Pipeline Launcher (Windows)
2
+
3
+ Environment variable mappings for the refactor launcher.
4
+
5
+ ## Environment Variable Mapping
6
+
7
+ Translating user responses to env vars:
8
+
9
+ | Config choice | Environment variable |
10
+ |-----------|---------------------|
11
+ | Verbose: On | `VERBOSE=1` |
12
+ | Verbose: Off | `VERBOSE=0` |
13
+ | Max retries: N | `MAX_RETRIES=N` |
14
+ | Strict behavior: On | `STRICT_BEHAVIOR_CHECK=1` |
15
+ | Strict behavior: Off | `STRICT_BEHAVIOR_CHECK=0` |
16
+ | Critic: On | `ENABLE_CRITIC=true` |
17
+ | Timeout: value | `SESSION_TIMEOUT=<seconds>` |
18
+ | Stop on failure: On | `STOP_ON_FAILURE=1` |
19
+ | Deploy: Yes | `ENABLE_DEPLOY=1` |
20
+ | Effort: value | `PRIZMKIT_EFFORT=<value>` |
21
+
22
+ ## Advanced Environment Variables
23
+
24
+ Not exposed in interactive menu, pass via `--env`:
25
+
26
+ | Variable | Default | Purpose |
27
+ |----------|---------|---------|
28
+ | `MODEL` | (none) | AI model override (e.g. `claude-opus-4.6`) |
29
+ | `AUTO_PUSH` | `0` | Auto-push to remote after successful refactor (`1` to enable) |
30
+ | `DEV_BRANCH` | auto-generated | Custom dev branch name (default: `refactor/pipeline-{run_id}`) |
31
+ | `HEARTBEAT_INTERVAL` | `30` | Heartbeat log interval in seconds |
32
+ | `HEARTBEAT_STALE_THRESHOLD` | `600` | Max seconds without heartbeat before marking stale |
33
+ | `LOG_CLEANUP_ENABLED` | `1` | Run periodic log cleanup (`0` to disable) |
34
+ | `LOG_RETENTION_DAYS` | `14` | Delete logs older than N days |
35
+ | `LOG_MAX_TOTAL_MB` | `1024` | Keep total logs under N MB via oldest-first cleanup |
36
+
37
+ ## Error Handling
38
+
39
+ | Error | Action |
40
+ |-------|--------|
41
+ | `.prizmkit/plans/refactor-list.json` not found | Tell user to run `refactor-planner` skill first |
42
+ | Circular dependencies in refactor list | Fix dependency graph in `.prizmkit/plans/refactor-list.json` before launching |
43
+ | Test baseline failing | Fix failing tests before starting refactoring -- behavior preservation requires a green baseline |
44
+ | JSON parsing failed | Use the bundled Python validation/status scripts instead of external JSON tools |
45
+ | AI CLI not in PATH | Check Codex (`codex`), Claude (`claude`), or CodeBuddy (`cbc`) installation |
46
+ | Refactor pipeline already running | Show status, ask if user wants to stop and restart |
47
+ | PID file stale (process dead) | `launch-refactor-daemon.ps1` auto-cleans, retry start |
48
+ | Launch failed (process died immediately) | Show last 20 lines of log: `Get-Content -Tail 20 .prizmkit/state/daemon/refactor-daemon.log` |
49
+ | Refactor stuck/blocked | Use `reset-refactor.ps1 <R-XXX> --clean --run` for a fresh retry |
50
+ | All refactors blocked/failed | Show status, suggest recovery: `.\.prizmkit\dev-pipeline\reset-refactor.ps1 <R-XXX> --clean --run .prizmkit/plans/refactor-list.json` |
51
+ | `playwright-cli` not installed | Browser verification skipped for playwright refactors (non-blocking). Suggest: `npm install -g @playwright/cli@latest; playwright-cli install --skills` |
52
+ | `opencli` not installed | Browser verification skipped for opencli refactors (non-blocking). Install opencli for Chrome session-based browser verification |
53
+ | Deploy session failed | Pipeline completed but deploy session exited non-zero. Check `.prizmkit/state/refactor/deploy/<session_id>/logs/session.log`. Retry manually: `/prizmkit-deploy`. |
54
+ | PowerShell execution policy blocks script | Run `Set-ExecutionPolicy -Scope Process Bypass` for the current terminal |
55
+
56
+ ## Advanced Configuration Round
57
+
58
+ Only run this when the user answered "Yes" to the **Advanced config?** question in step 6. It applies to a minority of sessions.
59
+
60
+ Ask a second round of `AskUserQuestion` with these 4 questions:
61
+
62
+ **Question 1 — Session timeout** (multiSelect: false):
63
+ - None (default) — No timeout
64
+ - 30 min — `SESSION_TIMEOUT=1800`
65
+ - 1 hour — `SESSION_TIMEOUT=3600`
66
+ - 2 hours — `SESSION_TIMEOUT=7200`
67
+
68
+ **Question 2 — Stop on failure** (multiSelect: false):
69
+ - Off (default) — Pipeline continues to next task after failure
70
+ - On — Pipeline halts immediately when a task exhausts all retries (`STOP_ON_FAILURE=1`)
71
+
72
+ **Question 3 — Critic review** (multiSelect: false):
73
+ - Off (default) — Skip adversarial review
74
+ - On — Enable adversarial critic review: an independent AI agent reviews the refactor plan for completeness and the implementation for regressions, missing edge cases, and behavior violations. Adds ~5-10 min per refactor task.
75
+
76
+ **Question 4 — Reasoning effort** (multiSelect: false):
77
+ - Default (none) — Use CLI default
78
+ - low — Minimize reasoning, fastest output (`PRIZMKIT_EFFORT=low`)
79
+ - medium — Moderate reasoning (`PRIZMKIT_EFFORT=medium`)
80
+ - high — Thorough reasoning for complex tasks (`PRIZMKIT_EFFORT=high`)
81
+ - xhigh — Extensive reasoning (`PRIZMKIT_EFFORT=xhigh`)
82
+ - max — Maximum reasoning, Claude Code only (`PRIZMKIT_EFFORT=max`)
@@ -78,7 +78,7 @@ Do NOT use this skill when the user wants to:
78
78
  - Read `${SKILL_DIR}/references/behavior-preservation.md` for preservation strategy selection
79
79
 
80
80
  4. **Load on-demand references when triggered**:
81
- - Validation errors or interrupted session -> read error recovery patterns (similar to feature-planner)
81
+ - Validation errors or interrupted session -> see the "Error Recovery & Resume" section below
82
82
 
83
83
  5. **Define the PowerShell Python helper before running validation scripts**:
84
84
  ```powershell
@@ -246,13 +246,7 @@ Ask: "Based on this analysis, here's how I'd recommend decomposing the refactori
246
246
 
247
247
  **Goal**: Split refactoring goals into executable, well-ordered items.
248
248
 
249
- Read `${SKILL_DIR}/assets/planning-guide.md` for decomposition patterns and dependency ordering rules.
250
-
251
- For each refactoring goal:
252
- 1. Identify atomic refactoring operations
253
- 2. Determine inter-item dependencies (safe renames first, structural changes later)
254
- 3. Assess complexity per item (file count, cross-module scope, test coverage)
255
- 4. Assign behavior preservation strategy per item (read `${SKILL_DIR}/references/behavior-preservation.md`)
249
+ Read `${SKILL_DIR}/references/planning-phases.md` for the full Phase 4-6 procedures — item decomposition patterns, per-item confirmation loop, and completeness review checklist.
256
250
 
257
251
  **CHECKPOINT CP-RP-3**: All items decomposed with dependencies and preservation strategies.
258
252
 
@@ -260,29 +254,7 @@ For each refactoring goal:
260
254
 
261
255
  **Goal**: Present each item to the user for confirmation, modification, or rejection.
262
256
 
263
- For each item, display:
264
-
265
- ```
266
- Refactor Item R-001:
267
- Title: [title]
268
- Type: [extract/rename/restructure/simplify/decouple/migrate]
269
- Scope: [files list]
270
- Priority: [critical/high/medium/low]
271
- Complexity: [low/medium/high]
272
- Behavior Preservation: [test-gate/snapshot/manual]
273
- Acceptance Criteria:
274
- - [criterion 1]
275
- - [criterion 2]
276
- Dependencies: [none / R-002, R-003]
277
-
278
- Confirm? (Y/modify/skip)
279
- ```
280
-
281
- - **Y**: Accept item as-is
282
- - **modify**: User provides changes, update item, re-display for confirmation
283
- - **skip**: Remove item from the list
284
-
285
- Continue until all items are confirmed or skipped.
257
+ See `${SKILL_DIR}/references/planning-phases.md` for the display template and confirm/modify/skip loop procedure.
286
258
 
287
259
  **CHECKPOINT CP-RP-4**: All items confirmed by user.
288
260
 
@@ -290,28 +262,7 @@ Continue until all items are confirmed or skipped.
290
262
 
291
263
  **Goal**: Check the full item set for consistency, gaps, and headless execution readiness.
292
264
 
293
- 1. **Dependency ordering check**: Verify items form a valid DAG (no cycles). Items should be ordered: safe renames -> extract/inline -> structural changes -> migrations
294
- 2. **Behavior preservation check**: Every item must have a declared preservation strategy. Flag any item with `manual` strategy and no test coverage.
295
- 3. **Gap detection**: Are there intermediate steps needed between items? Does item A's output match item B's input assumption?
296
- 4. **Cross-module impact**: Do any items affect modules outside the declared scope?
297
- 5. **Headless Execution Readiness**: The refactor pipeline runs each item through an autonomous AI session with NO human interaction. For each item, verify:
298
- - **Scope clarity**: Are all affected files explicitly listed? The AI must know exactly where to look.
299
- - **Refactoring instructions**: Is the description specific enough to execute without ambiguity?
300
- - ❌ "Clean up the utils module" — what exactly should change?
301
- - ✅ "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."
302
- - **Behavior preservation**: Is it clear what tests to run and what behavior must be preserved?
303
- - **Dependency context**: If item depends on earlier refactors, does the description reference what changed?
304
-
305
- Present review summary:
306
- ```
307
- Item | Deps Valid | Preservation | Gaps | Status
308
- R-001 | OK | test-gate | - | Ready
309
- R-002 | OK | test-gate | - | Ready
310
- R-003 | OK | manual | No test coverage| Needs attention
311
- R-004 | OK | snapshot | - | Ready
312
- ```
313
-
314
- If issues found, discuss with user and resolve before proceeding.
265
+ See `${SKILL_DIR}/references/planning-phases.md` for the full 5-step review checklist and review summary table format.
315
266
 
316
267
  **CHECKPOINT CP-RP-5**: Completeness review passed, all issues resolved.
317
268
 
@@ -343,8 +294,6 @@ If issues found, discuss with user and resolve before proceeding.
343
294
  | **CP-RP-5** | Completeness OK | DAG valid, preservation strategies declared, no gaps | 6 |
344
295
  | **CP-RP-6** | Output Valid | `.prizmkit/plans/refactor-list.json` passes validation script | 7 |
345
296
 
346
- **Resume Detection**: If existing artifacts found (partial `.prizmkit/plans/refactor-list.json`, draft `refactor-list.draft.json` in `.prizmkit/plans/`), offer to resume from the appropriate checkpoint.
347
-
348
297
  ## Output Rules
349
298
 
350
299
  `.prizmkit/plans/refactor-list.json` must satisfy:
@@ -376,118 +325,27 @@ Set default critic fields for each refactor item. The user can override per-item
376
325
 
377
326
  ## Fast Path
378
327
 
379
- For simple refactoring with minimal scope:
380
-
381
- ### Eligibility Criteria (ALL must apply)
382
- - 1-2 refactor items only
383
- - Complexity: `low` or `medium` for all items
384
- - No cross-module impact (all items within same module)
385
- - Well-known refactoring pattern (rename, extract method/class, inline)
386
- - Existing test coverage for target area
387
-
388
- ### Fast Path Workflow
389
- 1. Confirm refactoring scope with user
390
- 2. **User confirmation (mandatory)** — Use `AskUserQuestion` to present interactive selectable options:
391
-
392
- ```
393
- AskUserQuestion:
394
- question: "This qualifies for fast-path (simple refactoring). How would you like to proceed?"
395
- header: "Approach"
396
- options:
397
- - label: "Fast-path"
398
- description: "Skip detailed analysis, draft refactor items directly and add to refactor-list.json"
399
- - label: "Full workflow"
400
- description: "Use the complete planning workflow with detailed code analysis"
401
- - label: "Implement directly"
402
- description: "Skip the task list entirely and implement the refactoring right now using /prizmkit-plan + /prizmkit-implement"
403
- ```
404
-
405
- - **Fast-path** → Continue with fast-path workflow below
406
- - **Full workflow** → Exit fast path, use full workflow from Phase 2
407
- - **Implement directly** → Invoke `/prizmkit-plan` directly to create spec + plan, then `/prizmkit-implement` to execute. Do NOT add to `.prizmkit/plans/refactor-list.json`
408
-
409
- **NEVER proceed without explicit user selection via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
410
- 3. Draft items (title + type + scope + description + acceptance_criteria + behavior_preservation + dependencies)
411
- 4. Write draft to `.prizmkit/plans/refactor-list.draft.json`, then call the generate script:
412
- ```powershell
413
- Invoke-PrizmPython ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
414
- ```
415
- 5. If valid -> summarize and recommend next step
416
- 6. If invalid -> apply fixes to the draft, re-run generate (max 2 attempts, then escalate to full workflow)
417
-
418
- ### When NOT to Use Fast Path
419
- - More than 2 refactor items
420
- - Any item with `high` complexity
421
- - Cross-module impact
422
- - Architecture migration patterns (Format C goals)
423
- - No existing test coverage for target area
424
-
425
- ### Example Fast Path Session
426
- ```
427
- User: "Rename the auth middleware function from checkAuth to requireAuth everywhere."
428
- AI: [Detects simple rename, single module]
429
- AI: [Qualifies for fast path: 1 item, low complexity, no cross-module impact]
430
- AI: [Uses AskUserQuestion with options: "Fast-path", "Full workflow", "Implement directly"]
431
- User: [Selects "Fast-path"]
432
- AI: "Drafting R-001..."
433
- AI: [Validates immediately]
434
- AI: "Ready to proceed to dev-pipeline."
435
- ```
328
+ For simple refactoring with minimal scope (1-2 items, low/medium complexity, no cross-module impact, existing test coverage). Read `${SKILL_DIR}/references/fast-path.md` for eligibility criteria, full workflow (including AskUserQuestion format), conditions NOT to use, and an example session.
436
329
 
437
330
  ## Browser Verification
438
331
 
439
- **Browser verification is a feature-pipeline capability only.** Refactors use `behavior_preservation` strategy instead to ensure no external behavior changes:
440
-
441
- - `strategy: test-gate` — Rely on existing test suite. Pipeline runs tests before and after refactoring.
442
- - `strategy: snapshot` — Compare behavior before/after refactoring using executable snapshots (outputs, API responses, side effects)
443
- - `strategy: manual` — Require human verification that behavior is preserved
444
-
445
- 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:
446
-
447
- Example:
448
- ```
449
- Refactor Title: Extract UserProfile component from AccountSettings
450
- Type: extract
451
- Strategy: snapshot
452
- Acceptance Criteria:
453
- 1. UserProfile component renders identically to inline version (compare snapshots)
454
- 2. All props are correctly forwarded (unit tests pass)
455
- 3. No visual regression (screenshot comparison)
456
- 4. Component is reusable in other views
457
- ```
458
-
459
- The refactor pipeline AI will use the snapshot strategy to verify external behavior is preserved during refactoring.
332
+ Browser verification is a feature-pipeline capability only. Refactors use `behavior_preservation` strategy instead. Read `${SKILL_DIR}/references/planning-phases.md` for strategy details and UI refactoring examples.
460
333
 
461
334
  ---
462
335
 
463
336
  ## Refactoring-Specific Features
464
337
 
465
338
  ### Behavior Preservation Check
466
- Every item MUST declare a behavior preservation strategy. Read `${SKILL_DIR}/references/behavior-preservation.md` for strategy details.
467
-
468
- | Strategy | When to Use |
469
- |----------|-------------|
470
- | `test-gate` | Target area has good test coverage. Run full test suite after each change. |
471
- | `snapshot` | Compare output/state before and after. Useful when tests are insufficient but behavior is observable. |
472
- | `manual` | Human verification required. Last resort when neither tests nor snapshots are feasible. |
473
339
 
474
- Flag items using `manual` strategy prominently they carry the highest risk of behavior regression.
340
+ Every item MUST declare a behavior preservation strategy. Read `${SKILL_DIR}/references/behavior-preservation.md` for strategy details. See `${SKILL_DIR}/references/planning-phases.md` for the strategy selection table and manual-strategy flagging rules.
475
341
 
476
342
  ### Dependency Ordering
477
- Auto-detect inter-item dependencies and enforce safe ordering:
478
- 1. **Safe renames** first (lowest risk, no structural change)
479
- 2. **Extract/inline** operations (moderate risk, changes module boundaries)
480
- 3. **Structural changes** (higher risk, reorganizes architecture)
481
- 4. **Migrations** last (highest risk, changes patterns/paradigms)
343
+
344
+ Auto-detect inter-item dependencies and enforce safe ordering. Read `${SKILL_DIR}/references/planning-phases.md` for the full dependency ordering rules (safe renames -> extract/inline -> structural -> migrations).
482
345
 
483
346
  ### Complexity Assessment
484
- Assess each item's complexity based on:
485
- - **File count**: 1-2 files = low, 3-5 files = medium, 6+ files = high
486
- - **Cross-module scope**: same module = low, 2 modules = medium, 3+ modules = high
487
- - **Test coverage**: high coverage = reduces complexity, low coverage = increases complexity
488
- - **Pattern familiarity**: well-known pattern = low, novel restructuring = high
489
347
 
490
- Take the highest of these individual assessments as the item's complexity.
348
+ Assess each item's complexity based on file count, cross-module scope, test coverage, and pattern familiarity. Read `${SKILL_DIR}/references/planning-phases.md` for the full complexity assessment criteria and scoring rules.
491
349
 
492
350
  ## Next-Step Execution Policy (after planning)
493
351
 
@@ -503,6 +361,8 @@ Key behaviors:
503
361
 
504
362
  ### Resume Detection
505
363
 
364
+ If existing artifacts are found, offer to resume from the appropriate checkpoint/phase:
365
+
506
366
  | Artifact Found | Resume From |
507
367
  |---------------|------------|
508
368
  | Nothing | Phase 1: Project Context |
@@ -510,18 +370,16 @@ Key behaviors:
510
370
  | Partial `.prizmkit/plans/refactor-list.json` | Phase 6: Completeness Review |
511
371
  | Valid `.prizmkit/plans/refactor-list.json` | Mode D: Summary |
512
372
 
513
- ## Session Exit Gate
373
+ ### Session Exit Gate
514
374
 
515
375
  Prevent accidental session exit without deliverable completion.
516
376
 
517
- ### Trigger Conditions
518
- Activate exit gate when ALL are true:
377
+ **Trigger conditions** — activate the exit gate when ALL are true:
519
378
  - User invoked `/refactor-planner` (not just mentioned refactoring)
520
379
  - Current phase < Phase 7 (validation not yet passed)
521
380
  - No valid `.prizmkit/plans/refactor-list.json` has been written in this session
522
381
 
523
- ### Gate Behavior
524
- When the session appears to be ending:
382
+ **Gate behavior** — when the session appears to be ending:
525
383
  1. **Remind**: "You set out to produce `.prizmkit/plans/refactor-list.json` but we haven't completed it yet."
526
384
  2. **Offer 3 options**:
527
385
  - **(a) Continue to completion** — resume from current phase
@@ -0,0 +1,59 @@
1
+ # Fast Path — Refactor Planner
2
+
3
+ For simple refactoring with minimal scope.
4
+
5
+ ## Eligibility Criteria (ALL must apply)
6
+ - 1-2 refactor items only
7
+ - Complexity: `low` or `medium` for all items
8
+ - No cross-module impact (all items within same module)
9
+ - Well-known refactoring pattern (rename, extract method/class, inline)
10
+ - Existing test coverage for target area
11
+
12
+ ## Fast Path Workflow
13
+ 1. Confirm refactoring scope with user
14
+ 2. **User confirmation (mandatory)** — Use `AskUserQuestion` to present interactive selectable options:
15
+
16
+ ```
17
+ AskUserQuestion:
18
+ question: "This qualifies for fast-path (simple refactoring). How would you like to proceed?"
19
+ header: "Approach"
20
+ options:
21
+ - label: "Fast-path"
22
+ description: "Skip detailed analysis, draft refactor items directly and add to refactor-list.json"
23
+ - label: "Full workflow"
24
+ description: "Use the complete planning workflow with detailed code analysis"
25
+ - label: "Implement directly"
26
+ description: "Skip the task list entirely and implement the refactoring right now using /prizmkit-plan + /prizmkit-implement"
27
+ ```
28
+
29
+ - **Fast-path** → Continue with fast-path workflow below
30
+ - **Full workflow** → Exit fast path, use full workflow from Phase 2
31
+ - **Implement directly** → Invoke `/prizmkit-plan` directly to create spec + plan, then `/prizmkit-implement` to execute. Do NOT add to `.prizmkit/plans/refactor-list.json`
32
+
33
+ **NEVER proceed without explicit user selection via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
34
+ 3. Draft items (title + type + scope + description + acceptance_criteria + behavior_preservation + dependencies)
35
+ 4. Write draft to `.prizmkit/plans/refactor-list.draft.json`, then call the generate script:
36
+ ```powershell
37
+ Invoke-PrizmPython ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
38
+ ```
39
+ 5. If valid -> summarize and recommend next step
40
+ 6. If invalid -> apply fixes to the draft, re-run generate (max 2 attempts, then escalate to full workflow)
41
+
42
+ ## When NOT to Use Fast Path
43
+ - More than 2 refactor items
44
+ - Any item with `high` complexity
45
+ - Cross-module impact
46
+ - Architecture migration patterns (Format C goals)
47
+ - No existing test coverage for target area
48
+
49
+ ## Example Fast Path Session
50
+ ```
51
+ User: "Rename the auth middleware function from checkAuth to requireAuth everywhere."
52
+ AI: [Detects simple rename, single module]
53
+ AI: [Qualifies for fast path: 1 item, low complexity, no cross-module impact]
54
+ AI: [Uses AskUserQuestion with options: "Fast-path", "Full workflow", "Implement directly"]
55
+ User: [Selects "Fast-path"]
56
+ AI: "Drafting R-001..."
57
+ AI: [Validates immediately]
58
+ AI: "Ready to proceed to dev-pipeline."
59
+ ```
@@ -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.