prizmkit 1.1.79 → 1.1.80

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 (92) 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 +10 -347
  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-configuration.md +46 -0
  10. package/bundled/skills/bug-fix-workflow/SKILL.md +1 -30
  11. package/bundled/skills/bug-fix-workflow/references/bug-diagnosis.md +66 -0
  12. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +3 -40
  13. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +49 -0
  14. package/bundled/skills/feature-pipeline-launcher/SKILL.md +3 -46
  15. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +55 -0
  16. package/bundled/skills/feature-workflow/SKILL.md +5 -121
  17. package/bundled/skills/feature-workflow/references/brainstorm-guide.md +137 -0
  18. package/bundled/skills/prizm-kit/SKILL.md +11 -0
  19. package/bundled/skills/prizmkit-code-review/SKILL.md +66 -135
  20. package/bundled/skills/prizmkit-code-review/references/dev-agent-prompt.md +30 -0
  21. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +31 -0
  22. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +62 -0
  23. package/bundled/skills/prizmkit-code-review/scripts/check_loop.py +186 -0
  24. package/bundled/skills/prizmkit-committer/SKILL.md +6 -0
  25. package/bundled/skills/prizmkit-deploy/SKILL.md +48 -72
  26. package/bundled/skills/prizmkit-deploy/references/data-safety-examples.md +120 -0
  27. package/bundled/skills/prizmkit-deploy/references/ssh-bootstrap-flow.md +49 -0
  28. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +41 -0
  29. package/bundled/skills/prizmkit-deploy/references/ssh-takeover.md +20 -0
  30. package/bundled/skills/prizmkit-implement/SKILL.md +6 -0
  31. package/bundled/skills/prizmkit-plan/SKILL.md +1 -83
  32. package/bundled/skills/prizmkit-plan/references/examples.md +85 -0
  33. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +13 -0
  34. package/bundled/skills/prizmkit-test/SKILL.md +3 -151
  35. package/bundled/skills/prizmkit-test/references/examples.md +70 -0
  36. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +49 -0
  37. package/bundled/skills/prizmkit-test/references/test-report-template.md +42 -0
  38. package/bundled/skills/recovery-workflow/SKILL.md +1 -30
  39. package/bundled/skills/recovery-workflow/references/detection.md +58 -0
  40. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +3 -45
  41. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +54 -0
  42. package/bundled/skills/refactor-planner/SKILL.md +9 -149
  43. package/bundled/skills/refactor-planner/references/fast-path.md +59 -0
  44. package/bundled/skills/refactor-planner/references/planning-phases.md +135 -0
  45. package/bundled/skills/refactor-workflow/SKILL.md +4 -103
  46. package/bundled/skills/refactor-workflow/references/brainstorm-guide.md +116 -0
  47. package/bundled/skills-windows/app-planner/SKILL.md +10 -349
  48. package/bundled/skills-windows/app-planner/references/infrastructure-convention-discovery.md +108 -0
  49. package/bundled/skills-windows/app-planner/references/project-conventions-discovery.md +59 -0
  50. package/bundled/skills-windows/app-planner/references/project-state-detection.md +90 -0
  51. package/bundled/skills-windows/app-planner/references/rules-configuration.md +46 -0
  52. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +1 -30
  53. package/bundled/skills-windows/bug-fix-workflow/references/bug-diagnosis.md +66 -0
  54. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +2 -29
  55. package/bundled/skills-windows/bugfix-pipeline-launcher/references/configuration.md +49 -0
  56. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +2 -35
  57. package/bundled/skills-windows/feature-pipeline-launcher/references/configuration.md +55 -0
  58. package/bundled/skills-windows/feature-workflow/SKILL.md +5 -121
  59. package/bundled/skills-windows/feature-workflow/references/brainstorm-guide.md +137 -0
  60. package/bundled/skills-windows/prizm-kit/SKILL.md +11 -0
  61. package/bundled/skills-windows/prizmkit-code-review/SKILL.md +66 -135
  62. package/bundled/skills-windows/prizmkit-code-review/references/dev-agent-prompt.md +30 -0
  63. package/bundled/skills-windows/prizmkit-code-review/references/review-report-template.md +31 -0
  64. package/bundled/skills-windows/prizmkit-code-review/references/reviewer-agent-prompt.md +62 -0
  65. package/bundled/skills-windows/prizmkit-code-review/scripts/check_loop.py +186 -0
  66. package/bundled/skills-windows/prizmkit-committer/SKILL.md +6 -0
  67. package/bundled/skills-windows/prizmkit-deploy/SKILL.md +49 -73
  68. package/bundled/skills-windows/prizmkit-deploy/references/data-safety-examples.md +120 -0
  69. package/bundled/skills-windows/prizmkit-deploy/references/direct-upload.md +3 -3
  70. package/bundled/skills-windows/prizmkit-deploy/references/ssh-bootstrap-flow.md +49 -0
  71. package/bundled/skills-windows/prizmkit-deploy/references/ssh-execution-flow.md +41 -0
  72. package/bundled/skills-windows/prizmkit-deploy/references/ssh-takeover.md +20 -0
  73. package/bundled/skills-windows/prizmkit-deploy/references/ssl-setup.md +2 -2
  74. package/bundled/skills-windows/prizmkit-implement/SKILL.md +6 -0
  75. package/bundled/skills-windows/prizmkit-plan/SKILL.md +1 -83
  76. package/bundled/skills-windows/prizmkit-plan/references/examples.md +85 -0
  77. package/bundled/skills-windows/prizmkit-prizm-docs/SKILL.md +13 -0
  78. package/bundled/skills-windows/prizmkit-retrospective/references/structural-sync-steps.md +1 -1
  79. package/bundled/skills-windows/prizmkit-test/SKILL.md +3 -151
  80. package/bundled/skills-windows/prizmkit-test/references/examples.md +70 -0
  81. package/bundled/skills-windows/prizmkit-test/references/test-generation-steps.md +49 -0
  82. package/bundled/skills-windows/prizmkit-test/references/test-report-template.md +42 -0
  83. package/bundled/skills-windows/recovery-workflow/SKILL.md +1 -52
  84. package/bundled/skills-windows/recovery-workflow/references/detection.md +58 -0
  85. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +2 -32
  86. package/bundled/skills-windows/refactor-pipeline-launcher/references/configuration.md +54 -0
  87. package/bundled/skills-windows/refactor-planner/SKILL.md +9 -149
  88. package/bundled/skills-windows/refactor-planner/references/fast-path.md +59 -0
  89. package/bundled/skills-windows/refactor-planner/references/planning-phases.md +135 -0
  90. package/bundled/skills-windows/refactor-workflow/SKILL.md +4 -103
  91. package/bundled/skills-windows/refactor-workflow/references/brainstorm-guide.md +116 -0
  92. package/package.json +1 -1
@@ -206,35 +206,8 @@ Detect user intent from their message, then follow the corresponding workflow:
206
206
  - xhigh — Extensive reasoning (`PRIZMKIT_EFFORT=xhigh`)
207
207
  - max — Maximum reasoning, Claude Code only (`PRIZMKIT_EFFORT=max`)
208
208
 
209
- **Environment variable mapping** (for translating user responses env vars):
210
-
211
- | Config choice | Environment variable |
212
- |-----------|---------------------|
213
- | Verbose: On | `VERBOSE=1` |
214
- | Verbose: Off | `VERBOSE=0` |
215
- | Max retries: N | `MAX_RETRIES=N` |
216
- | Strict behavior: On | `STRICT_BEHAVIOR_CHECK=1` |
217
- | Strict behavior: Off | `STRICT_BEHAVIOR_CHECK=0` |
218
- | Critic: On | `ENABLE_CRITIC=true` |
219
- | Timeout: value | `SESSION_TIMEOUT=<seconds>` |
220
- | Stop on failure: On | `STOP_ON_FAILURE=1` |
221
- | Deploy: Yes | `ENABLE_DEPLOY=1` |
222
- | Effort: value | `PRIZMKIT_EFFORT=<value>` |
223
-
224
- **Advanced environment variables** (not exposed in interactive menu, pass via `--env`):
225
-
226
- | Variable | Default | Purpose |
227
- |----------|---------|---------|
228
- | `MODEL` | (none) | AI model override (e.g. `claude-opus-4.6`) |
229
- | `AUTO_PUSH` | `0` | Auto-push to remote after successful refactor (`1` to enable) |
230
- | `DEV_BRANCH` | auto-generated | Custom dev branch name (default: `refactor/pipeline-{run_id}`) |
231
- | `HEARTBEAT_INTERVAL` | `30` | Heartbeat log interval in seconds |
232
- | `HEARTBEAT_STALE_THRESHOLD` | `600` | Max seconds without heartbeat before marking stale |
233
- | `LOG_CLEANUP_ENABLED` | `1` | Run periodic log cleanup (`0` to disable) |
234
- | `LOG_RETENTION_DAYS` | `14` | Delete logs older than N days |
235
- | `LOG_MAX_TOTAL_MB` | `1024` | Keep total logs under N MB via oldest-first cleanup |
236
-
237
- ⚠️ STOP HERE and wait for user response before continuing to step 7.
209
+ **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).
210
+
238
211
 
239
212
  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.
240
213
 
@@ -383,22 +356,7 @@ Notes:
383
356
 
384
357
  ### Error Handling
385
358
 
386
- | Error | Action |
387
- |-------|--------|
388
- | `.prizmkit/plans/refactor-list.json` not found | Tell user to run `refactor-planner` skill first |
389
- | Circular dependencies in refactor list | Fix dependency graph in `.prizmkit/plans/refactor-list.json` before launching |
390
- | Test baseline failing | Fix failing tests before starting refactoring -- behavior preservation requires a green baseline |
391
- | `jq` not installed | Suggest: `brew install jq` |
392
- | `cbc`/`claude` not in PATH | Check AI CLI installation |
393
- | Refactor pipeline already running | Show status, ask if user wants to stop and restart |
394
- | PID file stale (process dead) | `launch-refactor-daemon.sh` auto-cleans, retry start |
395
- | Launch failed (process died immediately) | Show last 20 lines of log: `tail -20 .prizmkit/state/refactor/pipeline-daemon.log` |
396
- | Refactor stuck/blocked | Use `reset-refactor.sh <R-XXX> --clean --run` for a fresh retry |
397
- | All refactors blocked/failed | Show status, suggest recovery: `.prizmkit/dev-pipeline/reset-refactor.sh <R-XXX> --clean --run .prizmkit/plans/refactor-list.json` |
398
- | `playwright-cli` not installed | Browser verification skipped for playwright refactors (non-blocking). Suggest: `npm install -g @playwright/cli@latest && playwright-cli install --skills` |
399
- | `opencli` not installed | Browser verification skipped for opencli refactors (non-blocking). Install opencli for Chrome session-based browser verification |
400
- | 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`. |
401
- | Permission denied on script | Run `chmod +x .prizmkit/dev-pipeline/launch-refactor-daemon.sh .prizmkit/dev-pipeline/run-refactor.sh` |
359
+ Read `${SKILL_DIR}/references/configuration.md` for the full error handling table (14 entries).
402
360
 
403
361
  ### Integration Notes
404
362
 
@@ -0,0 +1,54 @@
1
+ # Configuration Reference — Refactor Pipeline Launcher
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
+ | `jq` not installed | Suggest: `brew install jq` |
45
+ | `cbc`/`claude` not in PATH | Check AI CLI 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.sh` auto-cleans, retry start |
48
+ | Launch failed (process died immediately) | Show last 20 lines of log: `tail -20 .prizmkit/state/refactor/pipeline-daemon.log` |
49
+ | Refactor stuck/blocked | Use `reset-refactor.sh <R-XXX> --clean --run` for a fresh retry |
50
+ | All refactors blocked/failed | Show status, suggest recovery: `.prizmkit/dev-pipeline/reset-refactor.sh <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
+ | Permission denied on script | Run `chmod +x .prizmkit/dev-pipeline/launch-refactor-daemon.sh .prizmkit/dev-pipeline/run-refactor.sh` |
@@ -220,13 +220,7 @@ Ask: "Based on this analysis, here's how I'd recommend decomposing the refactori
220
220
 
221
221
  **Goal**: Split refactoring goals into executable, well-ordered items.
222
222
 
223
- Read `${SKILL_DIR}/assets/planning-guide.md` for decomposition patterns and dependency ordering rules.
224
-
225
- For each refactoring goal:
226
- 1. Identify atomic refactoring operations
227
- 2. Determine inter-item dependencies (safe renames first, structural changes later)
228
- 3. Assess complexity per item (file count, cross-module scope, test coverage)
229
- 4. Assign behavior preservation strategy per item (read `${SKILL_DIR}/references/behavior-preservation.md`)
223
+ 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.
230
224
 
231
225
  **CHECKPOINT CP-RP-3**: All items decomposed with dependencies and preservation strategies.
232
226
 
@@ -234,29 +228,7 @@ For each refactoring goal:
234
228
 
235
229
  **Goal**: Present each item to the user for confirmation, modification, or rejection.
236
230
 
237
- For each item, display:
238
-
239
- ```
240
- Refactor Item R-001:
241
- Title: [title]
242
- Type: [extract/rename/restructure/simplify/decouple/migrate]
243
- Scope: [files list]
244
- Priority: [critical/high/medium/low]
245
- Complexity: [low/medium/high]
246
- Behavior Preservation: [test-gate/snapshot/manual]
247
- Acceptance Criteria:
248
- - [criterion 1]
249
- - [criterion 2]
250
- Dependencies: [none / R-002, R-003]
251
-
252
- Confirm? (Y/modify/skip)
253
- ```
254
-
255
- - **Y**: Accept item as-is
256
- - **modify**: User provides changes, update item, re-display for confirmation
257
- - **skip**: Remove item from the list
258
-
259
- Continue until all items are confirmed or skipped.
231
+ See `${SKILL_DIR}/references/planning-phases.md` for the display template and confirm/modify/skip loop procedure.
260
232
 
261
233
  **CHECKPOINT CP-RP-4**: All items confirmed by user.
262
234
 
@@ -264,28 +236,7 @@ Continue until all items are confirmed or skipped.
264
236
 
265
237
  **Goal**: Check the full item set for consistency, gaps, and headless execution readiness.
266
238
 
267
- 1. **Dependency ordering check**: Verify items form a valid DAG (no cycles). Items should be ordered: safe renames -> extract/inline -> structural changes -> migrations
268
- 2. **Behavior preservation check**: Every item must have a declared preservation strategy. Flag any item with `manual` strategy and no test coverage.
269
- 3. **Gap detection**: Are there intermediate steps needed between items? Does item A's output match item B's input assumption?
270
- 4. **Cross-module impact**: Do any items affect modules outside the declared scope?
271
- 5. **Headless Execution Readiness**: The refactor pipeline runs each item through an autonomous AI session with NO human interaction. For each item, verify:
272
- - **Scope clarity**: Are all affected files explicitly listed? The AI must know exactly where to look.
273
- - **Refactoring instructions**: Is the description specific enough to execute without ambiguity?
274
- - ❌ "Clean up the utils module" — what exactly should change?
275
- - ✅ "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."
276
- - **Behavior preservation**: Is it clear what tests to run and what behavior must be preserved?
277
- - **Dependency context**: If item depends on earlier refactors, does the description reference what changed?
278
-
279
- Present review summary:
280
- ```
281
- Item | Deps Valid | Preservation | Gaps | Status
282
- R-001 | OK | test-gate | - | Ready
283
- R-002 | OK | test-gate | - | Ready
284
- R-003 | OK | manual | No test coverage| Needs attention
285
- R-004 | OK | snapshot | - | Ready
286
- ```
287
-
288
- If issues found, discuss with user and resolve before proceeding.
239
+ See `${SKILL_DIR}/references/planning-phases.md` for the full 5-step review checklist (DAG validation, preservation check, gap detection, cross-module impact, headless readiness criteria) and review summary table format.
289
240
 
290
241
  **CHECKPOINT CP-RP-5**: Completeness review passed, all issues resolved.
291
242
 
@@ -350,118 +301,27 @@ Set default critic fields for each refactor item. The user can override per-item
350
301
 
351
302
  ## Fast Path
352
303
 
353
- For simple refactoring with minimal scope:
354
-
355
- ### Eligibility Criteria (ALL must apply)
356
- - 1-2 refactor items only
357
- - Complexity: `low` or `medium` for all items
358
- - No cross-module impact (all items within same module)
359
- - Well-known refactoring pattern (rename, extract method/class, inline)
360
- - Existing test coverage for target area
361
-
362
- ### Fast Path Workflow
363
- 1. Confirm refactoring scope with user
364
- 2. **User confirmation (mandatory)** — Use `AskUserQuestion` to present interactive selectable options:
365
-
366
- ```
367
- AskUserQuestion:
368
- question: "This qualifies for fast-path (simple refactoring). How would you like to proceed?"
369
- header: "Approach"
370
- options:
371
- - label: "Fast-path"
372
- description: "Skip detailed analysis, draft refactor items directly and add to refactor-list.json"
373
- - label: "Full workflow"
374
- description: "Use the complete planning workflow with detailed code analysis"
375
- - label: "Implement directly"
376
- description: "Skip the task list entirely and implement the refactoring right now using /prizmkit-plan + /prizmkit-implement"
377
- ```
378
-
379
- - **Fast-path** → Continue with fast-path workflow below
380
- - **Full workflow** → Exit fast path, use full workflow from Phase 2
381
- - **Implement directly** → Invoke `/prizmkit-plan` directly to create spec + plan, then `/prizmkit-implement` to execute. Do NOT add to `.prizmkit/plans/refactor-list.json`
382
-
383
- **NEVER proceed without explicit user selection via `AskUserQuestion`. Do NOT render options as plain text — the user must be able to click/select.**
384
- 3. Draft items (title + type + scope + description + acceptance_criteria + behavior_preservation + dependencies)
385
- 4. Write draft to `.prizmkit/plans/refactor-list.draft.json`, then call the generate script:
386
- ```bash
387
- python3 ${SKILL_DIR}/scripts/validate-and-generate-refactor.py generate --input .prizmkit/plans/refactor-list.draft.json --output .prizmkit/plans/refactor-list.json
388
- ```
389
- 5. If valid -> summarize and recommend next step
390
- 6. If invalid -> apply fixes to the draft, re-run generate (max 2 attempts, then escalate to full workflow)
391
-
392
- ### When NOT to Use Fast Path
393
- - More than 2 refactor items
394
- - Any item with `high` complexity
395
- - Cross-module impact
396
- - Architecture migration patterns (Format C goals)
397
- - No existing test coverage for target area
398
-
399
- ### Example Fast Path Session
400
- ```
401
- User: "Rename the auth middleware function from checkAuth to requireAuth everywhere."
402
- AI: [Detects simple rename, single module]
403
- AI: [Qualifies for fast path: 1 item, low complexity, no cross-module impact]
404
- AI: [Uses AskUserQuestion with options: "Fast-path", "Full workflow", "Implement directly"]
405
- User: [Selects "Fast-path"]
406
- AI: "Drafting R-001..."
407
- AI: [Validates immediately]
408
- AI: "Ready to proceed to dev-pipeline."
409
- ```
304
+ 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.
410
305
 
411
306
  ## Browser Verification
412
307
 
413
- **Browser verification is a feature-pipeline capability only.** Refactors use `behavior_preservation` strategy instead to ensure no external behavior changes:
414
-
415
- - `strategy: test-gate` — Rely on existing test suite. Pipeline runs tests before and after refactoring.
416
- - `strategy: snapshot` — Compare behavior before/after refactoring using executable snapshots (outputs, API responses, side effects)
417
- - `strategy: manual` — Require human verification that behavior is preserved
418
-
419
- 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:
420
-
421
- Example:
422
- ```
423
- Refactor Title: Extract UserProfile component from AccountSettings
424
- Type: extract
425
- Strategy: snapshot
426
- Acceptance Criteria:
427
- 1. UserProfile component renders identically to inline version (compare snapshots)
428
- 2. All props are correctly forwarded (unit tests pass)
429
- 3. No visual regression (screenshot comparison)
430
- 4. Component is reusable in other views
431
- ```
432
-
433
- The refactor pipeline AI will use the snapshot strategy to verify external behavior is preserved during refactoring.
308
+ 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.
434
309
 
435
310
  ---
436
311
 
437
312
  ## Refactoring-Specific Features
438
313
 
439
314
  ### Behavior Preservation Check
440
- Every item MUST declare a behavior preservation strategy. Read `${SKILL_DIR}/references/behavior-preservation.md` for strategy details.
441
-
442
- | Strategy | When to Use |
443
- |----------|-------------|
444
- | `test-gate` | Target area has good test coverage. Run full test suite after each change. |
445
- | `snapshot` | Compare output/state before and after. Used when tests are insufficient but behavior is observable. |
446
- | `manual` | Human verification required. Last resort when neither tests nor snapshots are feasible. |
447
315
 
448
- Flag items using `manual` strategy prominently they carry the highest risk of behavior regression.
316
+ 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.
449
317
 
450
318
  ### Dependency Ordering
451
- Auto-detect inter-item dependencies and enforce safe ordering:
452
- 1. **Safe renames** first (lowest risk, no structural change)
453
- 2. **Extract/inline** operations (moderate risk, changes module boundaries)
454
- 3. **Structural changes** (higher risk, reorganizes architecture)
455
- 4. **Migrations** last (highest risk, changes patterns/paradigms)
319
+
320
+ 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).
456
321
 
457
322
  ### Complexity Assessment
458
- Assess each item's complexity based on:
459
- - **File count**: 1-2 files = low, 3-5 files = medium, 6+ files = high
460
- - **Cross-module scope**: same module = low, 2 modules = medium, 3+ modules = high
461
- - **Test coverage**: high coverage = reduces complexity, low coverage = increases complexity
462
- - **Pattern familiarity**: well-known pattern = low, novel restructuring = high
463
323
 
464
- Take the highest of these individual assessments as the item's complexity.
324
+ 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.
465
325
 
466
326
  ## Next-Step Execution Policy (after planning)
467
327
 
@@ -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
+ ```bash
37
+ python3 ${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.
@@ -139,59 +139,11 @@ Record everything the user provides — these become inputs for Step 1.3.
139
139
 
140
140
  ### Step 1.3: Parallel Deep Reading
141
141
 
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.
142
+ 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
143
 
160
144
  ### Step 1.4: Discuss Refactoring Plan
161
145
 
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)
146
+ 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
147
 
196
148
  ### Step 1.5: Confirm and Supplement
197
149
 
@@ -202,62 +154,11 @@ After the discussion:
202
154
  3. **Identify gaps** — if any areas are still unclear, list them explicitly and ask follow-up questions
203
155
  4. **Repeat** until the user confirms: "That covers everything" or "Let's proceed"
204
156
 
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
157
+ 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
158
 
219
159
  ### Step 1.6: Requirements Summary
220
160
 
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.
161
+ 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
162
 
262
163
  **CHECKPOINT CP-RW-0**: Refactoring goals fully clarified and confirmed by user.
263
164