prizmkit 1.0.121 → 1.0.123
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.
- package/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/README.md +5 -6
- package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +2 -2
- package/bundled/dev-pipeline/launch-daemon.sh +6 -6
- package/bundled/dev-pipeline/run.sh +5 -56
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +3 -27
- package/bundled/dev-pipeline/templates/bootstrap-tier1.md +13 -2
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +38 -17
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +18 -75
- package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +0 -14
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/app-planner/assets/evaluation-guide.md +2 -2
- package/bundled/skills/bug-fix-workflow/SKILL.md +94 -26
- package/bundled/skills/feature-workflow/SKILL.md +179 -37
- package/bundled/skills/prizm-kit/SKILL.md +1 -1
- package/bundled/skills/prizmkit-implement/SKILL.md +49 -1
- package/bundled/skills/prizmkit-retrospective/SKILL.md +3 -133
- package/bundled/skills/refactor-workflow/SKILL.md +118 -55
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "prizmkit-retrospective"
|
|
3
|
-
description: "Incremental .prizm-docs/ maintainer
|
|
3
|
+
description: "Incremental .prizm-docs/ maintainer. Performs two jobs: (1) structural sync — update .prizm-docs/ KEY_FILES/INTERFACES/DEPENDENCIES, (2) architecture knowledge — inject TRAPS/RULES/DECISIONS into .prizm-docs/. All project knowledge lives in .prizm-docs/ . Run after code review passes and before committing. Trigger on: 'retrospective', 'retro', 'update docs', 'sync docs', 'wrap up', 'done with feature', 'feature complete'. (project)"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# PrizmKit Retrospective
|
|
@@ -11,11 +11,10 @@ All project knowledge is maintained in a single store:
|
|
|
11
11
|
|-------|----------|---------|---------|
|
|
12
12
|
| **Architecture Index** | `.prizm-docs/` | MODULE, FILES, INTERFACES, DEPENDENCIES, TRAPS, RULES, DECISIONS | AI quickly locates code structure, interfaces, known pitfalls, and key design decisions |
|
|
13
13
|
|
|
14
|
-
**This skill performs
|
|
14
|
+
**This skill performs two jobs in one pass:**
|
|
15
15
|
|
|
16
16
|
1. **Structural Sync** — reflect what changed in code → `.prizm-docs/` (KEY_FILES, INTERFACES, DEPENDENCIES, file counts)
|
|
17
17
|
2. **Architecture Knowledge** — inject TRAPS, RULES, and DECISIONS → `.prizm-docs/`. All knowledge is consolidated in `.prizm-docs/`.
|
|
18
|
-
3. **Deploy Guide** — detect new frameworks/tools and record setup instructions → `deploy_guide.md`
|
|
19
18
|
|
|
20
19
|
No other skill writes to `.prizm-docs/`. This is the sole writer during ongoing development. For initial doc setup, validation, or migration, use `/prizmkit-prizm-docs` instead.
|
|
21
20
|
|
|
@@ -151,132 +150,6 @@ When writing TRAPS:
|
|
|
151
150
|
|
|
152
151
|
---
|
|
153
152
|
|
|
154
|
-
## Job 3: Deploy Guide Maintenance (`deploy_guide.md`)
|
|
155
|
-
|
|
156
|
-
When new frameworks or tools that require **manual setup steps** are introduced, record them in `deploy_guide.md` at the project root. This ensures installation, configuration, and deployment knowledge is systematically documented for the team.
|
|
157
|
-
|
|
158
|
-
### When to Run Job 3
|
|
159
|
-
|
|
160
|
-
Run this job **only when new frameworks/tools are detected** in the current changeset. Skip entirely if no new framework was introduced.
|
|
161
|
-
|
|
162
|
-
### Step 3-1: Detect New Frameworks
|
|
163
|
-
|
|
164
|
-
From the `git diff --cached` (or `git diff`) output already collected in Job 1, check for newly added entries in dependency manifest files:
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
# Check for newly added dependencies in common manifest files
|
|
168
|
-
git diff --cached -U0 -- package.json requirements*.txt Pipfile pyproject.toml go.mod Cargo.toml pom.xml build.gradle Gemfile composer.json docker-compose*.yml Dockerfile .tool-versions 2>/dev/null | grep '^\+' | grep -v '^\+\+\+' | head -30
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
**Trigger conditions** (ANY match → proceed to Step 3-2):
|
|
172
|
-
- New dependency added to `package.json` (dependencies/devDependencies)
|
|
173
|
-
- New package in `requirements.txt`, `pyproject.toml`, `Pipfile`, `go.mod`, `Cargo.toml`, `pom.xml`, `build.gradle`, `Gemfile`, `composer.json`
|
|
174
|
-
- New service in `docker-compose*.yml` (e.g., database, cache, message queue)
|
|
175
|
-
- New `Dockerfile` created or base image changed
|
|
176
|
-
- New system tool in `.tool-versions`, `.nvmrc`, `.python-version`
|
|
177
|
-
- New CI/CD configuration file added (`.github/workflows/*.yml`, `.gitlab-ci.yml`, `Jenkinsfile`)
|
|
178
|
-
|
|
179
|
-
**Filter out** (do NOT record):
|
|
180
|
-
- Patch version bumps of existing dependencies (e.g., `1.2.3` → `1.2.4`)
|
|
181
|
-
- Dev-only tools that need no manual setup (linters, formatters, type checkers)
|
|
182
|
-
- Transitive dependencies (lock file changes without manifest changes)
|
|
183
|
-
|
|
184
|
-
### Step 3-2: Record Framework Info
|
|
185
|
-
|
|
186
|
-
For each detected new framework/tool, gather the following information from the code changes and dependency files:
|
|
187
|
-
|
|
188
|
-
| Field | Description | Source |
|
|
189
|
-
|-------|-------------|--------|
|
|
190
|
-
| **Name** | Framework/tool name | Package name from manifest |
|
|
191
|
-
| **Version** | Installed version or constraint | Version spec from manifest |
|
|
192
|
-
| **Purpose** | Why it was introduced | Infer from code usage, feature context, or commit message |
|
|
193
|
-
| **Install Command** | How to install locally | Standard install command for the ecosystem |
|
|
194
|
-
| **Key Config** | Config files or env vars needed | Scan for new config files, `.env` entries, or env references in code |
|
|
195
|
-
| **Notes** | Setup gotchas, required services, manual steps | Infer from Dockerfile, docker-compose, README references, or TRAPS |
|
|
196
|
-
|
|
197
|
-
### Step 3-3: Update `deploy_guide.md`
|
|
198
|
-
|
|
199
|
-
Write or append to `deploy_guide.md` at the project root using this template:
|
|
200
|
-
|
|
201
|
-
```markdown
|
|
202
|
-
# Deploy Guide
|
|
203
|
-
|
|
204
|
-
> Auto-maintained by PrizmKit retrospective. Manual edits are preserved.
|
|
205
|
-
> Last updated: YYYY-MM-DD
|
|
206
|
-
|
|
207
|
-
## Frameworks & Tools
|
|
208
|
-
|
|
209
|
-
### <Framework Name>
|
|
210
|
-
|
|
211
|
-
- **Version**: <version constraint>
|
|
212
|
-
- **Purpose**: <why this framework is used>
|
|
213
|
-
- **Install**:
|
|
214
|
-
```bash
|
|
215
|
-
<install command>
|
|
216
|
-
```
|
|
217
|
-
- **Key Config**:
|
|
218
|
-
- `<config file or env var>`: <description>
|
|
219
|
-
- **Notes**:
|
|
220
|
-
- <any setup gotchas, required external services, manual steps>
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
**Update rules**:
|
|
224
|
-
- If `deploy_guide.md` does not exist → create it with the header and first framework entry
|
|
225
|
-
- If `deploy_guide.md` exists → check if the framework already has a section (match by `### <Name>` heading). If yes, update version and any changed config. If no, append a new section.
|
|
226
|
-
- Preserve any manually added content (sections not matching the template are left untouched)
|
|
227
|
-
- Keep entries sorted alphabetically by framework name within `## Frameworks & Tools`
|
|
228
|
-
|
|
229
|
-
**Stage the file**:
|
|
230
|
-
```bash
|
|
231
|
-
git add deploy_guide.md
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Example
|
|
235
|
-
|
|
236
|
-
After adding PostgreSQL via docker-compose and Prisma ORM to a Node.js project:
|
|
237
|
-
|
|
238
|
-
```markdown
|
|
239
|
-
# Deploy Guide
|
|
240
|
-
|
|
241
|
-
> Auto-maintained by PrizmKit retrospective. Manual edits are preserved.
|
|
242
|
-
> Last updated: 2026-03-27
|
|
243
|
-
|
|
244
|
-
## Frameworks & Tools
|
|
245
|
-
|
|
246
|
-
### PostgreSQL
|
|
247
|
-
|
|
248
|
-
- **Version**: 16
|
|
249
|
-
- **Purpose**: Primary relational database for user data, orders, and product catalog
|
|
250
|
-
- **Install**:
|
|
251
|
-
```bash
|
|
252
|
-
docker compose up -d postgres
|
|
253
|
-
```
|
|
254
|
-
- **Key Config**:
|
|
255
|
-
- `DATABASE_URL` (env): PostgreSQL connection string, format `postgresql://user:pass@host:5432/dbname`
|
|
256
|
-
- `docker-compose.yml`: Service `postgres` with volume `pgdata`
|
|
257
|
-
- **Notes**:
|
|
258
|
-
- Requires Docker running locally
|
|
259
|
-
- Run `npx prisma migrate deploy` after first start to initialize schema
|
|
260
|
-
|
|
261
|
-
### Prisma
|
|
262
|
-
|
|
263
|
-
- **Version**: ^5.20.0
|
|
264
|
-
- **Purpose**: ORM for type-safe database access and schema migrations
|
|
265
|
-
- **Install**:
|
|
266
|
-
```bash
|
|
267
|
-
npm install prisma @prisma/client
|
|
268
|
-
npx prisma generate
|
|
269
|
-
```
|
|
270
|
-
- **Key Config**:
|
|
271
|
-
- `prisma/schema.prisma`: Database schema definition
|
|
272
|
-
- `DATABASE_URL` (env): Shared with PostgreSQL connection
|
|
273
|
-
- **Notes**:
|
|
274
|
-
- After schema changes: `npx prisma migrate dev --name <description>`
|
|
275
|
-
- Generate client after pull: `npx prisma generate`
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
153
|
## Final: Changelog + Stage
|
|
281
154
|
|
|
282
155
|
**3a.** Append to `.prizm-docs/changelog.prizm`:
|
|
@@ -287,8 +160,6 @@ After adding PostgreSQL via docker-compose and Prisma ORM to a Node.js project:
|
|
|
287
160
|
**3b.** Stage all doc changes:
|
|
288
161
|
```bash
|
|
289
162
|
git add .prizm-docs/
|
|
290
|
-
# Stage deploy guide if it was created/updated
|
|
291
|
-
git add deploy_guide.md 2>/dev/null || true
|
|
292
163
|
```
|
|
293
164
|
|
|
294
165
|
**3c.** Handoff:
|
|
@@ -318,5 +189,4 @@ The pipeline enforces a **docs pass condition**: `.prizm-docs/` must show change
|
|
|
318
189
|
|
|
319
190
|
- `.prizm-docs/*.prizm` — Structurally synced + TRAPS/RULES/DECISIONS enriched
|
|
320
191
|
- `.prizm-docs/changelog.prizm` — Appended entries
|
|
321
|
-
-
|
|
322
|
-
- All `.prizm-docs/` changes and `deploy_guide.md` staged via `git add`
|
|
192
|
+
- All `.prizm-docs/` changes staged via `git add`
|
|
@@ -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.
|
|
4
|
+
description: "End-to-end refactor workflow: deep requirement Q&A → analyze → plan → implement → review → commit. 7-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
|
|
9
|
+
End-to-end orchestration skill for code refactoring and optimization. Chains existing PrizmKit skills into a 7-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"
|
|
@@ -24,11 +24,12 @@ End-to-end orchestration skill for code refactoring and optimization. Chains exi
|
|
|
24
24
|
```
|
|
25
25
|
refactor-workflow
|
|
26
26
|
→ Phase 0: Branch → refactor/<slug> branch
|
|
27
|
-
→ Phase 1:
|
|
28
|
-
→ Phase 2:
|
|
29
|
-
→ Phase 3:
|
|
30
|
-
→ Phase 4:
|
|
31
|
-
→ Phase 5:
|
|
27
|
+
→ Phase 1: Understand → deep interactive Q&A with user
|
|
28
|
+
→ Phase 2: Analyze → refactor-analysis.md
|
|
29
|
+
→ Phase 3: Plan → plan.md (including Tasks section)
|
|
30
|
+
→ Phase 4: Implement → (code)
|
|
31
|
+
→ Phase 5: Review → (review report)
|
|
32
|
+
→ Phase 6: Verify & Commit → git commit + merge decision
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
### Pipeline Phases
|
|
@@ -36,16 +37,18 @@ refactor-workflow
|
|
|
36
37
|
| Phase | Name | Skill Used | Artifact |
|
|
37
38
|
|-------|------|-----------|----------|
|
|
38
39
|
| 0 | Branch Setup | git | → `refactor/<slug>` branch |
|
|
39
|
-
| 1 |
|
|
40
|
-
| 2 |
|
|
41
|
-
| 3 |
|
|
42
|
-
| 4 |
|
|
43
|
-
| 5 |
|
|
40
|
+
| 1 | Understand (Deep Q&A) | Interactive clarification | → Refactoring requirements confirmed |
|
|
41
|
+
| 2 | Analyze (Code Analysis) | Built-in code analysis + code reading | → `refactor-analysis.md` |
|
|
42
|
+
| 3 | Plan (Refactor Plan & Tasks) | `/prizmkit-plan` | → `plan.md` (with Tasks section) |
|
|
43
|
+
| 4 | Implement | `/prizmkit-implement` | (code changes) |
|
|
44
|
+
| 5 | Code Review | `/prizmkit-code-review` | (review report) |
|
|
45
|
+
| 6 | Verify & Commit | `/prizmkit-committer` | git commit + merge |
|
|
44
46
|
|
|
45
47
|
### Key Principles
|
|
46
48
|
|
|
47
49
|
| Principle | Description |
|
|
48
50
|
|-----------|-------------|
|
|
51
|
+
| **Deep understanding first** | Before analyzing code, fully understand the user's motivation, goals, and constraints. Refactoring without clear goals leads to churn. |
|
|
49
52
|
| **Behavior preservation** | Refactoring changes structure, not behavior. If tests pass before and after, behavior is preserved. Acceptance criteria = "behavior unchanged + structure improved". |
|
|
50
53
|
| **Test gates** | Full test suite runs after every task — not just at checkpoints. A refactoring that breaks tests mid-way is much harder to debug than catching it immediately. |
|
|
51
54
|
| **Structural sync only** | Refactoring triggers `/prizmkit-retrospective` Job 1 (structural sync) — update `.prizm-docs/` to reflect file/interface changes. Skip knowledge injection unless a genuinely new pitfall was discovered during refactoring. |
|
|
@@ -53,8 +56,8 @@ refactor-workflow
|
|
|
53
56
|
|
|
54
57
|
### Artifacts
|
|
55
58
|
Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
56
|
-
- **`refactor-analysis.md`** — Code analysis (Phase
|
|
57
|
-
- **`plan.md`** — Refactoring plan with Tasks section (Phase
|
|
59
|
+
- **`refactor-analysis.md`** — Code analysis (Phase 2)
|
|
60
|
+
- **`plan.md`** — Refactoring plan with Tasks section (Phase 3)
|
|
58
61
|
|
|
59
62
|
**PRECONDITION:**
|
|
60
63
|
|
|
@@ -91,7 +94,62 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
91
94
|
|
|
92
95
|
---
|
|
93
96
|
|
|
94
|
-
## Phase 1:
|
|
97
|
+
## Phase 1: Understand — Deep Refactoring Q&A
|
|
98
|
+
|
|
99
|
+
**Goal**: Fully understand the user's refactoring motivation, goals, constraints, and expectations before analyzing code. Refactoring without clear goals leads to aimless restructuring.
|
|
100
|
+
|
|
101
|
+
**CRITICAL RULE**: Ask as many questions as needed until the refactoring scope and goals are crystal clear. Do NOT jump into code analysis. A misunderstood refactoring goal leads to wasted effort or, worse, breaking the architecture in an unintended direction.
|
|
102
|
+
|
|
103
|
+
### Step 1.1: Motivation and Goals
|
|
104
|
+
|
|
105
|
+
Ask the user to explain why they want to refactor:
|
|
106
|
+
|
|
107
|
+
- **What's the pain point?** What specific problem does the current code cause? (Hard to add features? Hard to test? Confusing to read? Performance issues?)
|
|
108
|
+
- **What's the desired outcome?** What should the code look like after refactoring? (Better separation of concerns? Reduced coupling? Clearer interfaces?)
|
|
109
|
+
- **What triggered this?** Did a recent feature attempt expose the debt? Is it proactive cleanup?
|
|
110
|
+
|
|
111
|
+
### Step 1.2: Scope and Boundaries
|
|
112
|
+
|
|
113
|
+
Establish clear boundaries for what will and won't change:
|
|
114
|
+
|
|
115
|
+
- **Which modules/files are in scope?** (specific paths, or "everything under src/auth/")
|
|
116
|
+
- **What is explicitly OUT of scope?** (e.g., "don't touch the API layer", "leave the database schema as-is")
|
|
117
|
+
- **Are there any behavior changes allowed?** (Usually no for refactoring, but sometimes the user wants to combine refactoring with a minor behavior change — clarify this upfront)
|
|
118
|
+
- **Should the public API/interface stay the same?** (Or is renaming/restructuring the API acceptable?)
|
|
119
|
+
|
|
120
|
+
### Step 1.3: Constraints and Risks
|
|
121
|
+
|
|
122
|
+
Understand what the user is concerned about:
|
|
123
|
+
|
|
124
|
+
- **Which behaviors absolutely must NOT change?** (critical paths, user-facing behavior, external integrations)
|
|
125
|
+
- **Are there performance requirements?** (e.g., "the refactored code must not be slower")
|
|
126
|
+
- **Are there any code areas that are particularly fragile?** (known tricky sections, undocumented behavior)
|
|
127
|
+
- **Is there a deadline or time constraint?** (affects how aggressive the refactoring can be)
|
|
128
|
+
- **If database/schema changes are involved**: read existing schema files first and confirm scope with user
|
|
129
|
+
```bash
|
|
130
|
+
find . -maxdepth 4 -type f \( -name "*.prisma" -o -name "*.sql" -o -path "*/migrations/*" -o -path "*/models/*" -o -name "schema.*" -o -name "*.entity.*" \) -not -path '*/node_modules/*' -not -path '*/.git/*' | head -20
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 1.4: Confirmation
|
|
134
|
+
|
|
135
|
+
Summarize the refactoring scope:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Refactoring Scope:
|
|
139
|
+
- Target: [modules/files in scope]
|
|
140
|
+
- Goal: [desired structural improvement]
|
|
141
|
+
- Out of scope: [what won't change]
|
|
142
|
+
- Behavior contract: [what must remain unchanged]
|
|
143
|
+
- Constraints: [performance, API stability, etc.]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Ask the user: "Is this scope accurate? Anything to adjust?"
|
|
147
|
+
|
|
148
|
+
**CHECKPOINT CP-RW-1**: Refactoring scope and goals confirmed by user.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Phase 2: Analyze — Code Analysis
|
|
95
153
|
|
|
96
154
|
**Goal**: Assess current code state, identify refactoring targets, establish baseline.
|
|
97
155
|
|
|
@@ -114,16 +172,16 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
114
172
|
4. **Generate `refactor-analysis.md`** at `.prizmkit/refactor/<refactor-slug>/refactor-analysis.md`:
|
|
115
173
|
Required sections:
|
|
116
174
|
- **Current State**: module overview, file inventory, dependency graph, complexity metrics
|
|
117
|
-
- **Refactoring Goals**: what structural improvements are targeted, why (debt items, complexity, maintainability)
|
|
175
|
+
- **Refactoring Goals**: what structural improvements are targeted, why (debt items, complexity, maintainability) — aligned with user's confirmed goals from Phase 1
|
|
118
176
|
- **Risk Assessment**: what could break, cross-module impact, data migration needs
|
|
119
177
|
- **Baseline Tests**: test suite status (total, passing, failing), coverage estimate, behavior contracts to preserve
|
|
120
|
-
- **Scope Boundary**: what IS in scope, what is explicitly OUT of scope
|
|
178
|
+
- **Scope Boundary**: what IS in scope, what is explicitly OUT of scope — carried from Phase 1 confirmation
|
|
121
179
|
|
|
122
|
-
**CHECKPOINT CP-RW-
|
|
180
|
+
**CHECKPOINT CP-RW-2**: `refactor-analysis.md` exists with baseline test results.
|
|
123
181
|
|
|
124
182
|
---
|
|
125
183
|
|
|
126
|
-
## Phase
|
|
184
|
+
## Phase 3: Plan — Refactor Plan & Tasks
|
|
127
185
|
|
|
128
186
|
**Goal**: Generate technical refactoring plan that preserves behavior, including task breakdown.
|
|
129
187
|
|
|
@@ -135,17 +193,17 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
135
193
|
- plan.md Tasks section: each task is independently testable and preserves all tests (green → green) — this ensures any failure is immediately traceable to the task that caused it
|
|
136
194
|
- Artifact path: `.prizmkit/refactor/<refactor-slug>/plan.md`
|
|
137
195
|
3. **Verify plan constraints**:
|
|
138
|
-
- All public API contracts preserved
|
|
196
|
+
- All public API contracts preserved (unless explicitly agreed in Phase 1 to change)
|
|
139
197
|
- Test strategy: how to verify behavior unchanged at each step
|
|
140
198
|
- Rollback strategy: how to revert if behavior breaks
|
|
141
199
|
- Tasks ordered to minimize risk (safe renames first, structural changes later)
|
|
142
200
|
- Every task ends with "run full test suite"
|
|
143
201
|
|
|
144
|
-
**CHECKPOINT CP-RW-
|
|
202
|
+
**CHECKPOINT CP-RW-3**: `plan.md` exists with behavior preservation strategy and Tasks section.
|
|
145
203
|
|
|
146
204
|
---
|
|
147
205
|
|
|
148
|
-
## Phase
|
|
206
|
+
## Phase 4: Implement
|
|
149
207
|
|
|
150
208
|
**Goal**: Execute refactoring tasks with mandatory test verification after each task.
|
|
151
209
|
|
|
@@ -160,9 +218,9 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
160
218
|
- Mark tasks complete in plan.md Tasks section as they finish
|
|
161
219
|
- Record test results after each task
|
|
162
220
|
|
|
163
|
-
**CHECKPOINT CP-RW-
|
|
221
|
+
**CHECKPOINT CP-RW-4**: All tasks complete, full test suite green.
|
|
164
222
|
|
|
165
|
-
**Important constraints for Phase
|
|
223
|
+
**Important constraints for Phase 4:**
|
|
166
224
|
- Never skip the test gate between tasks — a broken intermediate state compounds into much harder debugging later
|
|
167
225
|
- Never allow temporary test failures ("we'll fix it in the next task") — this assumption is almost always wrong in refactoring
|
|
168
226
|
- If a task cannot be completed without breaking tests → split it into smaller tasks
|
|
@@ -170,7 +228,7 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
170
228
|
|
|
171
229
|
---
|
|
172
230
|
|
|
173
|
-
## Phase
|
|
231
|
+
## Phase 5: Code Review
|
|
174
232
|
|
|
175
233
|
**Goal**: Verify refactoring quality and behavior preservation.
|
|
176
234
|
|
|
@@ -186,14 +244,14 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
186
244
|
- Verdict: PASS / PASS_WITH_WARNINGS / NEEDS_FIXES
|
|
187
245
|
2. **Run full test suite one final time**: All tests must pass
|
|
188
246
|
3. **Handle review results**:
|
|
189
|
-
- **PASS / PASS_WITH_WARNINGS**: Proceed to Phase
|
|
190
|
-
- **NEEDS_FIXES**: Return to Phase
|
|
247
|
+
- **PASS / PASS_WITH_WARNINGS**: Proceed to Phase 6
|
|
248
|
+
- **NEEDS_FIXES**: Return to Phase 4 following Fix Instructions (max 2 review rounds)
|
|
191
249
|
|
|
192
|
-
**CHECKPOINT CP-RW-
|
|
250
|
+
**CHECKPOINT CP-RW-5**: Code review passes, all tests green.
|
|
193
251
|
|
|
194
252
|
---
|
|
195
253
|
|
|
196
|
-
## Phase
|
|
254
|
+
## Phase 6: Verify, Commit & Merge
|
|
197
255
|
|
|
198
256
|
**Goal**: Let user verify, commit with refactor convention, and merge back.
|
|
199
257
|
|
|
@@ -204,7 +262,7 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
204
262
|
- **(a) Run the app** — Start dev server for manual verification
|
|
205
263
|
- **(b) Run a specific command** — Specify a test or script
|
|
206
264
|
- **(c) Skip** — Proceed to commit (tests already pass)
|
|
207
|
-
- If user reports issues: return to Phase
|
|
265
|
+
- If user reports issues: return to Phase 4
|
|
208
266
|
2. **Invoke `/prizmkit-retrospective`** (Job 1: structural sync only):
|
|
209
267
|
- Update KEY_FILES/INTERFACES/DEPENDENCIES in affected `.prizm-docs/` files
|
|
210
268
|
- Skip knowledge injection unless refactoring revealed a genuinely new pitfall (e.g. a non-obvious coupling)
|
|
@@ -230,7 +288,7 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
230
288
|
```
|
|
231
289
|
6. **If (b)**: Inform user: "Branch `refactor/<slug>` retained. Create a PR when ready."
|
|
232
290
|
|
|
233
|
-
**CHECKPOINT CP-RW-
|
|
291
|
+
**CHECKPOINT CP-RW-6**: Commit recorded with `refactor()` prefix. Merge decision made.
|
|
234
292
|
|
|
235
293
|
---
|
|
236
294
|
|
|
@@ -239,10 +297,10 @@ Refactor artifacts stored at `.prizmkit/refactor/<refactor-slug>/`:
|
|
|
239
297
|
For single-file refactoring (rename, extract method, <30 lines changed):
|
|
240
298
|
|
|
241
299
|
```
|
|
242
|
-
Phase 0 (Branch) → Phase 1 (
|
|
300
|
+
Phase 0 (Branch) → Phase 1 (Simplified Q&A) → Phase 2 (Analyze) → Phase 3 (Simplified Plan) → Phase 4 (Implement) → Phase 5 (Review) → Phase 6 (Commit & Merge)
|
|
243
301
|
```
|
|
244
302
|
|
|
245
|
-
Skip Phase
|
|
303
|
+
Phase 1 is simplified to 2-3 quick confirmation questions instead of deep dive. Skip Phase 3's detailed planning process, but still generate a lightweight `plan.md` with a simplified Tasks section (typically 1-2 tasks).
|
|
246
304
|
|
|
247
305
|
**CRITERIA** (ALL must be true):
|
|
248
306
|
- Single file change
|
|
@@ -252,12 +310,14 @@ Skip Phase 2's detailed planning process, but still generate a lightweight `plan
|
|
|
252
310
|
- No dependency changes
|
|
253
311
|
|
|
254
312
|
**Fast Path implementation differs from full path:**
|
|
255
|
-
- Phase
|
|
256
|
-
- Phase 3
|
|
313
|
+
- Phase 1 is simplified: confirm goal and scope in 2-3 questions
|
|
314
|
+
- Phase 3 is simplified: generate a lightweight plan.md with 1-2 tasks directly from refactor-analysis.md, without deep architecture research
|
|
315
|
+
- Phase 4 still reads plan.md Tasks as normal, marks tasks `[x]` on completion
|
|
257
316
|
- Single-task refactors typically have just one task in plan.md
|
|
258
317
|
|
|
259
318
|
**Fast Path still requires:**
|
|
260
319
|
- Refactor branch (Phase 0)
|
|
320
|
+
- Scope confirmation (Phase 1, simplified)
|
|
261
321
|
- refactor-analysis.md (lightweight version with baseline)
|
|
262
322
|
- plan.md (simplified, 1-2 tasks)
|
|
263
323
|
- Full test suite run after implementation
|
|
@@ -276,11 +336,12 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
276
336
|
| Artifact Found | Resume From |
|
|
277
337
|
|---------------|------------|
|
|
278
338
|
| (nothing) | Phase 0: Branch Setup |
|
|
279
|
-
| On `refactor/<slug>` branch, no artifacts | Phase 1:
|
|
280
|
-
|
|
|
281
|
-
| `refactor-analysis.md`
|
|
282
|
-
|
|
|
283
|
-
| All docs +
|
|
339
|
+
| On `refactor/<slug>` branch, no artifacts | Phase 1: Understand |
|
|
340
|
+
| Scope confirmed, no analysis | Phase 2: Analyze |
|
|
341
|
+
| `refactor-analysis.md` only | Phase 3: Plan |
|
|
342
|
+
| `refactor-analysis.md` + `plan.md` | Phase 4: Implement |
|
|
343
|
+
| All docs + code changes exist | Phase 5: Review |
|
|
344
|
+
| All docs + review passed | Phase 6: Verify & Commit |
|
|
284
345
|
|
|
285
346
|
**Resume**: If `<slug>` matches an existing `.prizmkit/refactor/<slug>/` directory, resume instead of starting fresh.
|
|
286
347
|
|
|
@@ -291,6 +352,7 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
291
352
|
| Scenario | Action |
|
|
292
353
|
|----------|--------|
|
|
293
354
|
| Cannot identify target module | Ask user for clarification |
|
|
355
|
+
| User's refactoring goal is unclear | Ask systematic clarification questions (Phase 1) |
|
|
294
356
|
| No tests exist for target module | WARN user, recommend writing tests first |
|
|
295
357
|
| Baseline tests already failing | Isolate failures, document, proceed with caution |
|
|
296
358
|
| Test fails after a refactoring task | Revert task, investigate, retry or split |
|
|
@@ -305,13 +367,13 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
305
367
|
## Relationship to Other Skills
|
|
306
368
|
|
|
307
369
|
| Skill | Role in Refactor Workflow |
|
|
308
|
-
|
|
309
|
-
| (built-in code analysis) | Phase
|
|
310
|
-
| `/prizmkit-plan` | Phase
|
|
311
|
-
| `/prizmkit-implement` | Phase
|
|
312
|
-
| `/prizmkit-code-review` | Phase
|
|
313
|
-
| `/prizmkit-committer` | Phase
|
|
314
|
-
| `/prizmkit-retrospective` | Phase
|
|
370
|
+
|-------|-----------------------------|
|
|
371
|
+
| (built-in code analysis) | Phase 2: identify debt and complexity |
|
|
372
|
+
| `/prizmkit-plan` | Phase 3: refactoring plan + task generation |
|
|
373
|
+
| `/prizmkit-implement` | Phase 4: execute refactoring tasks |
|
|
374
|
+
| `/prizmkit-code-review` | Phase 5: review quality and behavior preservation |
|
|
375
|
+
| `/prizmkit-committer` | Phase 6: commit with `refactor()` convention |
|
|
376
|
+
| `/prizmkit-retrospective` | Phase 6: structural sync before commit (Job 1 only, skip knowledge injection unless new pitfall) |
|
|
315
377
|
| `feature-workflow` | Handoff target when new behavior is needed |
|
|
316
378
|
| `/prizmkit-specify` | NOT used (no user stories for refactoring) |
|
|
317
379
|
| `/prizmkit-analyze` | NOT used (no spec <-> plan consistency needed) |
|
|
@@ -323,21 +385,22 @@ The pipeline supports resuming from the last completed phase by detecting existi
|
|
|
323
385
|
| Dimension | Feature Workflow | Refactor Workflow | Bug Fix Workflow |
|
|
324
386
|
|-----------|-----------------|-------------------|------------------|
|
|
325
387
|
| Input | Natural language requirement | Module/code target | Bug description |
|
|
388
|
+
| Deep Q&A | Yes (brainstorm) | Yes (scope & goals) | Yes (diagnosis) |
|
|
326
389
|
| Branch | Pipeline manages per-feature | `refactor/<slug>` | `fix/<BUG_ID>-*` |
|
|
327
|
-
| Pipeline Phases |
|
|
328
|
-
| Phase 1 |
|
|
390
|
+
| Pipeline Phases | 4 (brainstorm → plan → launch → monitor) | 7 (branch → understand → analyze → plan → implement → review → commit) | 8 (branch → diagnose → triage → reproduce → fix → review → verify → commit) |
|
|
391
|
+
| Phase 1 | Brainstorm (requirements Q&A) | Understand (scope & goals Q&A) | Deep Bug Diagnosis (symptom Q&A) |
|
|
329
392
|
| Artifact Path | `.prizmkit/specs/<slug>/` | `.prizmkit/refactor/<slug>/` | `.prizmkit/bugfix/<id>/` |
|
|
330
393
|
| Commit Prefix | `feat(<scope>):` | `refactor(<scope>):` | `fix(<scope>):` |
|
|
331
394
|
| Test Strategy | TDD per task | Full suite after EVERY task | Reproduction test |
|
|
332
395
|
| Scope Guard | N/A | Enforced | N/A |
|
|
333
396
|
| Behavior Change | Expected | Forbidden | Fix behavior |
|
|
334
|
-
| User Verification |
|
|
397
|
+
| User Verification | Yes (brainstorm confirmation) | Yes (Phase 6) | Yes (Phase 6) |
|
|
335
398
|
|
|
336
399
|
## Output
|
|
337
400
|
|
|
338
|
-
- `refactor-analysis.md` (Phase
|
|
339
|
-
- `plan.md` with Tasks section (Phase
|
|
340
|
-
- Refactored implementation code (Phase
|
|
341
|
-
- Code review report (Phase
|
|
342
|
-
- Git commit with `refactor(<scope>):` prefix on dedicated refactor branch (Phase
|
|
401
|
+
- `refactor-analysis.md` (Phase 2 artifact)
|
|
402
|
+
- `plan.md` with Tasks section (Phase 3 artifact)
|
|
403
|
+
- Refactored implementation code (Phase 4)
|
|
404
|
+
- Code review report (Phase 5, conversation only)
|
|
405
|
+
- Git commit with `refactor(<scope>):` prefix on dedicated refactor branch (Phase 6)
|
|
343
406
|
- Updated `.prizm-docs/` (if applicable)
|