prizmkit 1.1.35 → 1.1.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/bin/create-prizmkit.js +4 -0
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +66 -18
  4. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +4 -5
  5. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  6. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +74 -4
  7. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +84 -15
  8. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +84 -22
  9. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +4 -4
  10. package/bundled/dev-pipeline/templates/feature-list-schema.json +8 -2
  11. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +5 -6
  12. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +153 -0
  13. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +124 -0
  14. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +10 -17
  15. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +11 -18
  16. package/bundled/skills/_metadata.json +1 -1
  17. package/bundled/skills/bug-fix-workflow/SKILL.md +17 -27
  18. package/bundled/skills/feature-planner/SKILL.md +6 -5
  19. package/bundled/skills/feature-planner/references/browser-interaction.md +14 -1
  20. package/bundled/skills/prizmkit-code-review/SKILL.md +176 -45
  21. package/package.json +1 -1
  22. package/src/index.js +10 -1
  23. package/src/scaffold.js +52 -3
  24. package/bundled/skills/prizmkit-code-review/rules/dimensions.md +0 -85
  25. package/bundled/skills/prizmkit-code-review/rules/fix-strategy.md +0 -61
@@ -1,11 +1,17 @@
1
1
  ---
2
2
  name: "prizmkit-code-review"
3
- description: "Code review against spec and plan. Diagnoses issues across multiple dimensions, produces findings with fix instructions. Use after /prizmkit-implement as quality gate. Trigger on: 'review', 'check code', 'code review', 'is it ready to commit'. (project)"
3
+ description: "Iterative review-fix loop against spec and plan. Spawns a read-only Reviewer agent, filters findings, then a Dev agent applies fixes. Loops until PASS (max 3 rounds). Use after /prizmkit-implement as quality gate. Trigger on: 'review', 'check code', 'code review', 'is it ready to commit'. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Code Review
7
7
 
8
- Review code changes against the spec, plan, and project conventions. Produces a diagnostic report with findings and actionable fix instructions. The review itself is read-only — no source code is modified.
8
+ An iterative review-fix loop that reviews code changes against the spec and plan, then automatically fixes issues. Uses three separated roles:
9
+
10
+ - **Reviewer Agent** (read-only): analyzes git diff against spec goals and plan decisions, produces structured findings
11
+ - **Main Agent** (orchestrator): filters Reviewer findings for reasonableness, coordinates the loop
12
+ - **Dev Agent** (read-write): applies fixes for accepted findings
13
+
14
+ The loop repeats until the Reviewer finds no issues or the max round limit is reached.
9
15
 
10
16
  ### When to Use
11
17
  - After `/prizmkit-implement` to verify code quality before commit
@@ -22,68 +28,193 @@ Review code changes against the spec, plan, and project conventions. Produces a
22
28
  |-----------|----------|-------------|
23
29
  | `artifact_dir` | No | Directory containing spec.md + plan.md. If omitted, scan `.prizmkit/` subdirectories for the most recently modified directory with a `plan.md` whose tasks are all completed. |
24
30
 
25
- ## Context Loading
31
+ ## Phase 0: Context Loading
26
32
 
27
- 1. **Task context**: Read `spec.md`, `plan.md`, and any companion documents (e.g., `refactor-analysis.md`) from the artifact directory.
28
- 2. **Architecture context**: Read `.prizm-docs/root.prizm` (L0) and relevant L1/L2 docs for affected modules check RULES, PATTERNS, TRAPS, DECISIONS.
33
+ 1. **Read spec.md** from the artifact directory extract goals and acceptance criteria.
34
+ 2. **Read plan.md** from the artifact directory extract architecture decisions and completed tasks.
35
+ 3. **Capture workspace diff**: run `git diff` (unstaged) + `git diff --cached` (staged) + `git status` to understand the full scope of changes. For new files in git status, note their paths for the Reviewer to read.
36
+ - If no changes are detected, output PASS and stop.
29
37
 
30
- ## Phase 1: Diagnostic Review
38
+ ## Phase 1: Review-Fix Loop
31
39
 
32
- 1. **Identify changed files**: Extract file paths from completed tasks in plan.md, or use `git diff` against the branch base.
33
- 2. **Read changed files**: Scan all code files identified above.
34
- 3. **Review across dimensions**: Load `${SKILL_DIR}/rules/dimensions.md` and evaluate each applicable dimension. Dimensions are conditionally triggered based on what sections exist in spec.md — see the dimensions file for trigger conditions.
35
- 4. **Generate findings**: For each issue found, describe the problem, its location, which dimension it falls under, and why it matters.
36
- 5. If unsure whether something is a bug or intentional design, flag it with a note asking the developer to confirm.
40
+ ```
41
+ ┌─── Loop (max 3 rounds) ──────────────────────────────┐
42
+ │ │
43
+ │ Step 1: Spawn Reviewer Agent (read-only) │
44
+ │ → Input: git diff + spec goals + plan decisions │
45
+ │ → Output: structured findings or PASS │
46
+ │ │
47
+ │ Step 2: Check result │
48
+ │ → If PASS (no findings): exit loop │
49
+ │ │
50
+ │ Step 3: Main Agent filters findings │
51
+ │ → For each finding: accept (reasonable) or reject │
52
+ │ → If all rejected: exit loop │
53
+ │ │
54
+ │ Step 4: Spawn Dev Agent (read-write) │
55
+ │ → Input: accepted findings + spec/plan context │
56
+ │ → Output: fix report │
57
+ │ │
58
+ │ Step 5: Back to Step 1 │
59
+ │ │
60
+ │ Hard limit: exit after 3 rounds regardless │
61
+ │ → On max-round exhaustion: output a summary of all │
62
+ │ unresolved findings to the conversation, then write │
63
+ │ review-report.md with NEEDS_FIXES verdict. │
64
+ └────────────────────────────────────────────────────────┘
65
+ ```
37
66
 
38
- ## Phase 2: Fix Strategy
67
+ ### Step 1: Spawn Reviewer Agent
39
68
 
40
- For each finding, load `${SKILL_DIR}/rules/fix-strategy.md` and produce structured Fix Instructions: Root Cause, Impact, Fix Strategy, Code Guidance, Verification Criteria.
69
+ Spawn a **read-only** agent (subagent_type: `Explore`) with the following prompt:
41
70
 
42
- ## Reviewer Agent Mode
71
+ ```
72
+ You are a code reviewer. Review workspace changes against the spec goals and plan decisions.
43
73
 
44
- When interactive session is available, offer the option to spawn an independent reviewer subagent:
74
+ ## Spec Goals
75
+ {goals and acceptance criteria from spec.md}
45
76
 
46
- 1. Spawn a reviewer subagent with **read-only** permissions (Read, Glob, Grep, Bash for test commands only)
47
- 2. The subagent independently reviews changed files against spec/plan/dimensions and produces findings
48
- 3. The main agent receives findings and applies fixes
49
- 4. Re-spawn the subagent to verify fixes
50
- 5. Repeat until the subagent reports no more findings or the caller's maximum iteration limit is reached
77
+ ## Plan Decisions
78
+ {architecture decisions and task list from plan.md}
51
79
 
52
- In non-interactive mode, perform the review directly (no subagent).
80
+ ## Review Round
81
+ Round {N}. {round_context}
53
82
 
54
- ## Output
83
+ ## What to Review
84
+ Run these commands to see the current workspace changes:
85
+ - `git diff` (unstaged changes)
86
+ - `git diff --cached` (staged changes)
87
+ - `git status` (new/deleted files)
55
88
 
56
- Write `review-report.md` to the artifact directory:
89
+ For new files shown in git status, read their full content.
90
+ For modified files, read enough surrounding context to understand the change.
57
91
 
58
- ```markdown
59
- # Review Report
92
+ ## Review Dimensions
93
+ Evaluate the changes across these dimensions (focus on what's relevant):
94
+
95
+ 1. **Goal alignment**: Do the changes accomplish all goals from spec.md? Anything missing or off-target?
96
+ 2. **Defects**: Logic bugs, missing error handling, boundary condition issues, incorrect behavior.
97
+ 3. **Completeness**: Files that should have been changed but weren't? Missing tests, types, imports, exports?
98
+ 4. **Consistency**: Do changes follow the project's existing patterns, naming conventions, and code style?
99
+ 5. **Security**: Hardcoded secrets, injection vulnerabilities, unsafe operations.
100
+
101
+ ## Output Format
102
+ Respond with EXACTLY this format:
103
+
104
+ ### Result: PASS | NEEDS_FIXES
105
+
106
+ ### Findings
107
+ (If PASS, write "No issues found.")
108
+
109
+ #### Finding N
110
+ - **Severity**: high | medium | low
111
+ - **Dimension**: goal-alignment | defect | completeness | consistency | security
112
+ - **Location**: filepath:line (or "project-level")
113
+ - **Problem**: What is wrong and why it matters
114
+ - **Suggestion**: Recommended fix approach
115
+ - **Verification**: How to confirm the fix is correct
116
+
117
+ ### Summary
118
+ One to two sentences about the overall state of the changes.
119
+ ```
60
120
 
61
- ## Verdict: PASS | NEEDS_FIXES
121
+ **Round context** varies by round:
122
+ - Round 1: "This is the first review. Examine all changes comprehensively."
123
+ - Round 2+: "Previous round found issues that were fixed. Focus on: (1) whether previous fixes are correct, (2) whether fixes introduced new problems, (3) any remaining issues. Do not re-report issues that have already been fixed."
62
124
 
63
- ## Summary: X findings
125
+ ### Step 2: Check Result
64
126
 
65
- ## Findings
127
+ Parse the Reviewer Agent's output:
128
+ - If `Result: PASS` → exit loop, proceed to Phase 2.
129
+ - If `Result: NEEDS_FIXES` → extract findings and continue to Step 3.
66
130
 
67
- ### Finding 1: Title
68
- - Location: file:line
69
- - Dimension: category
70
- - Problem: what is wrong and why it matters
71
- - Root Cause: explanation
72
- - Impact: affected callers/dependents
73
- - Fix Strategy: step-by-step
74
- - Code Guidance: before/after snippet
75
- - Verification: commands/checks to confirm
76
- - Related: Finding N (if grouped)
131
+ ### Step 3: Main Agent Filters Findings
132
+
133
+ Review each finding and decide whether it's reasonable. This prevents unnecessary or harmful changes.
134
+
135
+ **For each finding, evaluate:**
136
+ - Is this relevant to the current changes? (Reject findings about unmodified, unrelated code.)
137
+ - Is this a real problem or a subjective style preference? (Reject pure style preferences unless they violate clear project conventions.)
138
+ - Would fixing this improve the code without introducing risk? (Reject fixes that require large refactors outside scope.)
139
+
140
+ **Output per finding:**
141
+ - **Accepted**: The finding is reasonable — include it in the Dev Agent's task.
142
+ - **Rejected** (with reason): Brief explanation (e.g., "Out of scope", "Style preference, not a defect").
143
+
144
+ If all findings are rejected → exit loop, proceed to Phase 2.
145
+
146
+ ### Step 4: Spawn Dev Agent
147
+
148
+ Spawn a **general-purpose** agent (read-write) with the following prompt:
149
+
150
+ ```
151
+ You are a developer fixing code review findings. Apply each fix carefully without breaking existing functionality.
152
+
153
+ ## Spec Context
154
+ {goals from spec.md for reference}
155
+
156
+ ## Findings to Fix
157
+ {accepted findings list — each with Severity, Location, Problem, Suggestion, Verification}
158
+
159
+ ## Instructions
160
+ 1. Read each finding carefully.
161
+ 2. For each finding:
162
+ a. Read the relevant code and understand the context.
163
+ b. Implement the fix based on the suggestion.
164
+ c. If a suggestion is not feasible (would break other functionality, technically impossible), explain why.
165
+ 3. After all fixes, report what you did.
166
+
167
+ ## Output Format
168
+ For each finding, report:
169
+ - **Finding N**: [fixed | unable-to-fix]
170
+ - **What was done**: Brief description
171
+ - **Files modified**: List of changed files
172
+ (If unable-to-fix, explain why)
77
173
  ```
78
174
 
79
- - `PASS`: 0 findings
80
- - `NEEDS_FIXES`: 1+ findings with fix instructions
175
+ After the Dev Agent returns, record results and return to Step 1 for the next round.
81
176
 
82
- Also output findings summary to conversation.
177
+ ## Phase 2: Output
178
+
179
+ Write `review-report.md` to the artifact directory:
180
+
181
+ ```markdown
182
+ # Review Report
183
+
184
+ ## Verdict: PASS
185
+ ## Rounds: 2
186
+ ## Total findings: 3 → Fixed: 2, Rejected: 1
187
+
188
+ ## Round 1
189
+ Findings: 3 | Accepted: 2, Rejected: 1
190
+
191
+ ### Finding 1: Missing null check in parseConfig
192
+ - Severity: high
193
+ - Dimension: defect
194
+ - Location: src/config.ts:42
195
+ - Problem: parseConfig crashes when input is undefined
196
+ - Status: fixed (round 1)
197
+
198
+ ### Finding 2: Export missing from index.ts
199
+ - Severity: medium
200
+ - Dimension: completeness
201
+ - Location: src/index.ts
202
+ - Problem: New parseConfig function not exported
203
+ - Status: fixed (round 1)
204
+
205
+ ### Finding 3: Consider renaming variable
206
+ - Severity: low
207
+ - Dimension: consistency
208
+ - Location: src/config.ts:15
209
+ - Problem: Variable `d` should be more descriptive
210
+ - Status: rejected — Style preference; existing code uses short names in this module
211
+
212
+ ## Round 2: PASS — no new findings
213
+ ```
83
214
 
84
- **HANDOFF:** `/prizmkit-retrospective` (if no findings) or apply fixes and re-review (if findings exist)
215
+ - `PASS`: Reviewer returned no findings (or all remaining findings were rejected as unreasonable)
216
+ - `NEEDS_FIXES`: 3 rounds completed but unresolved findings remain
85
217
 
86
- ## References
218
+ Also output a completion summary to conversation.
87
219
 
88
- - Review dimensions: `${SKILL_DIR}/rules/dimensions.md`
89
- - Fix strategy formulation: `${SKILL_DIR}/rules/fix-strategy.md`
220
+ **HANDOFF:** `/prizmkit-retrospective` (if PASS) or inform the caller of remaining issues (if NEEDS_FIXES after max rounds)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prizmkit",
3
- "version": "1.1.35",
3
+ "version": "1.1.37",
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": {
package/src/index.js CHANGED
@@ -68,6 +68,7 @@ export async function runScaffold(directory, options) {
68
68
  team: options.team !== false,
69
69
  pipeline: options.pipeline !== false,
70
70
  playwrightCli: options.playwrightCli !== false,
71
+ openCli: options.openCli !== false,
71
72
  rules: options.rules || 'recommended',
72
73
  aiCli: options.aiCli || '',
73
74
  externalSkills: options.externalSkills ? options.externalSkills.split(',').map(s => s.trim()).filter(Boolean) : [],
@@ -191,6 +192,12 @@ export async function runScaffold(directory, options) {
191
192
  default: true,
192
193
  });
193
194
 
195
+ // 4.6. OpenCLI (browser interaction with Chrome login session reuse)
196
+ const openCli = await confirm({
197
+ message: '安装浏览器交互工具 (opencli)? 复用 Chrome 登录态,支持 OAuth/第三方集成验证',
198
+ default: true,
199
+ });
200
+
194
201
  // 5. Rules 预设
195
202
  const rulesPreset = await select({
196
203
  message: '安装 AI 行为规则 (rules):',
@@ -215,7 +222,8 @@ export async function runScaffold(directory, options) {
215
222
  console.log(` 技能: ${chalk.cyan(suiteLabel)}`);
216
223
  console.log(` 团队模式: ${team ? chalk.green('启用') : chalk.gray('禁用')}`);
217
224
  console.log(` 流水线: ${pipeline ? chalk.green('启用') : chalk.gray('禁用')}`);
218
- console.log(` 浏览器工具: ${playwrightCli ? chalk.green('启用') : chalk.gray('禁用')}`);
225
+ const browserToolsLabel = [playwrightCli && 'playwright-cli', openCli && 'opencli'].filter(Boolean);
226
+ console.log(` 浏览器工具: ${browserToolsLabel.length ? chalk.green(browserToolsLabel.join(' + ')) : chalk.gray('禁用')}`);
219
227
  console.log(` 规则: ${chalk.cyan(rulesPreset)}`);
220
228
  if (aiCli) console.log(` AI CLI: ${chalk.cyan(aiCli)}`);
221
229
  if (selectedExternalSkills.length > 0) console.log(` 外部技能: ${chalk.cyan(selectedExternalSkills.join(', '))}`);
@@ -239,6 +247,7 @@ export async function runScaffold(directory, options) {
239
247
  team,
240
248
  pipeline,
241
249
  playwrightCli,
250
+ openCli,
242
251
  rules: rulesPreset,
243
252
  aiCli: aiCli || '',
244
253
  externalSkills: selectedExternalSkills,
package/src/scaffold.js CHANGED
@@ -774,6 +774,43 @@ export async function installPlaywrightCli(projectRoot, dryRun) {
774
774
  }
775
775
  }
776
776
 
777
+ // ============================================================
778
+ // OpenCLI 安装
779
+ // ============================================================
780
+
781
+ /**
782
+ * 安装 opencli(全局 npm 包)
783
+ * 用于浏览器交互验证,复用 Chrome 已登录会话(OAuth/SSO/第三方集成)
784
+ */
785
+ export async function installOpenCli(projectRoot, dryRun) {
786
+ if (dryRun) {
787
+ console.log(chalk.gray(' [dry-run] @jackwener/opencli (global install)'));
788
+ return;
789
+ }
790
+
791
+ // Check if already installed
792
+ try {
793
+ execSync('opencli --version', { stdio: 'pipe' });
794
+ console.log(chalk.green(' ✓ opencli (already installed)'));
795
+ } catch {
796
+ // Not installed, install it
797
+ try {
798
+ console.log(chalk.blue(' ⏳ Installing @jackwener/opencli globally...'));
799
+ execSync('npm install -g @jackwener/opencli@latest', { stdio: 'pipe', timeout: 120000 });
800
+ console.log(chalk.green(' ✓ @jackwener/opencli installed globally'));
801
+ } catch (e) {
802
+ console.log(chalk.yellow(` ⚠ @jackwener/opencli install failed: ${e.message}`));
803
+ console.log(chalk.yellow(' ⚠ Run manually: npm install -g @jackwener/opencli@latest'));
804
+ return;
805
+ }
806
+ }
807
+
808
+ // Note: opencli requires Chrome + Browser Bridge extension for browser-backed commands.
809
+ // The extension must be installed manually — see: https://github.com/jackwener/opencli
810
+ console.log(chalk.gray(' ℹ OpenCLI requires Chrome + Browser Bridge extension for browser commands'));
811
+ console.log(chalk.gray(' ℹ Run "opencli doctor" to verify connectivity'));
812
+ }
813
+
777
814
  // ============================================================
778
815
  // Extras 注册表
779
816
  // ============================================================
@@ -784,9 +821,13 @@ export async function installPlaywrightCli(projectRoot, dryRun) {
784
821
  */
785
822
  export const EXTRAS_REGISTRY = {
786
823
  'playwright-cli': {
787
- label: '浏览器交互工具',
824
+ label: '浏览器交互工具 (playwright-cli)',
788
825
  install: installPlaywrightCli,
789
826
  },
827
+ 'opencli': {
828
+ label: '浏览器交互工具 (opencli — 复用 Chrome 登录态)',
829
+ install: installOpenCli,
830
+ },
790
831
  };
791
832
 
792
833
  // ============================================================
@@ -804,11 +845,12 @@ export const EXTRAS_REGISTRY = {
804
845
  * @param {string} [config.aiCli] - AI CLI 可执行命令(写入 .prizmkit/config.json)
805
846
  * @param {string[]} [config.externalSkills] - 要安装的外部 skill 名称列表
806
847
  * @param {boolean} [config.playwrightCli] - 是否安装 playwright-cli
848
+ * @param {boolean} [config.openCli] - 是否安装 opencli
807
849
  * @param {string} config.projectRoot - 目标项目根目录
808
850
  * @param {boolean} config.dryRun - 是否为预览模式
809
851
  */
810
852
  export async function scaffold(config) {
811
- const { platform, skills, team, pipeline, rules, aiCli, externalSkills, playwrightCli, projectRoot, dryRun } = config;
853
+ const { platform, skills, team, pipeline, rules, aiCli, externalSkills, playwrightCli, openCli, projectRoot, dryRun } = config;
812
854
  const platforms = platform === 'both' ? ['codebuddy', 'claude'] : [platform];
813
855
 
814
856
  if (dryRun) {
@@ -910,6 +952,12 @@ export async function scaffold(config) {
910
952
  await installPlaywrightCli(projectRoot, dryRun);
911
953
  console.log('');
912
954
  }
955
+ if (openCli) {
956
+ activeExtras.push('opencli');
957
+ console.log(chalk.blue(` ${EXTRAS_REGISTRY['opencli'].label}:`));
958
+ await installOpenCli(projectRoot, dryRun);
959
+ console.log('');
960
+ }
913
961
 
914
962
  // 11. Clean up stray .codebuddy/ directory left by third-party tools (e.g. npx skills)
915
963
  // when installing for Claude Code only. CodeBuddy files should never appear in a
@@ -998,7 +1046,8 @@ export async function scaffold(config) {
998
1046
  console.log(chalk.gray(` 平台: ${platforms.map(p => p === 'codebuddy' ? 'CodeBuddy' : 'Claude Code').join(' + ')}`));
999
1047
  console.log(chalk.gray(` 团队: ${team ? '已启用' : '未启用'}`));
1000
1048
  console.log(chalk.gray(` 流水线: ${pipeline ? '已安装' : '未安装'}`));
1001
- console.log(chalk.gray(` 浏览器工具: ${playwrightCli ? '已安装 (playwright-cli)' : '未安装'}`));
1049
+ const browserTools = [playwrightCli && 'playwright-cli', openCli && 'opencli'].filter(Boolean);
1050
+ console.log(chalk.gray(` 浏览器工具: ${browserTools.length ? '已安装 (' + browserTools.join(' + ') + ')' : '未安装'}`));
1002
1051
  console.log(chalk.gray(` 规则: ${rules || 'recommended'}`));
1003
1052
  if (aiCli) console.log(chalk.gray(` AI CLI: ${aiCli}`));
1004
1053
  console.log('');
@@ -1,85 +0,0 @@
1
- # Review Dimensions
2
-
3
- Evaluate code changes across the following dimensions. Each dimension is either **always active** or **conditionally triggered** based on spec.md content.
4
-
5
- ---
6
-
7
- ## §1 Goal Compliance (always active)
8
-
9
- Does code implement all goals and acceptance criteria from spec.md?
10
-
11
- - Check every goal (G-N) in spec.md has a corresponding implementation
12
- - Verify acceptance criteria are met
13
- - Verify edge cases mentioned in spec are handled
14
- - Confirm scope boundaries are respected (no over-implementation, no under-implementation)
15
-
16
- ## §2 Plan Adherence (always active)
17
-
18
- Does implementation follow architectural decisions in plan.md?
19
-
20
- - Check component structure matches plan's change approach
21
- - Verify data model matches plan's schema design (if applicable)
22
- - Confirm API contracts (endpoints, request/response) match plan (if applicable)
23
- - Deviations may be improvements — flag for confirmation, not automatic rejection
24
-
25
- ## §3 Behavior Preservation (conditional: spec.md has `## Behavior Preservation`)
26
-
27
- Observable behavior for existing functionality must remain unchanged.
28
-
29
- - All existing tests still pass without modification
30
- - Public API signatures are unchanged (parameter types, return types, error types)
31
- - Side effects (logging, metrics, events) are preserved unless explicitly scoped for removal
32
- - Edge case handling is preserved — changes often silently drop edge case branches
33
-
34
- ## §4 Code Quality (always active)
35
-
36
- Naming, structure, complexity, DRY. Focus on maintainability.
37
-
38
- - Function/variable names are descriptive and consistent with project conventions
39
- - No unnecessary complexity (deep nesting, oversized functions)
40
- - No copy-paste duplication that should be abstracted
41
- - Error messages are informative for debugging
42
-
43
- ## §5 Security (always active)
44
-
45
- Injection, auth/authz gaps, sensitive data exposure, insecure defaults.
46
-
47
- - User input is validated and sanitized before use in queries, HTML, or commands
48
- - Authentication and authorization checks are present on protected routes
49
- - Sensitive data (passwords, tokens, PII) is not logged or exposed in responses
50
- - Cryptographic operations use established libraries, not custom implementations
51
-
52
- ## §6 Consistency (always active)
53
-
54
- Follows project patterns from `.prizm-docs/` PATTERNS and RULES sections.
55
-
56
- - Code style matches existing codebase conventions
57
- - Error handling follows established patterns
58
- - File organization follows project structure conventions
59
- - Naming conventions align with `.prizm-docs/` RULES
60
-
61
- ## §7 Test Coverage (always active)
62
-
63
- Are critical paths tested?
64
-
65
- - Happy path tests exist for each goal
66
- - Error/edge case tests for critical paths
67
- - Tests are deterministic (no flaky timing dependencies)
68
- - Test names clearly describe what they verify
69
-
70
- ## §8 Fix Correctness (conditional: spec.md has `## Root Cause`)
71
-
72
- The fix addresses the actual root cause, not just symptoms.
73
-
74
- - The root cause identified in spec.md is addressed
75
- - A regression test exists that would catch this issue if reintroduced
76
- - The fix does not change behavior for non-affected inputs
77
- - Related code paths are not inadvertently affected
78
-
79
- ## §9 Change Scope (conditional: spec.md `## Scope` emphasizes minimal change)
80
-
81
- Only files directly related to the task are modified.
82
-
83
- - No "while I'm here" changes mixed with the primary task
84
- - If scope creep is detected, flag it — those changes belong in a separate commit
85
- - Structural improvement (refactoring) is measured against stated goals, not unbounded
@@ -1,61 +0,0 @@
1
- # Fix Strategy Formulation
2
-
3
- For each finding from the Diagnostic Review, produce actionable Fix Instructions.
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 (Finding 1 must be done before Finding 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 Finding 1 and Finding 3 share the same root cause or affect the same code path, mark them as a group with a shared fix strategy. This prevents fixing symptoms individually only to have the underlying cause persist.
31
-
32
- ## Fix Ordering
33
-
34
- Order Fix Instructions by:
35
- 1. **Dependencies first** — if Finding 2 depends on Finding 1, Finding 1 comes first
36
- 2. **Grouped fixes together** — related findings are adjacent
37
-
38
- ## Finding Format
39
-
40
- ```
41
- ### Finding N: Title
42
- - Location: file:line
43
- - Dimension: category
44
- - Problem: what is wrong and why it matters
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: Finding X (if grouped)
59
- - Depends On: Finding Y (if dependency)
60
- - Blocks: Finding Z (if blocking)
61
- ```