prizmkit 1.0.45 → 1.0.66

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 (67) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/claude/agent-adapter.js +2 -1
  3. package/bundled/adapters/claude/command-adapter.js +3 -3
  4. package/bundled/agents/prizm-dev-team-dev.md +1 -1
  5. package/bundled/dev-pipeline/README.md +6 -8
  6. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +24 -19
  7. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +2 -2
  8. package/bundled/dev-pipeline/launch-daemon.sh +2 -2
  9. package/bundled/dev-pipeline/lib/branch.sh +76 -0
  10. package/bundled/dev-pipeline/run-bugfix.sh +58 -149
  11. package/bundled/dev-pipeline/run.sh +60 -153
  12. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +17 -4
  13. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +2 -2
  14. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +16 -27
  15. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +20 -32
  16. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +32 -53
  17. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +29 -41
  18. package/bundled/dev-pipeline/templates/session-status-schema.json +1 -1
  19. package/bundled/dev-pipeline/tests/conftest.py +19 -126
  20. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +207 -0
  21. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +128 -141
  22. package/bundled/dev-pipeline/tests/test_utils.py +51 -110
  23. package/bundled/rules/prizm/prizm-commit-workflow.md +3 -3
  24. package/bundled/skills/_metadata.json +15 -16
  25. package/bundled/skills/app-planner/SKILL.md +8 -7
  26. package/bundled/skills/bug-fix-workflow/SKILL.md +171 -0
  27. package/bundled/skills/bug-planner/SKILL.md +25 -33
  28. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +156 -0
  29. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +5 -7
  30. package/bundled/skills/dev-pipeline-launcher/SKILL.md +4 -6
  31. package/bundled/skills/feature-workflow/SKILL.md +25 -42
  32. package/bundled/skills/prizm-kit/SKILL.md +61 -23
  33. package/bundled/skills/prizm-kit/assets/{claude-md-template.md → project-memory-template.md} +3 -3
  34. package/bundled/skills/prizmkit-analyze/SKILL.md +44 -33
  35. package/bundled/skills/prizmkit-clarify/SKILL.md +40 -30
  36. package/bundled/skills/prizmkit-code-review/SKILL.md +58 -45
  37. package/bundled/skills/prizmkit-committer/SKILL.md +30 -68
  38. package/bundled/skills/prizmkit-implement/SKILL.md +60 -28
  39. package/bundled/skills/prizmkit-init/SKILL.md +57 -66
  40. package/bundled/skills/prizmkit-plan/SKILL.md +60 -23
  41. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +74 -19
  42. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +23 -23
  43. package/bundled/skills/prizmkit-retrospective/SKILL.md +142 -65
  44. package/bundled/skills/prizmkit-retrospective/assets/retrospective-template.md +13 -0
  45. package/bundled/skills/prizmkit-specify/SKILL.md +69 -15
  46. package/bundled/skills/refactor-workflow/SKILL.md +116 -52
  47. package/bundled/team/prizm-dev-team.json +2 -2
  48. package/package.json +1 -1
  49. package/src/scaffold.js +4 -4
  50. package/bundled/dev-pipeline/lib/worktree.sh +0 -164
  51. package/bundled/dev-pipeline/tests/__init__.py +0 -0
  52. package/bundled/dev-pipeline/tests/test_check_session.py +0 -131
  53. package/bundled/dev-pipeline/tests/test_cleanup_logs.py +0 -119
  54. package/bundled/dev-pipeline/tests/test_detect_stuck.py +0 -207
  55. package/bundled/dev-pipeline/tests/test_generate_prompt.py +0 -190
  56. package/bundled/dev-pipeline/tests/test_init_bugfix_pipeline.py +0 -153
  57. package/bundled/dev-pipeline/tests/test_init_pipeline.py +0 -241
  58. package/bundled/dev-pipeline/tests/test_update_bug_status.py +0 -142
  59. package/bundled/dev-pipeline/tests/test_update_feature_status.py +0 -338
  60. package/bundled/dev-pipeline/tests/test_worktree.py +0 -236
  61. package/bundled/dev-pipeline/tests/test_worktree_integration.py +0 -796
  62. package/bundled/skills/prizm-kit/assets/codebuddy-md-template.md +0 -35
  63. package/bundled/skills/prizm-kit/assets/hooks/prizm-commit-hook.json +0 -15
  64. package/bundled/skills/prizmkit-summarize/SKILL.md +0 -51
  65. package/bundled/skills/prizmkit-summarize/assets/registry-template.md +0 -18
  66. package/bundled/templates/hooks/commit-intent-claude.json +0 -26
  67. /package/bundled/templates/hooks/{commit-intent-codebuddy.json → commit-intent.json} +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: "prizmkit-init"
3
- description: "Project takeover and bootstrap. Scans any project, generates Prizm docs, configures hooks. Use 'prizmkit.init' to start. (project)"
3
+ description: "Project takeover and bootstrap. Scans any project, generates Prizm docs, configures hooks. Use this skill whenever a user opens a new project for the first time, says 'initialize', 'set up PrizmKit', 'take over this project', 'bootstrap', 'scan this codebase', 'init', or when .prizm-docs/ doesn't exist yet. Also use when PrizmKit was just installed via npx but not yet initialized. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Init
@@ -11,11 +11,20 @@ Project takeover and bootstrap skill. Scans any project (brownfield or greenfiel
11
11
  - Taking over a new project (brownfield or greenfield)
12
12
  - User says "initialize PrizmKit", "set up PrizmKit", "take over this project"
13
13
  - First time using PrizmKit on a project
14
+ - After `npx prizmkit install` when project has no `.prizm-docs/`
14
15
 
15
- ### Commands
16
+ ### When NOT to Use
17
+ - `.prizm-docs/` already exists and is up to date → use `/prizmkit-prizm-docs` (Update) instead
18
+ - User just wants to update stale docs → use `/prizmkit-prizm-docs` (Update or Rebuild)
19
+ - User wants to start a feature → skip init if already initialized, go to `/prizmkit-specify`
16
20
 
17
- #### prizmkit.init
18
- Full project initialization.
21
+ ### Error Handling
22
+ - If `.prizm-docs/` already exists: ask user if they want to reinitialize (overwrites) or update (preserves)
23
+ - If no source files found in any directory: fall back to greenfield mode
24
+ - If platform cannot be detected: ask user explicitly which platform(s) to configure
25
+ - If `${SKILL_DIR}/../../../assets/project-memory-template.md` is missing: generate inline PrizmKit section instead of failing
26
+
27
+ ## Execution Steps
19
28
 
20
29
  **PLATFORM DETECTION (before anything else):**
21
30
  1. Check for platform indicators in the current environment:
@@ -34,89 +43,48 @@ BROWNFIELD WORKFLOW (existing project):
34
43
 
35
44
  **Step 1: Project Scanning**
36
45
  1. Detect tech stack from build files (`package.json`, `requirements.txt`, `go.mod`, `pom.xml`, `Cargo.toml`, etc.)
37
- 2. Map directory structure using a TWO-TIER model — do NOT flatten:
46
+ 2. Map directory structure using a TWO-TIER model — flat structures lose the nesting relationships that AI needs to navigate the codebase:
38
47
  - TOP-LEVEL modules: directories directly under project root that contain source files or sub-directories with source files (e.g. `dev-pipeline/`, `src/`, `internal/`)
39
48
  - SUB-MODULES: directories INSIDE a top-level module (e.g. `dev-pipeline/scripts/`, `dev-pipeline/lib/`)
40
- - A sub-module is NEVER treated as a top-level module, even if it has many files
49
+ - A sub-module maps to `.prizm-docs/<M>/<S>.prizm`, never to `.prizm-docs/<S>.prizm` flattening would create ambiguous paths when two modules have identically-named sub-modules
41
50
  - Exclude: `.git/`, `node_modules/`, `vendor/`, `build/`, `dist/`, `__pycache__/`, `.claude/`, `.codebuddy/`, `.prizmkit/`, `.prizm-docs/`
42
51
  3. Identify entry points by language convention
43
52
  4. Catalog dependencies (external packages)
44
53
  5. Count source files per directory
45
54
 
46
55
  **Step 2: Prizm Documentation Generation**
47
- 2a. Invoke prizmkit-prizm-docs `prizmkit.doc.init` algorithm, passing the two-tier module structure from Step 1:
56
+ Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structure from Step 1:
48
57
  - Create `.prizm-docs/` directory structure mirroring the source tree (sub-module dirs become subdirectories under `.prizm-docs/<top-level>/`)
49
- - Generate `root.prizm` (L0) with project meta and MODULE_INDEX listing ONLY top-level modules
58
+ - Generate `root.prizm` (L0) with project meta and MODULE_INDEX listing only top-level modules
50
59
  - Generate L1 docs for top-level modules at `.prizm-docs/<M>.prizm` and for sub-modules at `.prizm-docs/<M>/<S>.prizm`
51
60
  - Create `changelog.prizm`
52
- - Skip L2 (lazy generation)
53
-
54
- 2b. If project has existing `docs/AI_CONTEXT/`: suggest running `prizmkit.doc.migrate`
61
+ - Skip L2 (lazy generation) — L2 is generated on first file modification, saving tokens upfront
55
62
 
56
63
  **Step 3: PrizmKit Workspace Initialization**
57
64
  3a. Create `.prizmkit/` directory:
58
65
  - `.prizmkit/config.json` (adoption_mode, speckit_hooks_enabled, platform)
59
66
  - `.prizmkit/specs/` (empty)
60
67
 
61
- **Step 4: Hook & Settings Configuration (Platform-Specific)**
62
-
63
- **If platform is CodeBuddy (or both):**
64
- 4a-cb. Read or create `.codebuddy/settings.json`
65
- 4b-cb. Add UserPromptSubmit hook from `${SKILL_DIR}/../../../assets/hooks/prizm-commit-hook.json`
66
- 4c-cb. Preserve any existing hooks
67
-
68
- **If platform is Claude Code (or both):**
69
- 4a-cl. Read or create `.claude/settings.json`
70
- 4b-cl. Add `permissions` and `allowedTools` entries if needed
71
- 4c-cl. Create `.claude/rules/prizm-documentation.md` with glob-scoped rules:
72
- ```yaml
73
- ---
74
- description: PrizmKit documentation rules
75
- globs:
76
- - "**/*.ts"
77
- - "**/*.js"
78
- - "**/*.py"
79
- - "**/*.go"
80
- ---
81
- When modifying source files:
82
- 1. Read `.prizm-docs/root.prizm` to understand project structure
83
- 2. After changes, update affected `.prizm-docs/` files
84
- 3. Follow Prizm doc format (KEY: value, not prose)
85
- ```
86
- 4d-cl. Create `.claude/rules/prizm-commit-workflow.md` with commit-scoped rules:
87
- ```yaml
88
- ---
89
- description: PrizmKit commit workflow enforcement
90
- globs:
91
- - "**/*"
92
- ---
93
- Before any git commit:
94
- 1. Run git diff --cached --name-status
95
- 2. Map changed files to modules via root.prizm MODULE_INDEX
96
- 3. Update affected .prizm-docs/ files
97
- 4. Stage .prizm-docs/ changes
98
- 5. Use /prizmkit-committer for the complete workflow
99
- ```
100
- 4e-cl. Preserve any existing Claude settings and rules
101
-
102
- **Step 5: Project Memory Update (Platform-Specific)**
103
-
104
- **If platform is CodeBuddy (or both):**
105
- 5a-cb. Read existing `CODEBUDDY.md` (or create if missing)
106
- 5b-cb. Append PrizmKit section from `${SKILL_DIR}/../../../assets/codebuddy-md-template.md`
107
- 5c-cb. Do not duplicate if already present
108
-
109
- **If platform is Claude Code (or both):**
110
- 5a-cl. Read existing `CLAUDE.md` (or create if missing)
111
- 5b-cl. Append PrizmKit section from `${SKILL_DIR}/../../../assets/claude-md-template.md`
112
- 5c-cl. Adjust command references to use `/command-name` format (not `prizmkit.xxx`)
113
- 5d-cl. Do not duplicate if already present
68
+ **Step 4: Hook & Settings Configuration**
69
+
70
+ 4a. Read or create platform settings file (`.codebuddy/settings.json` or `.claude/settings.json`)
71
+ 4b. Add UserPromptSubmit and PostToolUse hooks for automatic prizm-docs reminders
72
+ 4c. For Claude Code: also add `permissions` entries and `.claude/rules/` for documentation enforcement:
73
+ - `.claude/rules/prizm-documentation.md` (glob-scoped source file rules)
74
+ - `.claude/rules/prizm-commit-workflow.md` (commit workflow enforcement)
75
+ 4d. Preserve any existing hooks and settings — never overwrite user's custom configuration
76
+
77
+ **Step 5: Project Memory Update**
78
+
79
+ 5a. Read existing project memory file (`CODEBUDDY.md` or `CLAUDE.md`) or create if missing
80
+ 5b. Append PrizmKit section from `${SKILL_DIR}/../../../assets/project-memory-template.md`
81
+ 5c. Do not duplicate if PrizmKit section already present
114
82
 
115
83
  **Step 6: Report**
116
84
  Output summary: platform detected, tech stack detected, modules discovered, L1 docs generated, platform-specific configuration applied, next recommended steps.
117
85
 
118
86
  Include platform-specific guidance:
119
- - CodeBuddy: "Use `prizmkit.specify` to start your first feature"
87
+ - CodeBuddy: "Use `/prizmkit-specify` to start your first feature"
120
88
  - Claude Code: "Use `/prizmkit-specify` to start your first feature"
121
89
 
122
90
  GREENFIELD WORKFLOW (new project):
@@ -137,7 +105,7 @@ User can change mode in `.prizmkit/config.json`: `"adoption_mode": "passive" | "
137
105
 
138
106
  | Concept | CodeBuddy | Claude Code |
139
107
  |---------|-----------|-------------|
140
- | Command invocation | `prizmkit.xxx` | `/prizmkit-xxx` |
108
+ | Command invocation | `/prizmkit-xxx` | `/prizmkit-xxx` |
141
109
  | Project memory | `CODEBUDDY.md` | `CLAUDE.md` |
142
110
  | Settings | `.codebuddy/settings.json` | `.claude/settings.json` |
143
111
  | Skills/Commands | `.codebuddy/skills/` | `.claude/commands/` |
@@ -145,4 +113,27 @@ User can change mode in `.prizmkit/config.json`: `"adoption_mode": "passive" | "
145
113
  | Rules | hooks in settings.json | `.claude/rules/*.md` |
146
114
  | CLI command | `cbc` | `claude` |
147
115
 
116
+ ## Example
117
+
118
+ **Brownfield init on a Node.js project:**
119
+ ```
120
+ $ /prizmkit-init
121
+
122
+ Platform detected: Claude Code
123
+ Tech stack: TypeScript, Node.js, Express
124
+ Mode: Brownfield (154 source files found)
125
+
126
+ Modules discovered:
127
+ src/routes/ → .prizm-docs/routes.prizm (12 files)
128
+ src/models/ → .prizm-docs/models.prizm (8 files)
129
+ src/services/ → .prizm-docs/services.prizm (15 files)
130
+ src/middleware/ → .prizm-docs/middleware.prizm (5 files)
131
+
132
+ Generated: root.prizm + 4 L1 docs + changelog.prizm
133
+ Configured: .claude/rules/ (2 files), hooks in settings.json
134
+ Updated: CLAUDE.md with PrizmKit section
135
+
136
+ Next: Use /prizmkit-specify to start your first feature
137
+ ```
138
+
148
139
  IMPORTANT: Use `${SKILL_DIR}` placeholder for all path references. Never hardcode absolute paths.
@@ -1,26 +1,38 @@
1
1
  ---
2
2
  name: "prizmkit-plan"
3
- description: "Generate technical implementation plan and executable task breakdown from feature spec. Produces plan.md with architecture, data model, API contracts, and a Tasks section. Invoke after 'specify' when ready to plan. (project)"
3
+ description: "Generate technical implementation plan and executable task breakdown from feature spec. Produces plan.md with architecture, data model, API contracts, and a Tasks section. Use this skill whenever the user wants to design how a feature will be built, break work into tasks, or think through architecture. Trigger on: 'plan', 'architect', 'how to build', 'design', 'break it down', 'break this into tasks', 'create tasks', 'implementation strategy', 'how should we implement'. Always use after /prizmkit-specify and before /prizmkit-implement. (project)"
4
4
  ---
5
5
 
6
6
  # PrizmKit Plan
7
7
 
8
8
  Generate a comprehensive technical implementation plan from a feature specification. Produces plan.md with architecture approach, component design, data model, API contracts, testing strategy, risk assessment, and an executable Tasks section.
9
9
 
10
- ## Commands
10
+ ### When to Use
11
+ - After `/prizmkit-specify` when ready to plan the implementation
12
+ - User says "plan", "architect", "how to build", "design", "break it down", "create tasks"
13
+ - Before `/prizmkit-implement` to create the task breakdown
14
+ - When user wants to understand the full implementation approach before coding
11
15
 
12
- ### prizmkit.plan
16
+ ### When NOT to Use
17
+ - No input document exists yet (no spec.md, no refactor-analysis.md, no fix-plan.md) → run `/prizmkit-specify` or the appropriate upstream skill first
18
+ - Simple bug fix or config change → use fast path (`/prizmkit-plan` with simplified output → `/prizmkit-implement` → `/prizmkit-committer`)
19
+ - User just wants to explore/research → answer directly, no plan artifact needed
13
20
 
14
- Create a technical implementation plan and task breakdown for a specified feature.
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.
15
26
 
16
- **PRECONDITION:** `spec.md` exists in `.prizmkit/specs/###-feature-name/`, `.prizm-docs/root.prizm` exists
17
-
18
- **STEPS:**
27
+ ## Execution Steps
19
28
 
20
29
  **Phase 0 — Research:**
21
- 1. Read `spec.md` for feature requirements
30
+ 1. Read the input document for requirements:
31
+ - **Feature mode**: Read `spec.md` for feature requirements
32
+ - **Refactor mode**: Read `refactor-analysis.md` for refactoring goals, scope boundary, and baseline tests
33
+ - **Bugfix mode**: Read bug description / `fix-plan.md` for reproduction steps and expected fix
22
34
  2. Load project context (use first available source):
23
- - If `.prizmkit/specs/###-feature-name/context-snapshot.md` exists → read it for all context (Section 3 'Prizm Context' for docs, Section 4 'Existing Source Files' for code). Do NOT re-read `.prizm-docs/` or individual source files.
35
+ - If `.prizmkit/specs/###-feature-name/context-snapshot.md` exists → read it for all context (Section 3 'Prizm Context' for docs, Section 4 'Existing Source Files' for code). The context-snapshot consolidates dozens of individual files into one read, saving significant tokens.
24
36
  - Otherwise → read `.prizm-docs/root.prizm` and relevant `.prizm-docs/` L1/L2 docs for affected modules
25
37
  3. Resolve any remaining `[NEEDS CLARIFICATION]` by proposing solutions
26
38
  4. Research technical approach based on project's tech stack
@@ -34,8 +46,8 @@ Create a technical implementation plan and task breakdown for a specified featur
34
46
  - Integration points (external services, internal modules)
35
47
  - Testing strategy (unit, integration, e2e)
36
48
  - Risk assessment
37
- 6. Cross-check plan against spec: every user story MUST map to plan components
38
- 7. Check alignment with project rules from `.prizm-docs/root.prizm` RULES section
49
+ 6. Cross-check plan against spec: every user story should map to plan components — unmapped stories mean the plan has coverage gaps that will surface during implementation
50
+ 7. Check alignment with project rules from `.prizm-docs/root.prizm` RULES section — violating project rules causes CRITICAL findings in the analyze phase
39
51
 
40
52
  **Phase 2 — Task Generation:**
41
53
  8. Ask user for implementation strategy (or infer from context): MVP-first / Incremental / Parallel
@@ -44,19 +56,40 @@ Create a technical implementation plan and task breakdown for a specified featur
44
56
  - Each task: `- [ ] [T-NNN] [P?] [US?] Description — file: path/to/file`
45
57
  - `[P]` marker for tasks that can run in parallel within their phase
46
58
  - Checkpoint tasks between phases for validation
47
- 10. Verify: every user story maps to at least one task; every task references a target file path
59
+ 10. Verify coverage and traceability:
60
+ - Every user story maps to at least one task — orphan stories become orphan features
61
+ - Every task references a target file path — pathless tasks leave implementers guessing where to write code
62
+ - Risk assessment includes at least one risk with mitigation — helps the implementer prepare for known challenges
48
63
  11. Output: `plan.md` path, summary of design decisions, and task count
49
64
 
50
- **KEY RULES:**
51
- - Every user story in spec.md MUST have a corresponding component AND task in the plan
52
- - Architecture decisions MUST align with existing project patterns from `.prizm-docs/`
53
- - Risk assessment MUST include at least one risk with mitigation strategy
54
- - Supporting details (data model, interface design) are included as sections within plan.md, not as separate files
55
- - Task IDs use zero-padded numbering: `[T-001]`, `[T-010]`, `[T-100]`
56
- - Every task MUST reference a target file path
57
- - Each user story section MUST be independently testable
65
+ **Task ID Conventions:**
66
+ - Task IDs use zero-padded numbering: `[T-001]`, `[T-010]`, `[T-100]` this ensures consistent sorting and visual alignment
67
+ - Each user story section should be independently testable this enables incremental verification during implementation
68
+
69
+ **HANDOFF:** `/prizmkit-analyze` or `/prizmkit-implement`
70
+
71
+ ## Example
72
+
73
+ **Input:** spec.md for "User Avatar Upload" feature
58
74
 
59
- **HANDOFF:** `prizmkit.analyze` or `prizmkit.implement`
75
+ **Output:** plan.md excerpt:
76
+ ```markdown
77
+ ## Architecture Approach
78
+ Extend existing user profile module. Add S3 integration for file storage.
79
+ Reuse existing auth middleware for upload endpoint protection.
80
+
81
+ ## Tasks
82
+
83
+ ### Phase 1: Data Layer (T-010~T-019)
84
+ - [ ] [T-010] [US-1] Add avatar_url field to User model — file: src/models/user.ts
85
+ - [ ] [T-011] [US-1] Create S3 upload utility — file: src/lib/s3.ts
86
+ - [ ] [T-012] CP: Data layer checkpoint — run migrations + unit tests
87
+
88
+ ### Phase 2: API [P] (T-100~T-109)
89
+ - [ ] [T-100] [P] [US-1] POST /api/avatar upload endpoint — file: src/routes/avatar.ts
90
+ - [ ] [T-101] [P] [US-2] DELETE /api/avatar endpoint — file: src/routes/avatar.ts
91
+ - [ ] [T-102] CP: API checkpoint — integration tests pass
92
+ ```
60
93
 
61
94
  ## Template
62
95
 
@@ -64,5 +97,9 @@ The plan template is located at `${SKILL_DIR}/assets/plan-template.md`.
64
97
 
65
98
  ## Output
66
99
 
67
- All outputs are written to `.prizmkit/specs/###-feature-name/`:
68
- - `plan.md` — The implementation plan (includes architecture, component design, data model, interface design, testing strategy, risk assessment, and Tasks section)
100
+ Output directory depends on mode:
101
+ - **Feature mode**: `.prizmkit/specs/###-feature-name/plan.md`
102
+ - **Refactor mode**: `.prizmkit/refactor/<refactor-slug>/plan.md`
103
+ - **Bugfix mode**: `.prizmkit/bugfix/<BUG_ID>/plan.md`
104
+
105
+ The plan.md includes architecture, component design, data model, interface design, testing strategy, risk assessment, and Tasks section.
@@ -1,15 +1,42 @@
1
1
  ---
2
2
  name: "prizmkit-prizm-docs"
3
- description: "AI-only documentation framework for progressive context loading. Manages .prizm-docs/ with 3-level hierarchy (L0/L1/L2). Use 'prizmkit.doc.init' to bootstrap, 'prizmkit.doc.update' to sync, 'prizmkit.doc.status' to check freshness, 'prizmkit.doc.rebuild' to regenerate, 'prizmkit.doc.validate' to check compliance, 'prizmkit.doc.migrate' to convert existing docs."
3
+ description: "Project documentation specification and standard for AI-optimized progressive context loading. Defines the .prizm-docs/ 3-level hierarchy (L0/L1/L2), format rules, size limits, and loading protocol. Use this skill to: bootstrap docs for new projects (init), check doc freshness (status), regenerate stale modules (rebuild), validate format compliance (validate), or migrate existing docs (migrate). For incremental doc updates after code changes, use /prizmkit-retrospective instead — it is the sole writer of .prizm-docs/ during development. Trigger on: 'initialize docs', 'check doc status', 'rebuild docs', 'validate docs', 'migrate docs', 'docs are stale', 'prizm docs'. (project)"
4
4
  ---
5
5
 
6
6
  # Prizm Docs - AI Documentation Framework
7
7
 
8
8
  Full specification: ${SKILL_DIR}/assets/PRIZM-SPEC.md
9
9
 
10
- ## Commands
10
+ ## Intent Routing
11
11
 
12
- ### prizmkit.doc.init
12
+ This skill handles 6 operations. When invoked, determine the user's intent and execute the matching operation:
13
+
14
+ | User Intent | Operation | Trigger Phrases |
15
+ |---|---|---|
16
+ | Bootstrap new project docs | **Init** | "initialize docs", "set up prizm docs", "bootstrap documentation" |
17
+ | Sync docs after code changes | **Update** | "update docs", "sync documentation", "docs are stale" |
18
+ | Check doc freshness | **Status** | "check docs", "are docs up to date", "doc status" |
19
+ | Regenerate module docs | **Rebuild** | "rebuild docs for X", "regenerate module docs" |
20
+ | Check format compliance | **Validate** | "validate docs", "check doc format", "docs valid?" |
21
+ | Convert existing docs | **Migrate** | "migrate docs", "convert docs to prizm format" |
22
+
23
+ ---
24
+
25
+ ## Role Clarification
26
+
27
+ **This skill vs `/prizmkit-retrospective`**:
28
+
29
+ | Aspect | `/prizmkit-prizm-docs` | `/prizmkit-retrospective` |
30
+ |--------|----------------------|--------------------------|
31
+ | **Role** | Documentation SPECIFICATION + BOOTSTRAP | Incremental WRITER during development |
32
+ | **When** | Project setup, health checks, migrations | After feature completion, before commit |
33
+ | **Writes** | Initial .prizm-docs/ structure (init, rebuild, migrate) | Incremental updates to existing .prizm-docs/ |
34
+ | **Reads** | Source code structure (for init/rebuild) | git diff + code changes (for sync) |
35
+ | **Knowledge** | Defines format rules, size limits, loading protocol | Extracts TRAPS/RULES/DECISIONS from work done |
36
+
37
+ **Key principle**: `/prizmkit-prizm-docs` defines WHAT the docs should look like and bootstraps them. `/prizmkit-retrospective` is the SOLE WRITER that keeps docs in sync with code during ongoing development.
38
+
39
+ ## Operation: Init
13
40
 
14
41
  Bootstrap .prizm-docs/ for the current project.
15
42
 
@@ -17,27 +44,27 @@ PRECONDITION: No .prizm-docs/ directory exists, or user confirms overwrite.
17
44
 
18
45
  STEPS:
19
46
  1. Detect project type by scanning for build system files (go.mod, package.json, requirements.txt, Cargo.toml, pom.xml, *.csproj). Identify primary language, framework, build command, test command, and entry points.
20
- 2. Discover modules in TWO tiers — DO NOT FLATTEN the directory hierarchy:
47
+ 2. Discover modules in TWO tiers — flat structures lose nesting relationships, and when two modules share an identically-named sub-module (e.g., `utils/`), flattening creates ambiguous paths:
21
48
  - TOP-LEVEL modules: directories directly under project root (or under src/ for src-based layouts) that contain 3+ source files OR contain sub-directories with 3+ source files. These go into MODULE_INDEX.
22
- - SUB-MODULES: directories INSIDE a top-level module that contain 3+ source files. These are NOT top-level modules — they are listed in the parent L1 doc's SUBDIRS section only.
23
- - HIERARCHY RULE: if directory X lives inside top-level module M, it maps to .prizm-docs/<M>/<X>.prizm NEVER to .prizm-docs/<X>.prizm.
49
+ - SUB-MODULES: directories INSIDE a top-level module that contain 3+ source files. Listed in the parent L1 doc's SUBDIRS section only.
50
+ - HIERARCHY RULE: directory X inside top-level module M maps to .prizm-docs/<M>/<X>.prizm, never to .prizm-docs/<X>.prizm.
24
51
  - Exclude vendor/, node_modules/, .git/, build/, dist/, __pycache__/, target/, bin/. If top-level module count > 30, ask user for include/exclude patterns.
25
- 3. Create .prizm-docs/ directory structure mirroring the source tree exactly. For each top-level module M that has sub-modules, create the subdirectory .prizm-docs/<M>/. NEVER place a sub-module's .prizm file at the .prizm-docs/ root.
26
- 4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX listing ONLY top-level modules with arrow pointers to .prizm-docs/<M>.prizm, RULES extracted from CODEBUDDY.md/CLAUDE.md/README/linter configs, and PATTERNS. Sub-modules must NOT appear in MODULE_INDEX. Set PRIZM_VERSION: 2, UPDATED: today's date. Max 4KB.
52
+ 3. Create .prizm-docs/ directory structure mirroring the source tree exactly. For each top-level module M that has sub-modules, create the subdirectory .prizm-docs/<M>/.
53
+ 4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX listing only top-level modules with arrow pointers to .prizm-docs/<M>.prizm (sub-modules stay out of MODULE_INDEX to keep L0 compact and within the 4KB limit), RULES extracted from CODEBUDDY.md/CLAUDE.md/README/linter configs, and PATTERNS. Set PRIZM_VERSION: 2, UPDATED: today's date. Max 4KB.
27
54
  5. Generate L1 .prizm files for ALL modules (top-level and sub-modules), each at its correct mirrored path:
28
55
  - Top-level module M → write .prizm-docs/<M>.prizm (include SUBDIRS section with pointers to sub-module docs)
29
56
  - Sub-module S inside M → write .prizm-docs/<M>/<S>.prizm
30
57
  Each L1 includes MODULE (full relative path), FILES count, RESPONSIBILITY, SUBDIRS with pointers (for top-level only), KEY_FILES (5-10 most important), INTERFACES (public/exported only), DEPENDENCIES (imports, imported-by, external), RULES, DATA_FLOW. Max 3KB each.
31
- 6. DO NOT generate L2 docs during init. L2 is created lazily on first file modification in a sub-module, or when AI needs deep understanding of a module (ON_DEEP_READ trigger).
58
+ 6. Skip L2 docs during init L2 is created lazily on first file modification or when AI needs deep understanding (ON_DEEP_READ trigger). This saves significant upfront token cost on large projects.
32
59
  7. Create changelog.prizm with initial entry: `- YYYY-MM-DD | root | add: initialized prizm documentation framework`
33
- 8. Configure UserPromptSubmit hook in .codebuddy/settings.json per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 11.
34
- 9. Append Prizm protocol section to CODEBUDDY.md per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 12.
60
+ 8. Configure UserPromptSubmit hook in platform settings per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 11.
61
+ 9. Append Prizm protocol section to project memory file (CODEBUDDY.md or CLAUDE.md) per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 12.
35
62
  10. Validate all generated docs: size limits (L0 <= 4KB, L1 <= 3KB), pointer resolution (every -> reference resolves), no circular dependencies, UPDATED timestamps set, KEY: value format compliance, no anti-patterns (prose, code blocks, markdown headers).
36
63
  11. Report summary: modules discovered, L1 docs generated, files excluded, warnings.
37
64
 
38
65
  OUTPUT: List of generated files, module count, and validation results.
39
66
 
40
- ### prizmkit.doc.update
67
+ ## Operation: Update
41
68
 
42
69
  Update .prizm-docs/ to reflect recent code changes.
43
70
 
@@ -56,7 +83,7 @@ STEPS:
56
83
 
57
84
  OUTPUT: List of updated/created/skipped docs with reasons.
58
85
 
59
- ### prizmkit.doc.status
86
+ ## Operation: Status
60
87
 
61
88
  Check freshness of all .prizm docs.
62
89
 
@@ -71,9 +98,9 @@ STEPS:
71
98
 
72
99
  OUTPUT: Freshness report table with columns: DOC_PATH | LEVEL | STATUS | LAST_UPDATED | SOURCE_LAST_MODIFIED.
73
100
 
74
- ### prizmkit.doc.rebuild <module-path>
101
+ ## Operation: Rebuild
75
102
 
76
- Regenerate docs for a specific module from scratch.
103
+ Regenerate docs for a specific module from scratch. Requires a module path argument.
77
104
 
78
105
  PRECONDITION: .prizm-docs/ exists. Module path is valid.
79
106
 
@@ -88,7 +115,7 @@ STEPS:
88
115
 
89
116
  OUTPUT: Regenerated doc summary with before/after comparison.
90
117
 
91
- ### prizmkit.doc.validate
118
+ ## Operation: Validate
92
119
 
93
120
  Check format compliance and consistency of all .prizm docs.
94
121
 
@@ -105,7 +132,7 @@ STEPS:
105
132
 
106
133
  OUTPUT: Validation report with PASS/FAIL per check, list of issues with file paths and suggested fixes.
107
134
 
108
- ### prizmkit.doc.migrate
135
+ ## Operation: Migrate
109
136
 
110
137
  Convert existing documentation to .prizm-docs/ format.
111
138
 
@@ -122,6 +149,13 @@ STEPS:
122
149
 
123
150
  OUTPUT: Migration report with list of source docs processed, generated .prizm files, and any manual review items.
124
151
 
152
+ ## Error Handling
153
+
154
+ - **root.prizm is corrupted or invalid format**: Back up the existing file, then run Rebuild on all modules to regenerate from source code.
155
+ - **Broken pointers (-> references to non-existent files)**: Create the missing .prizm file if the source module exists; remove the pointer if the source module was deleted.
156
+ - **Size limit exceeded**: For L0, consolidate MODULE_INDEX entries. For L1, move implementation details to L2. For L2, archive CHANGELOG entries older than 90 days.
157
+ - **No git history available**: Fall back to filesystem timestamps for freshness checks; warn user that accuracy may be reduced.
158
+
125
159
  ## Progressive Loading Protocol
126
160
 
127
161
  When working in a project with .prizm-docs/:
@@ -135,9 +169,9 @@ When working in a project with .prizm-docs/:
135
169
 
136
170
  ## Auto-Update Protocol
137
171
 
138
- - BEFORE EVERY COMMIT: Update affected .prizm-docs/ files per ${SKILL_DIR}/assets/PRIZM-SPEC.md Section 7.
172
+ - BEFORE EVERY COMMIT: Run `/prizmkit-retrospective` which is the **sole maintainer** of .prizm-docs/. It handles both structural sync and knowledge injection.
139
173
  - The UserPromptSubmit hook will remind you automatically when commit intent is detected.
140
- - If hook is not active, you MUST still follow the update protocol manually.
174
+ - `/prizmkit-committer` does NOT update .prizm-docs/ it only commits what is already staged.
141
175
  - NEVER rewrite entire .prizm files. Only update affected sections.
142
176
 
143
177
  ## RULES Hierarchy
@@ -145,3 +179,24 @@ When working in a project with .prizm-docs/:
145
179
  - root.prizm RULES are authoritative and apply project-wide.
146
180
  - L1/L2 RULES only supplement root.prizm with module-specific exceptions.
147
181
  - If L1/L2 RULES contradict root.prizm RULES, root.prizm takes precedence.
182
+
183
+ ## Examples
184
+
185
+ **Init output (Node.js project):**
186
+ ```
187
+ Generated .prizm-docs/:
188
+ root.prizm (L0) — 3 modules in MODULE_INDEX
189
+ routes.prizm (L1) — 12 files, 4 interfaces
190
+ models.prizm (L1) — 8 files, 3 interfaces
191
+ services.prizm (L1) — 15 files, 6 interfaces
192
+ changelog.prizm — initial entry
193
+ ```
194
+
195
+ **Update after adding new API endpoint:**
196
+ ```
197
+ Changed: src/routes/avatar.ts (A), src/models/user.ts (M)
198
+ Updated: .prizm-docs/routes.prizm — added avatar.ts to KEY_FILES, new POST /api/avatar interface
199
+ Updated: .prizm-docs/models.prizm — updated User interface with avatar_url field
200
+ Skipped: .prizm-docs/services.prizm — no changes in services module
201
+ Appended: changelog.prizm — "2026-03-18 | routes | add: avatar upload endpoint"
202
+ ```
@@ -294,7 +294,7 @@ FOR any source file at path P:
294
294
  1. Walk up directory tree to find the first ancestor D where .prizm-docs/<D>.prizm exists
295
295
  2. That file is the L1 doc for this source file
296
296
  3. If P is inside a subdirectory S of D, check if .prizm-docs/<D>/<S>.prizm exists for L2
297
- 4. If no .prizm doc found, the module is undocumented (may need prizmkit.doc.update)
297
+ 4. If no .prizm doc found, the module is undocumented (may need prizmkit-prizm-docs Update operation)
298
298
 
299
299
  ---
300
300
 
@@ -345,7 +345,7 @@ BUDGET: Typical task should consume 3000-5000 tokens of prizm docs total
345
345
 
346
346
  ## 7.1 Trigger
347
347
 
348
- WHEN: Before every commit (detected automatically via hook, or manually via prizmkit.doc.update)
348
+ WHEN: Before every commit (detected automatically via hook, or manually via prizmkit-prizm-docs Update operation)
349
349
  GOAL: Keep prizm docs synchronized with source code
350
350
 
351
351
  ## 7.2 Update Decision Logic
@@ -441,7 +441,7 @@ NEVER: Rewrite entire .prizm files on update (modify only affected sections)
441
441
 
442
442
  ## 9.1 Algorithm
443
443
 
444
- COMMAND: prizmkit.doc.init
444
+ OPERATION: Init (invoked via prizmkit-prizm-docs skill)
445
445
  PRECONDITION: No .prizm-docs/ directory exists (or user confirms overwrite)
446
446
 
447
447
  ALGORITHM: prizm_init
@@ -575,18 +575,18 @@ ON_DEEP_READ trigger:
575
575
 
576
576
  The Prizm skill is defined at: ${SKILL_DIR}/SKILL.md
577
577
 
578
- COMMANDS:
578
+ OPERATIONS (all invoked via the prizmkit-prizm-docs skill):
579
579
 
580
- prizmkit.doc.init - Bootstrap .prizm-docs/ for a new project (Section 9)
581
- prizmkit.doc.update - Sync docs with code changes (Section 7)
582
- prizmkit.doc.status - Check freshness of all docs
583
- prizmkit.doc.rebuild - Regenerate docs for a specific module
584
- prizmkit.doc.validate - Check format compliance and consistency (Section 10.2)
585
- prizmkit.doc.migrate - Convert existing docs to .prizm-docs/ format (Section 10.3)
580
+ Init - Bootstrap .prizm-docs/ for a new project (Section 9)
581
+ Update - Sync docs with code changes (Section 7)
582
+ Status - Check freshness of all docs
583
+ Rebuild - Regenerate docs for a specific module
584
+ Validate - Check format compliance and consistency (Section 10.2)
585
+ Migrate - Convert existing docs to .prizm-docs/ format (Section 10.3)
586
586
 
587
- ## 10.2 prizmkit.doc.validate
587
+ ## 10.2 Validate Operation
588
588
 
589
- COMMAND: prizmkit.doc.validate
589
+ OPERATION: Validate (invoked via prizmkit-prizm-docs skill)
590
590
  PRECONDITION: .prizm-docs/ directory exists
591
591
 
592
592
  ALGORITHM: prizm_validate
@@ -640,9 +640,9 @@ STEPS:
640
640
 
641
641
  OUTPUT: Validation report with PASS/FAIL per check category, issue list with file paths and line references, suggested fixes for common problems.
642
642
 
643
- ## 10.3 prizmkit.doc.migrate
643
+ ## 10.3 Migrate Operation
644
644
 
645
- COMMAND: prizmkit.doc.migrate
645
+ OPERATION: Migrate (invoked via prizmkit-prizm-docs skill)
646
646
  PRECONDITION: Existing documentation (docs/, docs/AI_CONTEXT/, README.md, ARCHITECTURE.md, etc.). No .prizm-docs/ directory (or user confirms overwrite).
647
647
 
648
648
  ALGORITHM: prizm_migrate
@@ -713,7 +713,7 @@ JSON:
713
713
  "hooks": [
714
714
  {
715
715
  "type": "command",
716
- "command": "echo 'PRIZMKIT_DOC_UPDATE_REQUIRED: Before committing, you MUST update .prizm-docs/ per Prizm auto-update protocol. Steps: 1) Run git diff --cached --name-status. 2) Map changed files to modules via root.prizm MODULE_INDEX. 3) Read and update affected .prizm files (only changed sections). 4) Append to changelog.prizm. 5) Stage .prizm files with git add .prizm-docs/. 6) Then proceed with commit. RULES: Never rewrite entire .prizm files. Never add prose. Only update affected sections.'"
716
+ "command": "echo 'PRIZMKIT_MEMORY_MAINTENANCE_REQUIRED: Before committing, you MUST run /prizmkit-retrospective to maintain .prizm-docs/ project memory. It handles both structural sync (KEY_FILES, INTERFACES, DEPENDENCIES) and knowledge injection (TRAPS, RULES, DECISIONS). After retrospective completes, proceed with /prizmkit-committer for the actual git commit.'"
717
717
  }
718
718
  ]
719
719
  }
@@ -749,7 +749,7 @@ The core requirement is: before any commit operation, AI must update affected .p
749
749
 
750
750
  ## 12.1 Template Section
751
751
 
752
- Append the following to any project's CODEBUDDY.md during prizmkit.doc.init:
752
+ Append the following to any project's CODEBUDDY.md during Init operation:
753
753
 
754
754
  TEXT:
755
755
 
@@ -835,8 +835,8 @@ FILES:
835
835
  This is enough to give AI a project overview and track changes.
836
836
  L1 and L2 docs can be added incrementally as AI works in specific areas.
837
837
 
838
- BOOTSTRAP_COMMAND:
839
- prizmkit.doc.init
838
+ BOOTSTRAP:
839
+ Invoke prizmkit-prizm-docs skill (Init operation)
840
840
 
841
841
  Or manually create these two files following the templates in Section 3.
842
842
 
@@ -854,8 +854,8 @@ V1 (2026-03-02): Initial specification
854
854
 
855
855
  V2 (2026-03-02): Enhanced specification
856
856
  - Added ON_DEEP_READ trigger for L2 generation (L2 created during deep analysis, not just modifications)
857
- - Added prizmkit.doc.validate command for format compliance and consistency checking
858
- - Added prizmkit.doc.migrate command for converting existing docs to .prizm-docs/ format
857
+ - Added Validate operation for format compliance and consistency checking
858
+ - Added Migrate operation for converting existing docs to .prizm-docs/ format
859
859
  - Added RULES hierarchy: root.prizm RULES authoritative, L1/L2 supplement only with module-specific exceptions
860
860
  - Added Section 16: Conflict Resolution for multi-person collaboration merge strategies
861
861
  - Added Section 17: Version Migration for upgrading between spec versions
@@ -916,7 +916,7 @@ ALGORITHM: prizm_merge_conflict
916
916
 
917
917
  ## 16.4 Prevention
918
918
 
919
- BEST_PRACTICE: Run prizmkit.doc.update immediately before committing to minimize drift
919
+ BEST_PRACTICE: Run prizmkit-prizm-docs Update operation immediately before committing to minimize drift
920
920
  BEST_PRACTICE: Keep .prizm doc changes small and focused (section-level, not file-level rewrites)
921
921
  BEST_PRACTICE: Coordinate on MODULE_INDEX changes (adding/removing modules) to avoid structural conflicts
922
922
 
@@ -932,7 +932,7 @@ MIGRATION_TRIGGER: AI detects PRIZM_VERSION in root.prizm and applies migration
932
932
 
933
933
  ## 17.2 V1 to V2 Migration
934
934
 
935
- COMMAND: Automatic on first prizmkit.doc.update or prizmkit.doc.validate after spec upgrade
935
+ TRIGGER: Automatic on first prizmkit-prizm-docs Update or Validate operation after spec upgrade
936
936
 
937
937
  ALGORITHM: prizm_migrate_v1_to_v2
938
938
 
@@ -947,7 +947,7 @@ ALGORITHM: prizm_migrate_v1_to_v2
947
947
  FLAG: Any L1/L2 RULES that contradict root.prizm RULES for manual review
948
948
 
949
949
  3. VALIDATE:
950
- Run full prizmkit.doc.validate
950
+ Run full Validate operation
951
951
  REPORT: Migration results and any issues found
952
952
 
953
953
  4. UPDATE_CHANGELOG: