prizmkit 1.0.106 → 1.0.109

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.0.106",
3
- "bundledAt": "2026-03-25T15:56:50.507Z",
4
- "bundledFrom": "d91f86f"
2
+ "frameworkVersion": "1.0.109",
3
+ "bundledAt": "2026-03-26T02:14:25.170Z",
4
+ "bundledFrom": "d4369e9"
5
5
  }
@@ -102,8 +102,9 @@ export async function installCommand(corePath, targetRoot) {
102
102
  const skillName = path.basename(corePath);
103
103
  const hasAssets = existsSync(path.join(corePath, 'assets'));
104
104
  const hasScripts = existsSync(path.join(corePath, 'scripts'));
105
+ const hasRules = existsSync(path.join(corePath, 'rules'));
105
106
 
106
- if (hasAssets || hasScripts) {
107
+ if (hasAssets || hasScripts || hasRules) {
107
108
  // Use directory structure for commands with resources
108
109
  const targetDir = path.join(targetRoot, COMMANDS_DIR, skillName);
109
110
  mkdirSync(targetDir, { recursive: true });
@@ -117,7 +118,7 @@ export async function installCommand(corePath, targetRoot) {
117
118
  }
118
119
 
119
120
  // Copy assets and scripts
120
- for (const subdir of ['scripts', 'assets']) {
121
+ for (const subdir of ['scripts', 'assets', 'rules']) {
121
122
  const srcSubdir = path.join(corePath, subdir);
122
123
  if (existsSync(srcSubdir)) {
123
124
  cpSync(srcSubdir, path.join(targetDir, subdir), { recursive: true });
@@ -58,7 +58,7 @@ export async function installSkill(corePath, targetRoot, options = {}) {
58
58
  }
59
59
 
60
60
  // Copy scripts/ and assets/ if they exist
61
- for (const subdir of ['scripts', 'assets']) {
61
+ for (const subdir of ['scripts', 'assets', 'rules']) {
62
62
  const srcSubdir = path.join(corePath, subdir);
63
63
  if (existsSync(srcSubdir)) {
64
64
  cpSync(srcSubdir, path.join(targetDir, subdir), { recursive: true });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.106",
2
+ "version": "1.0.109",
3
3
  "skills": {
4
4
  "prizm-kit": {
5
5
  "description": "Full-lifecycle dev toolkit. Covers spec-driven development, Prizm context docs, code quality, debugging, deployment, and knowledge management.",
@@ -29,8 +29,51 @@ The bug can come from:
29
29
  - **A description**: "the login page crashes when I click submit"
30
30
  - **A failed test**: "this test is failing: src/auth/__tests__/login.test.ts"
31
31
 
32
+ ## Fast Path
33
+
34
+ For trivial bugs with clear root cause and minimal scope:
35
+
36
+ ### Eligibility Criteria (ALL must be true)
37
+ - Root cause is immediately obvious (typo, missing null check, wrong variable name, off-by-one)
38
+ - Fix is ≤10 lines of code in a single file
39
+ - No cross-module impact
40
+ - Existing tests cover the affected path (or bug is in untested utility)
41
+ - No data model or API changes
42
+
43
+ ### Fast Path Workflow
44
+ 1. Branch Setup → `fix/<BUG_ID>-<short-desc>`
45
+ 2. Write reproduction test → confirm failing
46
+ 3. Apply fix → confirm test passes + full suite green
47
+ 4. Ask user: "Quick fix applied. Verify before commit? (Y/skip)"
48
+ 5. Commit with `fix(<scope>):` prefix
49
+ 6. Ask merge preference
50
+
51
+ **Fast Path still requires**: fix branch, reproduction test, full test suite pass, user merge decision.
52
+
53
+ ---
54
+
32
55
  ## Execution
33
56
 
57
+ ### Phase 0: Branch Setup
58
+
59
+ **Goal**: Create an isolated working branch to keep main clean.
60
+
61
+ 1. **Check current branch**:
62
+ ```bash
63
+ git branch --show-current
64
+ ```
65
+ 2. **If on `main` or a shared branch**: Create and switch to fix branch:
66
+ ```bash
67
+ git checkout -b fix/<BUG_ID>-<short-description>
68
+ ```
69
+ Example: `git checkout -b fix/B-001-login-null-crash`
70
+ 3. **If already on a fix branch**: Confirm with user: "Continue on current branch `<branch-name>`, or create a new one?"
71
+ 4. **Record the original branch name** for later merge.
72
+
73
+ **CHECKPOINT CP-BFW-0**: On a dedicated fix branch, not main/shared branch.
74
+
75
+ ---
76
+
34
77
  ### Phase 1: Triage
35
78
 
36
79
  **Goal**: Understand the bug, locate affected code, classify severity.
@@ -108,23 +151,75 @@ If the fix causes test regressions:
108
151
  Ready to commit.
109
152
  ```
110
153
 
111
- ### Phase 5: Commit
154
+ ### Phase 5: User Verification
155
+
156
+ **Goal**: Let the user verify the fix works as expected before committing.
112
157
 
113
- **Goal**: Commit the fix with proper conventions.
158
+ 1. **Ask user**: "Fix passes all tests. Would you like to verify before committing?"
159
+ - **(a) Run the app** — Start the dev server so you can manually test the fix scenario
160
+ - **(b) Run a specific command** — Specify a test or script to run
161
+ - **(c) Skip verification** — Proceed directly to commit (automated tests already pass)
162
+ 2. **If (a)**: Detect and suggest dev server command (e.g. `npm run dev`, `python manage.py runserver`), start it, wait for user confirmation: "Fix verified? (yes/no)"
163
+ 3. **If (b)**: Run the specified command, show results, ask confirmation
164
+ 4. **If (c)**: Proceed to Phase 6
165
+
166
+ If user reports the fix is NOT working:
167
+ - Return to Phase 3 (max 2 more attempts)
168
+ - If still failing: escalate with analysis
169
+
170
+ ---
171
+
172
+ ### Phase 6: Commit & Merge
173
+
174
+ **Goal**: Commit the fix and offer to merge back to the original branch.
114
175
 
115
176
  1. **Run `/prizmkit-committer`**:
116
177
  - Commit message: `fix(<scope>): <description>`
117
178
  - Include both fix code and reproduction test
118
179
  - Do NOT push (user decides when to push)
119
- - Do NOT run `/prizmkit-retrospective` — bug fixes do not update `.prizm-docs/` (per project rules: "bugs are incomplete features, recording bug details causes doc bloat with no AI value")
180
+ - Do NOT run `/prizmkit-retrospective` — bug fixes do not update `.prizm-docs/`
120
181
  - `/prizmkit-committer` is a pure commit tool — it does NOT modify `.prizm-docs/` or any project files
121
- 2. **If bug came from bug-fix-list.json**: inform user to update bug status
182
+ 2. **Ask merge preference**:
183
+ ```
184
+ Fix committed on branch `fix/<BUG_ID>-<short-desc>`.
185
+ What would you like to do?
186
+ (a) Merge to <original-branch> and delete fix branch
187
+ (b) Keep fix branch (for PR review workflow)
188
+ (c) Decide later
189
+ ```
190
+ 3. **If (a)**:
191
+ ```bash
192
+ git checkout <original-branch>
193
+ git merge fix/<BUG_ID>-<short-description>
194
+ git branch -d fix/<BUG_ID>-<short-description>
195
+ ```
196
+ 4. **If (b)**: Inform user: "Branch `fix/<BUG_ID>-<short-desc>` retained. Create a PR when ready."
197
+ 5. **If bug came from bug-fix-list.json**: inform user to update bug status
122
198
  ```
123
199
  Bug B-001 fixed and committed.
124
200
  To update the bug list: manually set B-001 status to "fixed" in bug-fix-list.json
125
201
  Or retry the pipeline to pick up remaining bugs.
126
202
  ```
127
203
 
204
+ ## Resume — Interruption Recovery
205
+
206
+ The workflow supports resuming from the last completed phase by detecting existing artifacts.
207
+
208
+ **Detection logic**: Check `.prizmkit/bugfix/<BUG_ID>/` and git branch state:
209
+
210
+ | Artifact Found | Resume From |
211
+ |---------------|------------|
212
+ | (nothing) | Phase 0: Branch Setup |
213
+ | On `fix/<BUG_ID>-*` branch, no artifacts | Phase 1: Triage |
214
+ | `fix-plan.md` only | Phase 3: Fix |
215
+ | `fix-plan.md` + code changes exist | Phase 4: Review |
216
+ | All docs + review passed | Phase 5: User Verification |
217
+ | All docs + committed | Phase 6: Merge decision |
218
+
219
+ **Resume**: If `<BUG_ID>` matches an existing `.prizmkit/bugfix/<BUG_ID>/` directory, resume instead of starting fresh.
220
+
221
+ ---
222
+
128
223
  ## Artifacts
129
224
 
130
225
  Bug fix artifacts are stored at `.prizmkit/bugfix/<BUG_ID>/`:
@@ -138,8 +233,10 @@ Only 2 artifact files per bug, consistent with the pipeline convention.
138
233
  | Dimension | bug-fix-workflow (this skill) | bugfix-pipeline-launcher |
139
234
  |-----------|-------------------------------|--------------------------|
140
235
  | Scope | One bug at a time | All bugs in batch |
141
- | Execution | Interactive, in-session | Background daemon |
236
+ | Execution | Interactive, in-session | Foreground or background daemon |
237
+ | Branch | Creates `fix/<BUG_ID>-*` branch | Pipeline manages branches |
142
238
  | Visibility | Full user interaction at each phase | Async, check status periodically |
239
+ | User verification | Yes (Phase 5) | No (automated) |
143
240
  | Best for | Complex bugs needing user input | Batch of well-defined bugs |
144
241
  | Artifacts | Same (fix-plan.md + fix-report.md) | Same |
145
242
  | Commit prefix | `fix(<scope>):` | `fix(<scope>):` |
@@ -153,6 +250,7 @@ Only 2 artifact files per bug, consistent with the pipeline convention.
153
250
  | Fix causes regressions | Revert, analyze, retry (max 3 rounds) |
154
251
  | Root cause unclear after investigation | Present findings, ask user for guidance |
155
252
  | Affected files are in unfamiliar module | Read `.prizm-docs/` L1/L2 for that module first |
253
+ | Branch conflict during merge | Show conflict, ask user to resolve or keep branch |
156
254
 
157
255
  ## HANDOFF
158
256
 
@@ -161,11 +259,11 @@ Only 2 artifact files per bug, consistent with the pipeline convention.
161
259
  | `bug-planner` | **this skill** | User picks one bug to fix interactively |
162
260
  | `bugfix-pipeline-launcher` | **this skill** | User wants to fix a stuck/complex bug manually |
163
261
  | **this skill** | `bugfix-pipeline-launcher` | After fixing, user wants to continue with remaining bugs |
164
- | **this skill** | `prizmkit-committer` | Built into Phase 5 (pure commit, no doc sync) |
262
+ | **this skill** | `prizmkit-committer` | Built into Phase 6 (pure commit, no doc sync) |
165
263
 
166
264
  ## Output
167
265
 
168
266
  - Fixed code with reproduction test
169
267
  - `.prizmkit/bugfix/<BUG_ID>/fix-plan.md`
170
268
  - `.prizmkit/bugfix/<BUG_ID>/fix-report.md`
171
- - Git commit with `fix(<scope>):` prefix
269
+ - Git commit with `fix(<scope>):` prefix on dedicated fix branch
@@ -5,11 +5,25 @@ description: "Launch and manage the bugfix pipeline from within an AI CLI sessio
5
5
 
6
6
  # Bugfix-Pipeline Launcher
7
7
 
8
- Launch the autonomous bug fix pipeline from within an AI CLI conversation. The pipeline runs as a fully detached background process -- closing the AI CLI session does NOT stop the pipeline.
8
+ Launch the autonomous bug fix pipeline from within an AI CLI conversation. Supports foreground and background execution modes.
9
9
 
10
10
  ### Execution Mode
11
11
 
12
- Always use daemon mode via `dev-pipeline/launch-bugfix-daemon.sh` for start/stop/status/log actions. Foreground `run-bugfix.sh` can be terminated by AI CLI command timeout, while daemon mode survives session timeout — this prevents half-finished bug fixes that leave the codebase in an inconsistent state.
12
+ **Default: Foreground mode** via `dev-pipeline/run-bugfix.sh run` this provides visible output and direct error feedback. Use `launch-bugfix-daemon.sh` only when the user explicitly requests background execution.
13
+
14
+ Foreground `run-bugfix.sh` is preferred because:
15
+ - Immediate visibility of errors and progress
16
+ - No orphaned processes if something goes wrong
17
+ - Session summary artifacts are written reliably
18
+
19
+ Use daemon mode (`launch-bugfix-daemon.sh`) only when:
20
+ - User explicitly requests background/detached execution
21
+ - Pipeline must survive AI CLI session closure
22
+
23
+ **Background mode documentation**: When the user chooses background/daemon mode, record the choice and PID in `.prizmkit/bugfix-pipeline-run.log` (append-only) with timestamp, so the decision is traceable:
24
+ ```
25
+ [2026-03-26T10:30:00] MODE=daemon PID=12345 BUG_LIST=bug-fix-list.json BUGS=3
26
+ ```
13
27
 
14
28
  ### When to Use
15
29
 
@@ -41,7 +55,7 @@ Always use daemon mode via `dev-pipeline/launch-bugfix-daemon.sh` for start/stop
41
55
 
42
56
  Before any action, validate:
43
57
 
44
- 1. **bugfix pipeline exists**: Confirm `dev-pipeline/launch-bugfix-daemon.sh` is present and executable
58
+ 1. **bugfix pipeline exists**: Confirm `dev-pipeline/launch-bugfix-daemon.sh` and `dev-pipeline/run-bugfix.sh` are present and executable
45
59
  2. **For start**: `bug-fix-list.json` must exist in project root (or user-specified path)
46
60
  3. **Dependencies**: `jq`, `python3`, AI CLI (`cbc` or `claude`) must be in PATH
47
61
 
@@ -100,33 +114,61 @@ Detect user intent from their message, then follow the corresponding workflow:
100
114
  --action status 2>/dev/null
101
115
  ```
102
116
 
103
- 4. **Ask user to confirm**: "Ready to launch the bugfix pipeline? It will process N bugs (by severity order) in the background."
117
+ 4. **Ask execution mode**: Present the user with a choice before launching:
118
+ - **(1) Foreground in session (recommended)**: Pipeline runs in the current session via `run-bugfix.sh run`. Visible output and direct error feedback.
119
+ - **(2) Background daemon**: Pipeline runs fully detached via `launch-bugfix-daemon.sh`. Survives session closure. Use only when user explicitly requests background execution.
120
+ - **(3) Manual — show commands**: Display the exact commands the user can run themselves. No execution.
121
+
122
+ Default to option 1 if user says "just run it" or doesn't specify. Default to option 2 only if user explicitly says "background", "detached", or "run in background".
123
+
124
+ **If option 1 (foreground)**:
125
+ ```bash
126
+ dev-pipeline/run-bugfix.sh run bug-fix-list.json
127
+ ```
104
128
 
105
- 5. **Launch**:
129
+ **If option 2 (background)**:
106
130
  ```bash
107
131
  dev-pipeline/launch-bugfix-daemon.sh start bug-fix-list.json
108
132
  ```
109
- If user specified environment overrides (e.g. timeout, retries, verbose):
133
+ After launch, **record the decision** for traceability:
110
134
  ```bash
111
- dev-pipeline/launch-bugfix-daemon.sh start bug-fix-list.json --env "SESSION_TIMEOUT=7200 MAX_RETRIES=5"
135
+ echo "[$(date -u +%Y-%m-%dT%H:%M:%S)] MODE=daemon PID=$(cat dev-pipeline/bugfix-state/daemon.pid 2>/dev/null) BUG_LIST=bug-fix-list.json BUGS=$(python3 -c "import json; print(len(json.load(open('bug-fix-list.json')).get('bugs',[])))")" >> .prizmkit/bugfix-pipeline-run.log
112
136
  ```
137
+ Note: Pipeline runs fully detached. Survives session closure.
138
+
139
+ **If option 3 (manual)**: Print commands and stop. Do not execute anything.
140
+ ```
141
+ # To run in foreground (recommended):
142
+ dev-pipeline/run-bugfix.sh run bug-fix-list.json
143
+
144
+ # To run in background (detached):
145
+ dev-pipeline/launch-bugfix-daemon.sh start bug-fix-list.json
146
+
147
+ # To check status:
148
+ dev-pipeline/run-bugfix.sh status bug-fix-list.json
149
+ ```
150
+
151
+ 5. **Ask user to confirm**: "Ready to launch the bugfix pipeline? It will process N bugs (by severity order)."
152
+
153
+ 6. **Launch** (based on chosen mode — see step 4).
113
154
 
114
- 6. **Verify launch**:
155
+ 7. **Verify launch**:
115
156
  ```bash
116
157
  dev-pipeline/launch-bugfix-daemon.sh status
117
158
  ```
118
159
 
119
- 7. **Start log monitoring** -- Use the Bash tool with `run_in_background: true`:
160
+ 8. **Start log monitoring** (daemon mode only) -- Use the Bash tool with `run_in_background: true`:
120
161
  ```bash
121
162
  tail -f dev-pipeline/bugfix-state/pipeline-daemon.log
122
163
  ```
123
164
  This runs in background so you can continue interacting with the user.
124
165
 
125
- 8. **Report to user**:
126
- - Pipeline PID
166
+ 9. **Report to user**:
167
+ - Execution mode chosen
168
+ - Pipeline PID (daemon mode) or session status (foreground)
127
169
  - Log file location
128
170
  - "You can ask me 'bugfix status' or 'show fix logs' at any time"
129
- - "Closing this session will NOT stop the pipeline"
171
+ - (daemon mode only) "Closing this session will NOT stop the pipeline"
130
172
 
131
173
  ---
132
174
 
@@ -246,9 +288,10 @@ SESSION_TIMEOUT=3600 dev-pipeline/retry-bug.sh B-001 bug-fix-list.json
246
288
  ### Integration Notes
247
289
 
248
290
  - **After bug-planner**: This is the natural next step. When user finishes bug planning and has `bug-fix-list.json`, suggest launching the bugfix pipeline.
249
- - **Session independence**: The bugfix pipeline runs completely detached. User can close the AI CLI, open a new session later, and use this skill to check progress or stop the pipeline.
291
+ - **Session independence**: In daemon mode, the bugfix pipeline runs completely detached. User can close the AI CLI, open a new session later, and use this skill to check progress or stop the pipeline.
250
292
  - **Single instance**: Only one bugfix pipeline can run at a time. The PID file prevents duplicates.
251
293
  - **Feature pipeline coexistence**: Bugfix and feature pipelines use separate state directories (`bugfix-state/` vs `state/`), so they can run simultaneously without conflict.
252
294
  - **State preservation**: Stopping and restarting the bugfix pipeline resumes from where it left off -- completed bugs are not re-fixed.
253
295
  - **Bug ordering**: Bugs are processed by severity (critical → high → medium → low), then by priority number within the same severity.
296
+ - **Background mode traceability**: When daemon mode is chosen, the decision is logged to `.prizmkit/bugfix-pipeline-run.log` with timestamp, PID, and bug count for auditability.
254
297
  - **HANDOFF**: After pipeline completes all bugs, suggest running `prizmkit-retrospective` to capture lessons learned, or checking the fix reports in `.prizmkit/bugfix/`.
@@ -32,7 +32,7 @@ feature-workflow <requirements description>
32
32
 
33
33
  ├── Phase 1: Plan → app-planner → feature-list.json
34
34
 
35
- ├── Phase 2: Launch → dev-pipeline-launcher → background pipeline
35
+ ├── Phase 2: Launch → dev-pipeline-launcher → pipeline execution
36
36
 
37
37
  └── Phase 3: Monitor → track progress → report results
38
38
  ```
@@ -42,7 +42,7 @@ feature-workflow <requirements description>
42
42
  | Phase | Action | Result |
43
43
  |-------|--------|--------|
44
44
  | 1 | Call `app-planner` | `feature-list.json` with N features |
45
- | 2 | Call `dev-pipeline-launcher` | Background pipeline started |
45
+ | 2 | Call `dev-pipeline-launcher` | Pipeline started (execution mode chosen by user via launcher) |
46
46
  | 3 | Monitor progress | Status updates, completion report |
47
47
 
48
48
  ### Why This Skill Exists
@@ -56,6 +56,13 @@ With this skill, users can:
56
56
  1. Say "Build a task management App" and walk away
57
57
  2. All planning + execution happens automatically
58
58
 
59
+ ### Branch Management
60
+
61
+ The dev-pipeline handles branch management per-feature automatically:
62
+ - Each feature is implemented on its own branch by the pipeline
63
+ - Branches are created, committed, and managed by the pipeline session
64
+ - This workflow does NOT create a top-level branch — the pipeline manages granular per-feature branches
65
+
59
66
  ---
60
67
 
61
68
  ## Input Modes
@@ -112,7 +119,7 @@ When user says "add features to existing project" or the project already has fea
112
119
 
113
120
  ## Phase 2: Launch
114
121
 
115
- **Goal**: Start the background development pipeline.
122
+ **Goal**: Start the development pipeline.
116
123
 
117
124
  **STEPS**:
118
125
 
@@ -123,27 +130,20 @@ When user says "add features to existing project" or the project already has fea
123
130
  F-002: Task CRUD (medium complexity)
124
131
  F-003: Task categories (low complexity)
125
132
 
126
- Pipeline will run in background. Close this session will NOT stop it.
127
133
  Proceed? (Y/n)
128
134
  ```
129
135
 
130
- 2. **Ask execution mode**: Before invoking the launcher, present the choice:
131
- - **(1) Background daemon (recommended)**: Runs detached, survives session closure.
132
- - **(2) Foreground in session**: Runs in current session with visible output. Stops if session times out.
133
- - **(3) Manual — show commands**: Display commands only, no execution.
134
-
135
- Pass the chosen mode to `dev-pipeline-launcher`.
136
-
137
- 3. **Invoke `dev-pipeline-launcher` skill**:
136
+ 2. **Invoke `dev-pipeline-launcher` skill**:
138
137
  - The launcher handles all prerequisites checks
139
- - Starts `launch-daemon.sh` in background
140
- - Returns PID and log file location
138
+ - The launcher presents execution mode choices to the user (foreground/background/manual)
139
+ - Do NOT duplicate execution mode selection here — let the launcher handle it
140
+ - Returns PID/status and log file location
141
141
 
142
- 4. **Verify launch success**:
142
+ 3. **Verify launch success**:
143
143
  - Confirm pipeline is running
144
144
  - Record PID and log path for Phase 3
145
145
 
146
- **CHECKPOINT CP-FW-2**: Pipeline launched successfully in background.
146
+ **CHECKPOINT CP-FW-2**: Pipeline launched successfully.
147
147
 
148
148
  ---
149
149
 
@@ -173,7 +173,7 @@ When user says "add features to existing project" or the project already has fea
173
173
 
174
174
  4. **Completion report** (when pipeline finishes all features):
175
175
  ```
176
- Pipeline completed: 3/3 features
176
+ Pipeline completed: 3/3 features
177
177
 
178
178
  Summary:
179
179
  - F-001: User authentication → COMMITTED (feat: user auth)
@@ -190,9 +190,24 @@ When user says "add features to existing project" or the project already has fea
190
190
 
191
191
  ---
192
192
 
193
+ ## Resume — Interruption Recovery
194
+
195
+ The workflow supports resuming by detecting existing state:
196
+
197
+ | State Found | Resume From |
198
+ |-------------|------------|
199
+ | No `feature-list.json` | Phase 1: Plan |
200
+ | `feature-list.json` exists, no pipeline state | Phase 2: Launch |
201
+ | `feature-list.json` + pipeline state exists | Phase 3: Monitor (check status) |
202
+ | All features completed | Report completion, suggest next steps |
203
+
204
+ **Resume**: If `feature-list.json` exists, ask user: "Existing feature plan found with N features. Resume pipeline or re-plan?"
205
+
206
+ ---
207
+
193
208
  ## Interaction During Pipeline
194
209
 
195
- While the pipeline runs in background, the user can continue the conversation:
210
+ While the pipeline runs, the user can continue the conversation:
196
211
 
197
212
  | User says | Action |
198
213
  |-----------|--------|
@@ -220,7 +235,7 @@ While the pipeline runs in background, the user can continue the conversation:
220
235
  | Skill | Relationship |
221
236
  |-------|-------------|
222
237
  | `app-planner` | **Called by Phase 1** — generates feature-list.json |
223
- | `dev-pipeline-launcher` | **Called by Phase 2** — starts background pipeline |
238
+ | `dev-pipeline-launcher` | **Called by Phase 2** — starts pipeline (handles execution mode selection) |
224
239
  | `bug-planner` | **Alternative** — for bug fix workflows |
225
240
  | `bugfix-pipeline-launcher` | **Alternative** — for bug fix pipelines |
226
241
  | `refactor-workflow` | **Alternative** — for code restructuring |
@@ -233,9 +248,11 @@ While the pipeline runs in background, the user can continue the conversation:
233
248
  |-----------|-----------------|------------------|-------------------|
234
249
  | **Purpose** | New features (batch) | Single bug fix (interactive) | Code restructuring |
235
250
  | **Planning Skill** | `app-planner` | None (triage built-in) | None (analysis built-in) |
236
- | **Execution** | Background daemon | In-session, interactive | In-session |
251
+ | **Branch** | Pipeline manages per-feature | `fix/<BUG_ID>-*` | `refactor/<slug>` |
252
+ | **Execution** | Foreground or background daemon | In-session, interactive | In-session |
237
253
  | **Input** | Requirements description | Bug report / stack trace | Module / code target |
238
254
  | **Output** | Multiple `feat()` commits | Single `fix()` commit | Single `refactor()` commit |
255
+ | **User verification** | No (pipeline automated) | Yes (Phase 5) | Yes (Phase 5) |
239
256
  | **Batch alternative** | (this is the batch flow) | `bug-planner` + `bugfix-pipeline-launcher` | N/A |
240
257
 
241
258
  ---
@@ -247,7 +264,7 @@ All internal asset paths use `${SKILL_DIR}` placeholder for cross-IDE compatibil
247
264
  ## Output
248
265
 
249
266
  - `feature-list.json` (Phase 1 artifact)
250
- - Background pipeline running (Phase 2)
267
+ - Pipeline execution (Phase 2)
251
268
  - Progress updates (Phase 3)
252
269
  - Multiple git commits with `feat(<scope>):` prefix
253
270
  - Updated `.prizm-docs/` (via prizmkit-retrospective per feature)
@@ -71,6 +71,21 @@ PrizmKit produces two complementary knowledge layers:
71
71
  .prizmkit/specs/ → Feature "what to do" (workflow: spec → plan → code(implement))
72
72
  ```
73
73
 
74
+ ## Core Skill Reference
75
+
76
+ | Skill | Purpose | Trigger Phrases |
77
+ |-------|---------|-----------------|
78
+ | `/prizmkit-specify` | Natural language → structured spec.md | "specify", "new feature", "I want to add..." |
79
+ | `/prizmkit-clarify` | Resolve spec ambiguities interactively | "clarify", "refine spec", "resolve ambiguities" |
80
+ | `/prizmkit-plan` | Spec → plan.md with architecture + tasks | "plan", "architect", "break it down", "create tasks" |
81
+ | `/prizmkit-analyze` | Cross-doc consistency check (read-only) | "analyze", "check consistency", "validate spec" |
82
+ | `/prizmkit-implement` | Execute plan.md tasks, write code (TDD) | "implement", "build", "code it", "start coding" |
83
+ | `/prizmkit-code-review` | Diagnose issues + produce Fix Instructions | "review", "check code", "is it ready to commit" |
84
+ | `/prizmkit-retrospective` | Sync .prizm-docs/ with code changes | "retrospective", "retro", "sync docs", "wrap up" |
85
+ | `/prizmkit-committer` | Safe git commit with Conventional Commits | "commit", "submit", "finish", "ship it" |
86
+ | `/prizmkit-init` | Project bootstrap + .prizm-docs/ setup | "init", "initialize", "take over this project" |
87
+ | `/prizmkit-prizm-docs` | Doc management (init/status/rebuild/validate) | "check docs", "rebuild docs", "validate docs" |
88
+
74
89
  **Reading guide**:
75
90
  - Need code structure/modules/interfaces/traps/decisions? → `.prizm-docs/`
76
91
 
@@ -12,7 +12,12 @@ Perform a non-destructive cross-artifact consistency and quality analysis across
12
12
  - User says "analyze", "check consistency", "validate spec", "review plan"
13
13
  - Before `/prizmkit-implement` as a quality gate
14
14
 
15
- **PRECONDITION:** `spec.md` and `plan.md` exist in `.prizmkit/specs/###-feature-name/`. `plan.md` must include a Tasks section.
15
+ **PRECONDITION:**
16
+
17
+ | Required Artifact | Directory | Check | If Missing |
18
+ |---|---|---|---|
19
+ | `spec.md` | `.prizmkit/specs/###-feature-name/` | File exists | Run `/prizmkit-specify` |
20
+ | `plan.md` (with Tasks section) | `.prizmkit/specs/###-feature-name/` | File exists + has Tasks section | Run `/prizmkit-plan` |
16
21
 
17
22
  ## Operating Constraints
18
23
 
@@ -12,7 +12,11 @@ Interactive requirement clarification that resolves ambiguities in feature speci
12
12
  - User says "clarify", "resolve ambiguities", "refine spec"
13
13
  - Before `/prizmkit-plan` to ensure spec is unambiguous
14
14
 
15
- **PRECONDITION:** `spec.md` exists in current feature directory (`.prizmkit/specs/###-feature-name/`)
15
+ **PRECONDITION:**
16
+
17
+ | Required Artifact | Directory | Check | If Missing |
18
+ |---|---|---|---|
19
+ | `spec.md` | `.prizmkit/specs/###-feature-name/` | File exists with `[NEEDS CLARIFICATION]` markers or underspecified areas | Run `/prizmkit-specify` first |
16
20
 
17
21
  ## Execution Steps
18
22
 
@@ -7,8 +7,8 @@ description: "Code review with fix strategy formulation. Diagnoses issues across
7
7
 
8
8
  Perform a comprehensive code review against the feature spec, implementation plan, and project best practices. This skill has two phases:
9
9
 
10
- 1. **Diagnostic Review** — read-only analysis across 6 dimensions, producing findings with severity ratings
11
- 2. **Fix Strategy Formulation** — for each finding, analyze root cause, impact, and produce actionable Fix Instructions with verification criteria
10
+ 1. **Diagnostic Review** — read-only analysis producing findings with severity ratings
11
+ 2. **Fix Strategy Formulation** — for each finding, produce actionable Fix Instructions
12
12
 
13
13
  The review itself is read-only. Fix Instructions are structured guidance for the developer — the reviewer does not modify code.
14
14
 
@@ -17,58 +17,35 @@ The review itself is read-only. Fix Instructions are structured guidance for the
17
17
  - User says "review", "check code", "review my implementation"
18
18
  - As a quality gate before `/prizmkit-committer`
19
19
 
20
- **PRECONDITION (multi-mode):**
21
- - **Feature mode**: `spec.md` and `plan.md` (with Tasks section) exist in `.prizmkit/specs/###-feature-name/` with completed tasks
22
- - **Refactor mode**: `refactor-analysis.md` and `plan.md` (with Tasks section) exist in `.prizmkit/refactor/<refactor-slug>/` with completed tasks. No `spec.md` is needed — review against `refactor-analysis.md` goals and behavior preservation instead.
23
- - **Bugfix mode**: `fix-plan.md` exists in `.prizmkit/bugfix/<BUG_ID>/` with completed tasks. Review against the bug description and reproduction test.
24
- - **Auto-detect**: Check which artifact directory was passed by the calling workflow, or scan `.prizmkit/` for the most recently modified feature/refactor/bugfix directory.
20
+ **PRECONDITION:**
21
+
22
+ | Mode | Required Artifacts | Directory | Check | If Missing |
23
+ |---|---|---|---|---|
24
+ | **Feature** | `spec.md` + `plan.md` (with Tasks) | `.prizmkit/specs/###-feature-name/` | Files exist + tasks completed | Run `/prizmkit-implement` |
25
+ | **Refactor** | `refactor-analysis.md` + `plan.md` (with Tasks) | `.prizmkit/refactor/<refactor-slug>/` | Files exist + tasks completed. Review against behavior preservation, not spec. | Run `/prizmkit-implement` in refactor mode |
26
+ | **Bugfix** | `fix-plan.md` | `.prizmkit/bugfix/<BUG_ID>/` | File exists + tasks completed. Review against bug description + reproduction test. | Run `/prizmkit-implement` in bugfix mode |
27
+
28
+ **Auto-detect**: Check which artifact directory was passed by the calling workflow, or scan `.prizmkit/` for the most recently modified feature/refactor/bugfix directory.
25
29
 
26
30
  ## Phase 1: Diagnostic Review
27
31
 
28
- 1. **Detect mode and load review baseline**:
29
- - If `spec.md` exists → **Feature mode**: read `spec.md` + `plan.md` as baseline. Review dimensions: spec compliance, plan adherence, code quality, security, consistency, test coverage.
30
- - If `refactor-analysis.md` exists → **Refactor mode**: read `refactor-analysis.md` + `plan.md` as baseline. Review dimensions shift: replace "spec compliance" with **behavior preservation** (observable behavior unchanged), replace "plan adherence" with **structural improvement** (is the code measurably better?). Also check test integrity and code quality.
31
- - If `fix-plan.md` exists → **Bugfix mode**: read `fix-plan.md` as baseline. Review dimensions: bug is actually fixed, no regressions, reproduction test passes, minimal change scope.
32
+ 1. **Detect mode and load review baseline + dimension rules**:
33
+ - If `spec.md` exists → **Feature mode**: read `spec.md` + `plan.md` as baseline. Load `${SKILL_DIR}/rules/dimensions-feature.md` for review dimensions.
34
+ - If `refactor-analysis.md` exists → **Refactor mode**: read `refactor-analysis.md` + `plan.md` as baseline. Load `${SKILL_DIR}/rules/dimensions-refactor.md` for review dimensions.
35
+ - If `fix-plan.md` exists → **Bugfix mode**: read `fix-plan.md` as baseline. Load `${SKILL_DIR}/rules/dimensions-bugfix.md` for review dimensions.
32
36
  - If none found → prompt user: "No review baseline found. Which workflow are you in? (feature/refactor/bugfix)"
33
37
  2. Read **architecture index**: `.prizm-docs/root.prizm` RULES and PATTERNS for project conventions
34
38
  3. Read **past decisions**: check DECISIONS sections in relevant `.prizm-docs/` L1/L2 files — helps verify implementation respects established conventions
35
39
  4. Read '## Implementation Log' section of context-snapshot.md in the feature directory (if exists) — understand Dev's implementation decisions, trade-offs, and notable discoveries. This context helps distinguish intentional design choices from accidental patterns during review.
36
40
  5. Scan all code files referenced in completed tasks
37
- 6. Review across 6 dimensions:
38
- - **Spec compliance**: Does code implement all acceptance criteria? Missing criteria are the #1 source of "it works but it's wrong" bugs
39
- - **Plan adherence**: Does implementation follow architectural decisions in plan.md? Deviations may be improvements or may break assumptions other components depend on
40
- - **Code quality**: Naming, structure, complexity, DRY. Focus on maintainability — will someone understand this code in 6 months?
41
- - **Security**: Injection (SQL, XSS, command), auth/authz gaps, sensitive data exposure, insecure defaults. Security issues are always HIGH+ because they're the hardest to catch later
42
- - **Consistency**: Follows project patterns from `.prizm-docs/` PATTERNS section. Inconsistent patterns increase cognitive load for every future reader
43
- - **Test coverage**: Are critical paths tested? Focus on paths that handle user input, money, or state transitions
41
+ 6. Review across all dimensions defined in the loaded rules file
44
42
  7. Generate findings with severity: `CRITICAL` > `HIGH` > `MEDIUM` > `LOW`
45
43
 
46
44
  ## Phase 2: Fix Strategy Formulation
47
45
 
48
- For each finding from Phase 1 (CRITICAL and HIGH are mandatory; MEDIUM/LOW when actionable):
49
-
50
- 1. **Root Cause Analysis** — identify WHY the problem exists, not just WHAT is wrong. Trace the issue to its origin (wrong assumption? missing context? copy-paste error?)
51
- 2. **Impact Analysis** — search the codebase for all callers/dependents of the affected code. List concrete file:line locations that will be affected by the fix
52
- 3. **Fix Strategy** — concrete step-by-step modification plan:
53
- - What to change, where, and in what order
54
- - Which project conventions to follow (reference `.prizm-docs/` RULES)
55
- - Dependencies between fixes (FIX-1 must be done before FIX-3)
56
- 4. **Code Guidance** — show before/after code snippets for the key change. Keep minimal — enough to unambiguate the approach, not a full implementation
57
- 5. **Verification Criteria** — how to confirm the fix works:
58
- - Specific commands to run (grep patterns, test commands)
59
- - What the output should look like
60
- - Edge cases to verify
61
-
62
- ### Finding Grouping
63
-
64
- Group related findings that should be fixed together. If FIX-1 and FIX-3 share the same root cause or affect the same code path, mark them as a group with a shared fix strategy. This prevents Dev from fixing symptoms individually only to have the underlying cause persist.
46
+ Load `${SKILL_DIR}/rules/fix-strategy.md` for the complete fix formulation process, finding format, grouping rules, and priority ordering.
65
47
 
66
- ### Fix Priority Ordering
67
-
68
- Order Fix Instructions by:
69
- 1. **Dependencies first** — if FIX-2 depends on FIX-1, FIX-1 comes first
70
- 2. **CRITICAL before HIGH** — severity determines priority within independent fixes
71
- 3. **Grouped fixes together** — related findings are adjacent
48
+ For each finding from Phase 1 (CRITICAL and HIGH are mandatory; MEDIUM/LOW when actionable), follow the fix strategy rules to produce structured Fix Instructions.
72
49
 
73
50
  ## Severity & Verdict
74
51
 
@@ -83,65 +60,6 @@ Cap findings at 30 to keep the review actionable. If there are more, summarize t
83
60
 
84
61
  If you're unsure whether something is a bug or intentional design, flag it as MEDIUM with a note asking the developer to confirm. Don't silently skip uncertain findings.
85
62
 
86
- ## Finding Format
87
-
88
- ```
89
- #### FIX-1: [CRITICAL] SQL Injection in User Search
90
- - Location: src/services/userService.ts:47
91
- - Dimension: security
92
- - Root Cause: User input `searchTerm` is interpolated directly into SQL query
93
- string. The `buildQuery()` helper (line 12) accepts raw strings without
94
- sanitization, and all callers trust it blindly.
95
- - Impact: All callers of `searchUsers()` are affected — found 3 call sites:
96
- routes/api.ts:89, routes/admin.ts:34, services/reportService.ts:112
97
- - Fix Strategy:
98
- 1. Replace string interpolation with parameterized query at line 47
99
- 2. Update `buildQuery()` helper to accept params array
100
- 3. Update all 3 call sites to pass params
101
- Note: project uses `pg` client directly (not ORM), follow the pattern
102
- established in `orderService.ts:23` per .prizm-docs/ RULES
103
- - Code Guidance:
104
- ```ts
105
- // line 47: change from
106
- const result = await db.query(`SELECT * FROM users WHERE name LIKE '%${searchTerm}%'`);
107
- // to
108
- const result = await db.query('SELECT * FROM users WHERE name LIKE $1', [`%${searchTerm}%`]);
109
- ```
110
- - Verification:
111
- - `grep -rn "\${.*}" src/ --include="*.ts"` returns no SQL-context matches
112
- - Test `user.search.test.ts` covers parameterized path
113
- - Existing test suite passes
114
- - Related: FIX-3 (same pattern in reportService)
115
- - Depends On: (none)
116
- - Blocks: FIX-3
117
-
118
- #### FIX-2: [HIGH] Missing Acceptance Criterion AC-3
119
- - Location: src/routes/upload.ts
120
- - Dimension: spec-compliance
121
- - Root Cause: spec.md §AC-3 requires "display progress bar during upload" but
122
- the upload handler uses a simple fetch() without progress tracking.
123
- Implementation Log does not mention this criterion — likely overlooked.
124
- - Impact: Upload route only — no cross-module impact
125
- - Fix Strategy:
126
- 1. Replace fetch() with XMLHttpRequest or fetch + ReadableStream
127
- 2. Add progress callback that emits percentage events
128
- 3. Wire progress events to the UI component (if frontend exists)
129
- - Code Guidance:
130
- ```ts
131
- // Replace simple fetch with progress-aware upload
132
- const xhr = new XMLHttpRequest();
133
- xhr.upload.onprogress = (e) => {
134
- if (e.lengthComputable) onProgress(Math.round(e.loaded / e.total * 100));
135
- };
136
- ```
137
- - Verification:
138
- - Upload a file > 1MB and verify progress callback fires
139
- - Test covers progress event emission
140
- - Related: (none)
141
- - Depends On: (none)
142
- - Blocks: (none)
143
- ```
144
-
145
63
  ## Review Notes Format
146
64
 
147
65
  When writing to context-snapshot.md, use this structured format:
@@ -156,7 +74,7 @@ When writing to context-snapshot.md, use this structured format:
156
74
  ### Fix Instructions (ordered by priority)
157
75
 
158
76
  #### FIX-1: [SEVERITY] Title
159
- (full finding format as above)
77
+ (finding format per ${SKILL_DIR}/rules/fix-strategy.md)
160
78
 
161
79
  #### FIX-2: [SEVERITY] Title
162
80
  ...
@@ -177,7 +95,7 @@ In unattended pipeline mode, the review→fix→review cycle can loop indefinite
177
95
  - Track a `review_iteration` counter starting at 1. Each review-fix-review cycle increments the counter.
178
96
  - **max_iterations = 5**: If `review_iteration >= 5`, you MUST proceed to `/prizmkit-retrospective` regardless of remaining findings. Log remaining issues as known technical debt: "Loop protection triggered — proceeding to retrospective with N unresolved findings (iterations: 5/5)."
179
97
  - Unresolved findings should be recorded in the review report so they can be tracked as follow-up work.
180
- - On re-review (iteration > 1): only check the specific Verification Criteria from previous Fix Instructions + scan for regressions. Do NOT re-run the full 6-dimension review unless new code was added beyond the fix scope.
98
+ - On re-review (iteration > 1): only check the specific Verification Criteria from previous Fix Instructions + scan for regressions. Do NOT re-run the full dimension review unless new code was added beyond the fix scope.
181
99
 
182
100
  ## Output
183
101
 
@@ -0,0 +1,25 @@
1
+ # Review Dimensions — Bugfix Mode
2
+
3
+ Review code against `fix-plan.md` and the bug description. Minimal scope — the fix should change as little as possible.
4
+
5
+ ## Bugfix-Specific Dimensions
6
+
7
+ ### Bug Actually Fixed
8
+ - The reproduction steps from fix-plan.md no longer trigger the bug
9
+ - The root cause identified in fix-plan.md is addressed (not just symptoms)
10
+ - A regression test exists that would catch this bug if reintroduced
11
+
12
+ ### No Regressions
13
+ - All existing tests still pass
14
+ - The fix does not change behavior for non-buggy inputs
15
+ - Related code paths are not inadvertently affected
16
+
17
+ ### Minimal Change Scope
18
+ - Only files directly related to the bug are modified
19
+ - No "while I'm here" refactoring mixed with the fix
20
+ - If scope creep is detected, flag it — those changes belong in a separate commit
21
+
22
+ ### Reproduction Test
23
+ - A test exists that reproduces the exact bug scenario
24
+ - The test would fail on the pre-fix code and pass on the post-fix code
25
+ - The test covers the specific input/state that triggered the bug
@@ -0,0 +1,43 @@
1
+ # Review Dimensions — Feature Mode
2
+
3
+ Review code against `spec.md` and `plan.md` across 6 dimensions:
4
+
5
+ ## 1. Spec Compliance
6
+ Does code implement all acceptance criteria? Missing criteria are the #1 source of "it works but it's wrong" bugs.
7
+ - Check every acceptance criterion in spec.md has a corresponding implementation
8
+ - Verify edge cases mentioned in spec are handled
9
+ - Confirm scope boundaries are respected (no over-implementation, no under-implementation)
10
+
11
+ ## 2. Plan Adherence
12
+ Does implementation follow architectural decisions in plan.md? Deviations may be improvements or may break assumptions other components depend on.
13
+ - Check component structure matches plan's architecture approach
14
+ - Verify data model matches plan's schema design
15
+ - Confirm API contracts (endpoints, request/response) match plan
16
+
17
+ ## 3. Code Quality
18
+ Naming, structure, complexity, DRY. Focus on maintainability — will someone understand this code in 6 months?
19
+ - Function/variable names are descriptive and consistent with project conventions
20
+ - No unnecessary complexity (cyclomatic complexity, deep nesting)
21
+ - No copy-paste duplication that should be abstracted
22
+ - Error messages are informative for debugging
23
+
24
+ ## 4. Security
25
+ Injection (SQL, XSS, command), auth/authz gaps, sensitive data exposure, insecure defaults. Security issues are always HIGH+ because they're the hardest to catch later.
26
+ - User input is validated and sanitized before use in queries, HTML, or commands
27
+ - Authentication and authorization checks are present on protected routes
28
+ - Sensitive data (passwords, tokens, PII) is not logged or exposed in responses
29
+ - Cryptographic operations use established libraries, not custom implementations
30
+
31
+ ## 5. Consistency
32
+ Follows project patterns from `.prizm-docs/` PATTERNS section. Inconsistent patterns increase cognitive load for every future reader.
33
+ - Code style matches existing codebase conventions
34
+ - Error handling follows established patterns
35
+ - File organization follows project structure conventions
36
+ - Naming conventions align with `.prizm-docs/` RULES
37
+
38
+ ## 6. Test Coverage
39
+ Are critical paths tested? Focus on paths that handle user input, money, or state transitions.
40
+ - Happy path tests exist for each user story
41
+ - Error/edge case tests for critical paths
42
+ - Tests are deterministic (no flaky timing dependencies)
43
+ - Test names clearly describe what they verify
@@ -0,0 +1,25 @@
1
+ # Review Dimensions — Refactor Mode
2
+
3
+ Review code against `refactor-analysis.md` goals. Standard dimensions (code quality, security, consistency, test coverage) still apply — load `${SKILL_DIR}/rules/dimensions-feature.md` §3–§6 for those.
4
+
5
+ ## Refactor-Specific Dimensions
6
+
7
+ ### Behavior Preservation (replaces Spec Compliance)
8
+ Observable behavior must remain unchanged. This is the #1 refactor risk — "improving" code that subtly changes behavior.
9
+ - All existing tests still pass without modification (test changes during refactor are a red flag)
10
+ - Public API signatures are unchanged (parameter types, return types, error types)
11
+ - Side effects (logging, metrics, events) are preserved unless explicitly scoped for removal
12
+ - Edge case handling is preserved — refactors often silently drop edge case branches
13
+
14
+ ### Structural Improvement (replaces Plan Adherence)
15
+ Is the code measurably better against the refactor goals?
16
+ - Complexity metrics improved (fewer nested conditions, shorter functions)
17
+ - Coupling reduced (fewer cross-module imports, clearer boundaries)
18
+ - Duplication reduced (DRY violations eliminated per refactor-analysis.md scope)
19
+ - Readability improved (naming, organization, documentation)
20
+
21
+ ### Test Integrity
22
+ Refactors must not weaken the test suite.
23
+ - No tests were deleted or skipped
24
+ - Test coverage percentage is equal or higher
25
+ - If tests were rewritten, they cover the same behavioral scenarios
@@ -0,0 +1,61 @@
1
+ # Fix Strategy Formulation
2
+
3
+ For each finding from the Diagnostic Review (CRITICAL and HIGH mandatory; MEDIUM/LOW when actionable):
4
+
5
+ ## Per-Finding Analysis
6
+
7
+ ### 1. Root Cause Analysis
8
+ Identify WHY the problem exists, not just WHAT is wrong. Trace the issue to its origin (wrong assumption? missing context? copy-paste error?).
9
+
10
+ ### 2. Impact Analysis
11
+ Search the codebase for all callers/dependents of the affected code. List concrete `file:line` locations that will be affected by the fix.
12
+
13
+ ### 3. Fix Strategy
14
+ Concrete step-by-step modification plan:
15
+ - What to change, where, and in what order
16
+ - Which project conventions to follow (reference `.prizm-docs/` RULES)
17
+ - Dependencies between fixes (FIX-1 must be done before FIX-3)
18
+
19
+ ### 4. Code Guidance
20
+ Show before/after code snippets for the key change. Keep minimal — enough to unambiguate the approach, not a full implementation.
21
+
22
+ ### 5. Verification Criteria
23
+ How to confirm the fix works:
24
+ - Specific commands to run (grep patterns, test commands)
25
+ - What the output should look like
26
+ - Edge cases to verify
27
+
28
+ ## Finding Grouping
29
+
30
+ Group related findings that should be fixed together. If FIX-1 and FIX-3 share the same root cause or affect the same code path, mark them as a group with a shared fix strategy. This prevents Dev from fixing symptoms individually only to have the underlying cause persist.
31
+
32
+ ## Fix Priority Ordering
33
+
34
+ Order Fix Instructions by:
35
+ 1. **Dependencies first** — if FIX-2 depends on FIX-1, FIX-1 comes first
36
+ 2. **CRITICAL before HIGH** — severity determines priority within independent fixes
37
+ 3. **Grouped fixes together** — related findings are adjacent
38
+
39
+ ## Finding Format
40
+
41
+ ```
42
+ #### FIX-N: [SEVERITY] Title
43
+ - Location: file:line
44
+ - Dimension: category
45
+ - Root Cause: explanation
46
+ - Impact: affected callers/dependents with file:line locations
47
+ - Fix Strategy:
48
+ 1. step one
49
+ 2. step two
50
+ Note: reference project conventions from .prizm-docs/ RULES
51
+ - Code Guidance:
52
+ ```language
53
+ // before → after
54
+ ```
55
+ - Verification:
56
+ - command to run
57
+ - expected output
58
+ - Related: FIX-X (if grouped)
59
+ - Depends On: FIX-Y (if dependency)
60
+ - Blocks: FIX-Z (if blocking)
61
+ ```
@@ -14,6 +14,14 @@ Pure git commit workflow. Analyzes changes, generates a Conventional Commits mes
14
14
  - After `/prizmkit-retrospective` has finished architecture sync
15
15
  - The UserPromptSubmit hook will remind to use this skill when commit intent is detected
16
16
 
17
+ **PRECONDITION:**
18
+
19
+ | Required State | Check | If Missing |
20
+ |---|---|---|
21
+ | Uncommitted changes exist | `git status` shows modified/added/untracked files | Inform user "nothing to commit" and stop |
22
+ | `.prizm-docs/` synced (feature/refactor) | `/prizmkit-retrospective` has run | Run `/prizmkit-retrospective` first |
23
+ | Code review passed (pipeline mode) | `context-snapshot.md` has Review Notes with PASS/PASS_WITH_WARNINGS | Run `/prizmkit-code-review` first |
24
+
17
25
  ### Workflow
18
26
 
19
27
  Follow these steps STRICTLY in order:
@@ -32,9 +40,14 @@ By consulting the primary agent or based on the existing context, condense this
32
40
  If CHANGELOG.md exists in the project root, append an entry following Keep a Changelog format under the `[Unreleased]` section. Match the existing style in the file.
33
41
 
34
42
  #### Step 4: Git Commit
35
- ```bash
36
- git add .
37
- ```
43
+
44
+ Stage changes using a safe strategy — **never use `git add .` or `git add -A`** as they may stage sensitive files (.env, credentials, secrets) or unintended changes:
45
+
46
+ 1. Review untracked files with `git status`. Warn the user if any files match sensitive patterns (`.env*`, `*credential*`, `*secret*`, `*.pem`, `*.key`).
47
+ 2. Stage tracked modified files: `git add -u`
48
+ 3. For new files: stage explicitly by name after confirming they should be included.
49
+ 4. Verify staged content with `git diff --cached --stat` before committing.
50
+
38
51
  ```bash
39
52
  git commit -m "<type>(<scope>): <description>"
40
53
  ```
@@ -12,11 +12,15 @@ Execute implementation by following the task breakdown in plan.md. Respects task
12
12
  - User says "implement", "build", "code it", "start coding", "develop"
13
13
  - For fast-path: user describes a simple change directly (fast-path skips specify, but still requires a simplified plan.md with Tasks section)
14
14
 
15
- **PRECONDITION (multi-mode):**
16
- - **Feature mode** (default): `plan.md` exists in `.prizmkit/specs/###-feature-name/` with a Tasks section containing unchecked tasks
17
- - **Refactor mode**: `plan.md` exists in `.prizmkit/refactor/<refactor-slug>/` with a Tasks section containing unchecked tasks
18
- - **Bugfix mode**: `plan.md` exists in `.prizmkit/bugfix/<BUG_ID>/` with a Tasks section containing unchecked tasks
19
- - **Auto-detect**: If the calling workflow passes an explicit artifact directory, use that. Otherwise scan `.prizmkit/` subdirectories for the most recently modified `plan.md` with unchecked tasks.
15
+ **PRECONDITION:**
16
+
17
+ | Mode | Required Artifact | Directory | Check | If Missing |
18
+ |---|---|---|---|---|
19
+ | **Feature** (default) | `plan.md` with Tasks section | `.prizmkit/specs/###-feature-name/` | File exists + unchecked tasks | Run `/prizmkit-plan` |
20
+ | **Refactor** | `plan.md` with Tasks section | `.prizmkit/refactor/<refactor-slug>/` | File exists + unchecked tasks | Run `/prizmkit-plan` in refactor mode |
21
+ | **Bugfix** | `plan.md` with Tasks section | `.prizmkit/bugfix/<BUG_ID>/` | File exists + unchecked tasks | Run `/prizmkit-plan` in bugfix mode |
22
+
23
+ **Auto-detect**: If the calling workflow passes an explicit artifact directory, use that. Otherwise scan `.prizmkit/` subdirectories for the most recently modified `plan.md` with unchecked tasks.
20
24
 
21
25
  ## Execution Steps
22
26
 
@@ -18,11 +18,15 @@ Generate a comprehensive technical implementation plan from a feature specificat
18
18
  - Simple bug fix or config change → use fast path (`/prizmkit-plan` with simplified output → `/prizmkit-implement` → `/prizmkit-committer`)
19
19
  - User just wants to explore/research → answer directly, no plan artifact needed
20
20
 
21
- **PRECONDITION (multi-mode):**
22
- - **Feature mode** (default): `spec.md` exists in `.prizmkit/specs/###-feature-name/`, `.prizm-docs/root.prizm` exists. If spec.md is missing, prompt the user: "No spec found — want me to run /prizmkit-specify first?"
23
- - **Refactor mode**: `refactor-analysis.md` exists in `.prizmkit/refactor/<refactor-slug>/`. Use refactor-analysis.md as the input document in place of spec.md. Output plan.md to the same `.prizmkit/refactor/<refactor-slug>/` directory, NOT to `.prizmkit/specs/`.
24
- - **Bugfix mode**: Bug description provided by caller or `fix-plan.md` exists in `.prizmkit/bugfix/<BUG_ID>/`. Output plan.md to the same directory.
25
- - **Auto-detect**: If the calling workflow passes an explicit artifact directory, use that. Otherwise check which input document type exists.
21
+ **PRECONDITION:**
22
+
23
+ | Mode | Required Artifact | Directory | Check | If Missing |
24
+ |---|---|---|---|---|
25
+ | **Feature** (default) | `spec.md` + `.prizm-docs/root.prizm` | `.prizmkit/specs/###-feature-name/` | File exists | Prompt: "No spec found run `/prizmkit-specify` first?" |
26
+ | **Refactor** | `refactor-analysis.md` | `.prizmkit/refactor/<refactor-slug>/` | File exists | Run upstream refactor workflow |
27
+ | **Bugfix** | `fix-plan.md` or bug description from caller | `.prizmkit/bugfix/<BUG_ID>/` | File exists or caller-provided | Run `/bug-fix-workflow` |
28
+
29
+ **Auto-detect**: If the calling workflow passes an explicit artifact directory, use that. Otherwise check which input document type exists.
26
30
 
27
31
  ## Execution Steps
28
32
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: "refactor-workflow"
3
3
  tier: 1
4
- description: "End-to-end refactor workflow: analyze → plan → implement → review → commit. 5-phase behavior-preserving pipeline with mandatory test gates. Use this skill whenever the user wants to restructure, clean up, or optimize code without changing behavior. Trigger on: 'refactor', 'clean up code', 'restructure', 'optimize code structure', 'extract module', 'code refactoring'. (project)"
4
+ description: "End-to-end refactor workflow: analyze → plan → implement → review → commit. 6-phase behavior-preserving pipeline with mandatory test gates. Use this skill whenever the user wants to restructure, clean up, or optimize code without changing behavior. Trigger on: 'refactor', 'clean up code', 'restructure', 'optimize code structure', 'extract module', 'code refactoring'. (project)"
5
5
  ---
6
6
 
7
7
  # PrizmKit Refactor Workflow
8
8
 
9
- End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills into a 5-phase behavior-preserving pipeline with mandatory test gates after each task.
9
+ End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills into a 6-phase behavior-preserving pipeline with mandatory test gates after each task.
10
10
 
11
11
  ### When to Use
12
12
  - User says "refactor", "clean up code", "restructure", "extract module", "code refactoring", "optimize code structure"
@@ -23,22 +23,24 @@ End-to-end orchestration skill for code refactoring and optimization. Chains exi
23
23
 
24
24
  ```
25
25
  refactor-workflow
26
+ → Phase 0: Branch → refactor/<slug> branch
26
27
  → Phase 1: Analyze → refactor-analysis.md
27
28
  → Phase 2: Plan → plan.md (including Tasks section)
28
29
  → Phase 3: Implement → (code)
29
30
  → Phase 4: Review → (review report)
30
- → Phase 5: Commit → git commit
31
+ → Phase 5: Verify & Commit → git commit + merge decision
31
32
  ```
32
33
 
33
34
  ### Pipeline Phases
34
35
 
35
36
  | Phase | Name | Skill Used | Artifact |
36
37
  |-------|------|-----------|----------|
38
+ | 0 | Branch Setup | git | → `refactor/<slug>` branch |
37
39
  | 1 | Analyze (Code Analysis) | Built-in code analysis + code reading | → `refactor-analysis.md` |
38
40
  | 2 | Plan (Refactor Plan & Tasks) | `/prizmkit-plan` | → `plan.md` (with Tasks section) |
39
41
  | 3 | Implement | `/prizmkit-implement` | (code changes) |
40
42
  | 4 | Code Review | `/prizmkit-code-review` | (review report) |
41
- | 5 | Commit | `/prizmkit-committer` | git commit |
43
+ | 5 | Verify & Commit | `/prizmkit-committer` | git commit + merge |
42
44
 
43
45
  ### Key Principles
44
46
 
@@ -61,6 +63,26 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
61
63
 
62
64
  ---
63
65
 
66
+ ## Phase 0: Branch Setup
67
+
68
+ **Goal**: Create an isolated working branch to keep main clean.
69
+
70
+ 1. **Check current branch**:
71
+ ```bash
72
+ git branch --show-current
73
+ ```
74
+ 2. **If on `main` or a shared branch**: Create and switch to refactor branch:
75
+ ```bash
76
+ git checkout -b refactor/<refactor-slug>
77
+ ```
78
+ Example: `git checkout -b refactor/extract-auth-middleware`
79
+ 3. **If already on a refactor branch**: Confirm with user: "Continue on current branch `<branch-name>`, or create a new one?"
80
+ 4. **Record the original branch name** for later merge.
81
+
82
+ **CHECKPOINT CP-RW-0**: On a dedicated refactor branch, not main/shared branch.
83
+
84
+ ---
85
+
64
86
  ## Phase 1: Analyze — Code Analysis
65
87
 
66
88
  **Goal**: Assess current code state, identify refactoring targets, establish baseline.
@@ -163,23 +185,44 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
163
185
 
164
186
  ---
165
187
 
166
- ## Phase 5: Commit
188
+ ## Phase 5: Verify, Commit & Merge
167
189
 
168
- **Goal**: Commit with refactor convention.
190
+ **Goal**: Let user verify, commit with refactor convention, and merge back.
169
191
 
170
192
  **STEPS:**
171
193
 
172
- 1. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
194
+ 1. **User verification** (optional):
195
+ - Ask user: "Refactoring complete and all tests pass. Would you like to verify before committing?"
196
+ - **(a) Run the app** — Start dev server for manual verification
197
+ - **(b) Run a specific command** — Specify a test or script
198
+ - **(c) Skip** — Proceed to commit (tests already pass)
199
+ - If user reports issues: return to Phase 3
200
+ 2. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
173
201
  - Update KEY_FILES/INTERFACES/DEPENDENCIES in affected `.prizm-docs/` files
174
202
  - Skip knowledge injection unless refactoring revealed a genuinely new pitfall (e.g. a non-obvious coupling)
175
203
  - If structural changes are significant (module split/merge), update L1 doc
176
204
  - Stage doc changes: `git add .prizm-docs/`
177
- 2. **Invoke `/prizmkit-committer`**:
205
+ 3. **Invoke `/prizmkit-committer`**:
178
206
  - Commit message: `refactor(<scope>): <description>`
179
207
  - Include all refactored code + any test updates
180
208
  - Do NOT push
181
-
182
- **CHECKPOINT CP-RW-5**: Commit recorded with `refactor()` prefix.
209
+ 4. **Ask merge preference**:
210
+ ```
211
+ Refactoring committed on branch `refactor/<slug>`.
212
+ What would you like to do?
213
+ (a) Merge to <original-branch> and delete refactor branch
214
+ (b) Keep refactor branch (for PR review workflow)
215
+ (c) Decide later
216
+ ```
217
+ 5. **If (a)**:
218
+ ```bash
219
+ git checkout <original-branch>
220
+ git merge refactor/<slug>
221
+ git branch -d refactor/<slug>
222
+ ```
223
+ 6. **If (b)**: Inform user: "Branch `refactor/<slug>` retained. Create a PR when ready."
224
+
225
+ **CHECKPOINT CP-RW-5**: Commit recorded with `refactor()` prefix. Merge decision made.
183
226
 
184
227
  ---
185
228
 
@@ -188,7 +231,7 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
188
231
  For single-file refactoring (rename, extract method, <30 lines changed):
189
232
 
190
233
  ```
191
- Phase 1 (Analyze) → Phase 2 (Simplified Plan) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit)
234
+ Phase 0 (Branch) → Phase 1 (Analyze) → Phase 2 (Simplified Plan) → Phase 3 (Implement) → Phase 4 (Review) → Phase 5 (Commit & Merge)
192
235
  ```
193
236
 
194
237
  Skip Phase 2's detailed planning process, but still generate a lightweight `plan.md` with a simplified Tasks section (typically 1-2 tasks).
@@ -206,11 +249,13 @@ Skip Phase 2's detailed planning process, but still generate a lightweight `plan
206
249
  - Single-task refactors typically have just one task in plan.md
207
250
 
208
251
  **Fast Path still requires:**
252
+ - Refactor branch (Phase 0)
209
253
  - refactor-analysis.md (lightweight version with baseline)
210
254
  - plan.md (simplified, 1-2 tasks)
211
255
  - Full test suite run after implementation
212
256
  - Code review
213
257
  - `refactor(<scope>):` commit convention
258
+ - Merge decision
214
259
 
215
260
  ---
216
261
 
@@ -218,15 +263,16 @@ Skip Phase 2's detailed planning process, but still generate a lightweight `plan
218
263
 
219
264
  The pipeline supports resuming from the last completed phase by detecting existing artifacts.
220
265
 
221
- **Detection logic**: Check `.prizmkit/refactor/<slug>/` for:
266
+ **Detection logic**: Check `.prizmkit/refactor/<slug>/` and git branch state:
222
267
 
223
268
  | Artifact Found | Resume From |
224
269
  |---------------|------------|
225
- | (nothing) | Phase 1: Analyze |
270
+ | (nothing) | Phase 0: Branch Setup |
271
+ | On `refactor/<slug>` branch, no artifacts | Phase 1: Analyze |
226
272
  | `refactor-analysis.md` only | Phase 2: Plan |
227
273
  | `refactor-analysis.md` + `plan.md` | Phase 3: Implement |
228
274
  | All docs + code changes exist | Phase 4: Review |
229
- | All docs + review passed | Phase 5: Commit |
275
+ | All docs + review passed | Phase 5: Verify & Commit |
230
276
 
231
277
  **Resume**: If `<slug>` matches an existing `.prizmkit/refactor/<slug>/` directory, resume instead of starting fresh.
232
278
 
@@ -244,6 +290,7 @@ The pipeline supports resuming from the last completed phase by detecting existi
244
290
  | Review fails after 2 rounds | Escalate with review findings |
245
291
  | Refactoring creates circular dependency | STOP, revise plan |
246
292
  | Performance regression detected | STOP, investigate, revise approach |
293
+ | Branch conflict during merge | Show conflict, ask user to resolve or keep branch |
247
294
 
248
295
  ---
249
296
 
@@ -259,23 +306,24 @@ The pipeline supports resuming from the last completed phase by detecting existi
259
306
  | `/prizmkit-retrospective` | Phase 5: structural sync before commit (Job 1 only, skip knowledge injection unless new pitfall) |
260
307
  | `feature-workflow` | Handoff target when new behavior is needed |
261
308
  | `/prizmkit-specify` | NOT used (no user stories for refactoring) |
262
- | `/prizmkit-analyze` | NOT used (no spec plan consistency needed) |
309
+ | `/prizmkit-analyze` | NOT used (no spec <-> plan consistency needed) |
263
310
 
264
311
  ---
265
312
 
266
313
  ## Comparison with Feature and Bug Fix Pipelines
267
314
 
268
- | Dimension | Feature Workflow | Refactor Workflow | Bug Fix Pipeline |
315
+ | Dimension | Feature Workflow | Refactor Workflow | Bug Fix Workflow |
269
316
  |-----------|-----------------|-------------------|------------------|
270
317
  | Input | Natural language requirement | Module/code target | Bug description |
271
- | Pipeline Phases | 6 (Fast: 4) | 5 (Fast: 3) | 5 (Fast: 3) |
272
- | Phase 1 | Specify (spec.md) | Analyze (refactor-analysis.md) | Triage (fix-plan.md) |
318
+ | Branch | Pipeline manages per-feature | `refactor/<slug>` | `fix/<BUG_ID>-*` |
319
+ | Pipeline Phases | 3 (plan → launch → monitor) | 6 (branch → analyze → plan → implement → review → commit) | 7 (branch → triage → reproduce → fix → review → verify → commit) |
320
+ | Phase 1 | Plan (app-planner) | Analyze (refactor-analysis.md) | Triage (fix-plan.md) |
273
321
  | Artifact Path | `.prizmkit/specs/<slug>/` | `.prizmkit/refactor/<slug>/` | `.prizmkit/bugfix/<id>/` |
274
322
  | Commit Prefix | `feat(<scope>):` | `refactor(<scope>):` | `fix(<scope>):` |
275
- | REGISTRY Update | ✅ | ❌ | ❌ |
276
323
  | Test Strategy | TDD per task | Full suite after EVERY task | Reproduction test |
277
- | Scope Guard | N/A | (enforced) | N/A |
278
- | Behavior Change | Expected | Forbidden | Fix behavior |
324
+ | Scope Guard | N/A | Enforced | N/A |
325
+ | Behavior Change | Expected | Forbidden | Fix behavior |
326
+ | User Verification | No (pipeline) | Yes (Phase 5) | Yes (Phase 5) |
279
327
 
280
328
  ## Output
281
329
 
@@ -283,5 +331,5 @@ The pipeline supports resuming from the last completed phase by detecting existi
283
331
  - `plan.md` with Tasks section (Phase 2 artifact)
284
332
  - Refactored implementation code (Phase 3)
285
333
  - Code review report (Phase 4, conversation only)
286
- - Git commit with `refactor(<scope>):` prefix (Phase 5)
334
+ - Git commit with `refactor(<scope>):` prefix on dedicated refactor branch (Phase 5)
287
335
  - Updated `.prizm-docs/` (if applicable)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.0.106",
3
+ "version": "1.0.109",
4
4
  "description": "Create a new PrizmKit-powered project with clean initialization — no framework dev files, just what you need.",
5
5
  "type": "module",
6
6
  "bin": {