clavix 7.1.1 → 7.2.1

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/README.md CHANGED
@@ -81,3 +81,13 @@ Run `clavix init` and select your tools. Command format varies by tool:
81
81
  ## License
82
82
 
83
83
  Apache-2.0
84
+
85
+ ## Star History
86
+
87
+ <a href="https://www.star-history.com/#ClavixDev/Clavix&type=date&legend=top-left">
88
+ <picture>
89
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=ClavixDev/Clavix&type=date&theme=dark&legend=top-left" />
90
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=ClavixDev/Clavix&type=date&legend=top-left" />
91
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=ClavixDev/Clavix&type=date&legend=top-left" />
92
+ </picture>
93
+ </a>
@@ -0,0 +1,200 @@
1
+ # Clavix Instructions for Generic Agents
2
+
3
+ This guide is for agents that can only read documentation (no slash-command support). If your platform supports custom slash commands, use those instead.
4
+
5
+ ---
6
+
7
+ ## ⛔ CLAVIX MODE ENFORCEMENT
8
+
9
+ **CRITICAL: Know which mode you're in and STOP at the right point.**
10
+
11
+ **OPTIMIZATION workflows** (NO CODE ALLOWED):
12
+ - Improve mode - Prompt optimization only (auto-selects depth)
13
+ - Your role: Analyze, optimize, show improved prompt, **STOP**
14
+ - ❌ DO NOT implement the prompt's requirements
15
+ - ✅ After showing optimized prompt, tell user: "Run `/clavix:implement --latest` to implement"
16
+
17
+ **PLANNING workflows** (NO CODE ALLOWED):
18
+ - Conversational mode, requirement extraction, PRD generation
19
+ - Your role: Ask questions, create PRDs/prompts, extract requirements
20
+ - ❌ DO NOT implement features during these workflows
21
+
22
+ **IMPLEMENTATION workflows** (CODE ALLOWED):
23
+ - Only after user runs execute/implement commands
24
+ - Your role: Write code, execute tasks, implement features
25
+ - ✅ DO implement code during these workflows
26
+
27
+ **If unsure, ASK:** "Should I implement this now, or continue with planning?"
28
+
29
+ See `.clavix/instructions/core/clavix-mode.md` for complete mode documentation.
30
+
31
+ ---
32
+
33
+ ## 📁 Detailed Workflow Instructions
34
+
35
+ For complete step-by-step workflows, see `.clavix/instructions/`:
36
+
37
+ | Workflow | Instruction File | Purpose |
38
+ |----------|-----------------|---------|
39
+ | **Conversational Mode** | `workflows/start.md` | Natural requirements gathering through discussion |
40
+ | **Extract Requirements** | `workflows/summarize.md` | Analyze conversation → mini-PRD + optimized prompts |
41
+ | **Prompt Optimization** | `workflows/improve.md` | Intent detection + quality assessment + auto-depth selection |
42
+ | **PRD Generation** | `workflows/prd.md` | Socratic questions → full PRD + quick PRD |
43
+ | **Mode Boundaries** | `core/clavix-mode.md` | Planning vs implementation distinction |
44
+ | **File Operations** | `core/file-operations.md` | File creation patterns |
45
+ | **Verification** | `core/verification.md` | Post-implementation verification |
46
+
47
+ **Troubleshooting:**
48
+ - `troubleshooting/jumped-to-implementation.md` - If you started coding during planning
49
+ - `troubleshooting/skipped-file-creation.md` - If files weren't created
50
+ - `troubleshooting/mode-confusion.md` - When unclear about planning vs implementation
51
+
52
+ ---
53
+
54
+ ## 🔍 Workflow Detection Keywords
55
+
56
+ | Keywords in User Request | Recommended Workflow | File Reference |
57
+ |---------------------------|---------------------|----------------|
58
+ | "improve this prompt", "make it better", "optimize" | Improve mode → Auto-depth optimization | `workflows/improve.md` |
59
+ | "analyze thoroughly", "edge cases", "alternatives" | Improve mode (--comprehensive) | `workflows/improve.md` |
60
+ | "create a PRD", "product requirements" | PRD mode → Socratic questioning | `workflows/prd.md` |
61
+ | "let's discuss", "not sure what I want" | Conversational mode → Start gathering | `workflows/start.md` |
62
+ | "summarize our conversation" | Extract mode → Analyze thread | `workflows/summarize.md` |
63
+ | "refine", "update PRD", "change requirements", "modify prompt" | Refine mode → Update existing content | `workflows/refine.md` |
64
+ | "verify", "check my implementation" | Verify mode → Implementation verification | `core/verification.md` |
65
+
66
+ **When detected:** Reference the corresponding `.clavix/instructions/workflows/{workflow}.md` file.
67
+
68
+ ---
69
+
70
+ ## 📋 Clavix Commands (v5)
71
+
72
+ ### Setup Commands (CLI)
73
+ | Command | Purpose |
74
+ |---------|---------|
75
+ | `clavix init` | Initialize Clavix in a project |
76
+ | `clavix update` | Update templates after package update |
77
+ | `clavix diagnose` | Check installation health |
78
+ | `clavix version` | Show version |
79
+
80
+ ### Workflow Commands (Slash Commands)
81
+ All workflows are executed via slash commands that AI agents read and follow:
82
+
83
+ > **Command Format:** Commands shown with colon (`:`) format. Some tools use hyphen (`-`): Claude Code uses `/clavix:improve`, Cursor uses `/clavix-improve`. Your tool autocompletes the correct format.
84
+
85
+ | Slash Command | Purpose |
86
+ |---------------|---------|
87
+ | `/clavix:improve` | Optimize prompts (auto-selects depth) |
88
+ | `/clavix:prd` | Generate PRD through guided questions |
89
+ | `/clavix:plan` | Create task breakdown from PRD |
90
+ | `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
91
+ | `/clavix:start` | Begin conversational session |
92
+ | `/clavix:summarize` | Extract requirements from conversation |
93
+ | `/clavix:refine` | Refine existing PRD or saved prompt |
94
+
95
+ ### Agentic Utilities (Project Management)
96
+ These utilities provide structured workflows for project completion:
97
+
98
+ | Utility | Purpose |
99
+ |---------|---------|
100
+ | `/clavix:verify` | Check implementation against PRD requirements, run validation |
101
+ | `/clavix:archive` | Archive completed work to `.clavix/archive/` for reference |
102
+
103
+ **Quick start:**
104
+ ```bash
105
+ npm install -g clavix
106
+ clavix init
107
+ ```
108
+
109
+ **How it works:** Slash commands are markdown templates. When invoked, the agent reads the template and follows its instructions using native tools (Read, Write, Edit, Bash).
110
+
111
+ ---
112
+
113
+ ## 🔄 Standard Workflow
114
+
115
+ **Clavix follows this progression:**
116
+
117
+ ```
118
+ PRD Creation → Task Planning → Implementation → Archive
119
+ ```
120
+
121
+ **Detailed steps:**
122
+
123
+ 1. **Planning Phase**
124
+ - Run: `/clavix:prd` or `/clavix:start` → `/clavix:summarize`
125
+ - Output: `.clavix/outputs/{project}/full-prd.md` + `quick-prd.md`
126
+ - Mode: PLANNING
127
+
128
+ 2. **Task Preparation**
129
+ - Run: `/clavix:plan` transforms PRD into curated task list
130
+ - Output: `.clavix/outputs/{project}/tasks.md`
131
+ - Mode: PLANNING (Pre-Implementation)
132
+
133
+ 3. **Implementation Phase**
134
+ - Run: `/clavix:implement`
135
+ - Agent executes tasks systematically
136
+ - Mode: IMPLEMENTATION
137
+ - Agent edits tasks.md directly to mark progress (`- [ ]` → `- [x]`)
138
+
139
+ 4. **Completion**
140
+ - Run: `/clavix:archive`
141
+ - Archives completed work
142
+ - Mode: Management
143
+
144
+ **Key principle:** Planning workflows create documents. Implementation workflows write code.
145
+
146
+ ---
147
+
148
+ ## 💡 Best Practices for Generic Agents
149
+
150
+ 1. **Always reference instruction files** - Don't recreate workflow steps inline, point to `.clavix/instructions/workflows/`
151
+
152
+ 2. **Respect mode boundaries** - Planning mode = no code, Implementation mode = write code
153
+
154
+ 3. **Use checkpoints** - Follow the CHECKPOINT pattern from instruction files to track progress
155
+
156
+ 4. **Create files explicitly** - Use Write tool for every file, verify with ls, never skip file creation
157
+
158
+ 5. **Ask when unclear** - If mode is ambiguous, ask: "Should I implement or continue planning?"
159
+
160
+ 6. **Track complexity** - Use conversational mode for complex requirements (15+ exchanges, 5+ features, 3+ topics)
161
+
162
+ 7. **Label improvements** - When optimizing prompts, mark changes with [ADDED], [CLARIFIED], [STRUCTURED], [EXPANDED], [SCOPED]
163
+
164
+ ---
165
+
166
+ ## ⚠️ Common Mistakes
167
+
168
+ ### ❌ Jumping to implementation during planning
169
+ **Wrong:** User discusses feature → agent generates code immediately
170
+
171
+ **Right:** User discusses feature → agent asks questions → creates PRD/prompt → asks if ready to implement
172
+
173
+ ### ❌ Skipping file creation
174
+ **Wrong:** Display content in chat, don't write files
175
+
176
+ **Right:** Create directory → Write files → Verify existence → Display paths
177
+
178
+ ### ❌ Recreating workflow instructions inline
179
+ **Wrong:** Copy entire fast mode workflow into response
180
+
181
+ **Right:** Reference `.clavix/instructions/workflows/improve.md` and follow its steps
182
+
183
+ ### ❌ Not using instruction files
184
+ **Wrong:** Make up workflow steps or guess at process
185
+
186
+ **Right:** Read corresponding `.clavix/instructions/workflows/*.md` file and follow exactly
187
+
188
+ ---
189
+
190
+ **Artifacts stored under `.clavix/`:**
191
+ - `.clavix/outputs/<project>/` - PRDs, tasks, prompts
192
+ - `.clavix/templates/` - Custom overrides
193
+
194
+ ---
195
+
196
+ **For complete workflows:** Always reference `.clavix/instructions/workflows/{workflow}.md`
197
+
198
+ **For troubleshooting:** Check `.clavix/instructions/troubleshooting/`
199
+
200
+ **For mode clarification:** See `.clavix/instructions/core/clavix-mode.md`
@@ -0,0 +1,237 @@
1
+ # Clavix Instructions for Octofriend
2
+
3
+ Clavix workflows optimized for Octofriend's capabilities: model switching, multi-turn thinking, and zero telemetry.
4
+
5
+ ---
6
+
7
+ ## ⛔ CLAVIX MODE ENFORCEMENT
8
+
9
+ **CRITICAL: Know which mode you're in and STOP at the right point.**
10
+
11
+ **OPTIMIZATION workflows** (NO CODE ALLOWED):
12
+ - `/clavix:improve` - Prompt optimization with smart depth auto-selection
13
+ - Your role: Analyze, optimize, show improved prompt, **STOP**
14
+ - ❌ DO NOT implement the prompt's requirements
15
+ - ✅ After showing optimized prompt, tell user: "Run `/clavix:implement --latest` to implement"
16
+
17
+ **PLANNING workflows** (NO CODE ALLOWED):
18
+ - `/clavix:start`, `/clavix:summarize`, `/clavix:prd`, `/clavix:plan`
19
+ - Your role: Ask questions, create PRDs/prompts, extract requirements
20
+ - ❌ DO NOT implement features during these workflows
21
+
22
+ **IMPLEMENTATION workflows** (CODE ALLOWED):
23
+ - `/clavix:implement`
24
+ - Your role: Write code, execute tasks, implement features
25
+ - ✅ DO implement code during these workflows
26
+ - Mark task completion by editing tasks.md directly (`- [ ]` → `- [x]`)
27
+
28
+ See `.clavix/instructions/core/clavix-mode.md` for complete mode documentation.
29
+
30
+ ---
31
+
32
+ ## 📁 Detailed Workflow Instructions
33
+
34
+ **Complete step-by-step workflows** in `.clavix/instructions/workflows/`:
35
+
36
+ | Workflow | File | Purpose |
37
+ |----------|------|---------|
38
+ | Conversational mode | `start.md` | Natural requirements gathering |
39
+ | Extract requirements | `summarize.md` | Convert conversation → PRD + prompts |
40
+ | Smart optimization | `improve.md` | Prompt optimization with auto-depth |
41
+ | PRD generation | `prd.md` | Strategic planning through questions |
42
+
43
+ **Core references:**
44
+ - `core/clavix-mode.md` - Mode boundaries (planning vs implementation)
45
+ - `core/file-operations.md` - Proven file creation patterns
46
+ - `core/verification.md` - Checkpoint patterns
47
+
48
+ **Troubleshooting:**
49
+ - `troubleshooting/jumped-to-implementation.md` - If you start implementing
50
+ - `troubleshooting/skipped-file-creation.md` - If files aren't created
51
+ - `troubleshooting/mode-confusion.md` - Planning vs implementation confusion
52
+
53
+ **For Octo/Kimi users:** These instruction files have explicit step-by-step guidance that works well with structured processing. Always reference them when executing workflows.
54
+
55
+ ---
56
+
57
+ ## 🔍 Workflow Detection Keywords
58
+
59
+ | Keywords | Workflow | Mode |
60
+ |----------|----------|------|
61
+ | prd, product requirements, specification | `prd` | Planning |
62
+ | improve, optimize, enhance prompt | `improve` | Planning |
63
+ | start, conversational, discuss | `start` | Planning |
64
+ | summarize, extract, requirements | `summarize` | Planning |
65
+ | implement, build, execute | `implement` | Implementation |
66
+
67
+ **When detected:** Reference the corresponding `.clavix/instructions/workflows/{workflow}.md` file.
68
+
69
+ ---
70
+
71
+ ## 🎯 Octofriend-Specific Guidance
72
+
73
+ ### Model Switching Strategy
74
+
75
+ **Fast models** (Qwen-Max, etc.):
76
+ - Standard depth optimization (`improve` workflow)
77
+ - Formatting and structure
78
+ - Straightforward questions
79
+
80
+ **Thinking models** (DeepSeek-R1, etc.):
81
+ - Comprehensive depth optimization (`improve` workflow)
82
+ - Architectural decisions
83
+ - Complex problem-solving
84
+ - PRD generation (`prd` workflow)
85
+
86
+ **Switch models based on task complexity** - Octofriend makes this seamless.
87
+
88
+ ### Multi-Turn Thinking
89
+
90
+ Enable multi-turn for:
91
+ - Architectural decisions
92
+ - Comprehensive analysis
93
+ - Strategic planning
94
+ - Complex problem decomposition
95
+
96
+ Multi-turn helps thinking models explore solution space thoroughly.
97
+
98
+ ### Zero Telemetry Advantage
99
+
100
+ Users can share sensitive requirements safely:
101
+ - Proprietary business logic
102
+ - Confidential features
103
+ - Internal system details
104
+ - Competitive information
105
+
106
+ Octofriend's zero telemetry makes it ideal for planning confidential projects.
107
+
108
+ ### Custom Autofix
109
+
110
+ Trust Octofriend's autofix for:
111
+ - Tool call failures
112
+ - Parameter corrections
113
+ - Retry logic
114
+
115
+ Autofix handles edge cases gracefully - let it work.
116
+
117
+ ---
118
+
119
+ ## 📋 Clavix Commands (v5)
120
+
121
+ ### Setup Commands (CLI)
122
+ | Command | Purpose |
123
+ |---------|---------|
124
+ | `clavix init` | Initialize Clavix in a project |
125
+ | `clavix update` | Update templates after package update |
126
+ | `clavix diagnose` | Check installation health |
127
+ | `clavix version` | Show version |
128
+
129
+ ### Workflow Commands (Slash Commands)
130
+ | Slash Command | Purpose |
131
+ |---------------|---------|
132
+ | `/clavix:improve` | Optimize prompts (auto-selects depth) |
133
+ | `/clavix:prd` | Generate PRD through questions |
134
+ | `/clavix:plan` | Create task breakdown from PRD |
135
+ | `/clavix:implement` | Execute tasks or prompts (auto-detects source) |
136
+ | `/clavix:start` | Begin conversational session |
137
+ | `/clavix:summarize` | Extract requirements from conversation |
138
+ | `/clavix:refine` | Refine existing PRD or saved prompt |
139
+
140
+ ### Agentic Utilities (Project Management)
141
+ | Utility | Purpose |
142
+ |---------|---------|
143
+ | `/clavix:verify` | Check implementation against PRD requirements |
144
+ | `/clavix:archive` | Archive completed work to `.clavix/archive/` |
145
+
146
+ ---
147
+
148
+ ## 🔄 Prompt Execution Workflow
149
+
150
+ **When you have a saved prompt to execute:**
151
+
152
+ 1. **List available prompts**: List files in `.clavix/outputs/prompts/*.md`
153
+ 2. **Execute prompt**: `/clavix:implement --latest` - implement saved prompt
154
+ 3. **Implement**: Agent reads the optimized prompt and implements the feature
155
+
156
+ **Note:** Slash commands save prompts as `.md` files with frontmatter metadata.
157
+
158
+ ---
159
+
160
+ ## 🔄 Standard Workflow
161
+
162
+ **Complete project flow:**
163
+
164
+ 1. **Planning** (`/clavix:prd`)
165
+ - Creates PRD (full + quick versions)
166
+ - Saves to `.clavix/outputs/{project}/`
167
+
168
+ 2. **Task Preparation** (`/clavix:plan`)
169
+ - Transforms PRD → curated tasks.md
170
+ - Phase-based organization
171
+
172
+ 3. **Implementation** (`/clavix:implement`)
173
+ - Agent executes tasks systematically
174
+ - Marks progress by editing tasks.md (`- [ ]` → `- [x]`)
175
+ - Optional git commit strategies
176
+
177
+ 4. **Completion** (`/clavix:archive`)
178
+ - Archives completed project
179
+
180
+ **Alternative quick paths:**
181
+ - **Quick improvement**: `/clavix:improve` → `/clavix:implement --latest` → Done
182
+ - **Conversational**: `/clavix:start` → `/clavix:summarize` → `/clavix:implement` → Done
183
+
184
+ ---
185
+
186
+ ## 💡 Best Practices for Octofriend
187
+
188
+ 1. **Use thinking models for planning** - DeepSeek-R1 excels at strategic thinking
189
+ 2. **Switch to fast models for execution** - Qwen-Max handles implementation well
190
+ 3. **Enable multi-turn for complex decisions** - Let the model think thoroughly
191
+ 4. **Reference instruction files explicitly** - "See `.clavix/instructions/workflows/prd.md`"
192
+ 5. **Trust file operations** - Octofriend's Write tool is reliable
193
+ 6. **Leverage zero telemetry** - Share proprietary details safely
194
+ 7. **Follow the standard workflow** - PRD → Plan → Implement → Archive
195
+
196
+ ---
197
+
198
+ ## ⚠️ Common Mistakes
199
+
200
+ ### ❌ Implementing during planning workflows
201
+ **Wrong:** User runs `/clavix:prd`, you generate PRD then start building features
202
+
203
+ **Right:** User runs `/clavix:prd`, you generate PRD, save files, suggest `/clavix:plan` as next step
204
+
205
+ ### ❌ Skipping file creation
206
+ **Wrong:** Display optimized prompt, stop there
207
+
208
+ **Right:** Display prompt, save to `.clavix/outputs/`, verify, show path
209
+
210
+ ### ❌ Not referencing instruction files
211
+ **Wrong:** Trying to remember workflow details from this file
212
+
213
+ **Right:** "See `.clavix/instructions/workflows/improve.md` for complete workflow"
214
+
215
+ ### ❌ Using wrong model for task
216
+ **Wrong:** Using fast model for complex architectural planning
217
+
218
+ **Right:** Switch to thinking model (DeepSeek-R1) for strategic decisions
219
+
220
+ ---
221
+
222
+ ## 🆘 When in Doubt
223
+
224
+ 1. **Check which slash command was run** - Determines your mode (planning vs implementation)
225
+ 2. **Reference instruction files** - They have complete step-by-step guidance
226
+ 3. **Ask the user** - "Should I implement this (run `/clavix:implement`), or continue planning?"
227
+ 4. **Switch models** - Use thinking models for complex planning tasks
228
+
229
+ ---
230
+
231
+ **For complete workflows:** Always reference `.clavix/instructions/workflows/{workflow}.md`
232
+
233
+ **For troubleshooting:** Check `.clavix/instructions/troubleshooting/`
234
+
235
+ **For mode clarification:** See `.clavix/instructions/core/clavix-mode.md`
236
+
237
+ Octofriend + Clavix = Strategic planning with zero telemetry, perfect for confidential projects.
@@ -0,0 +1,117 @@
1
+ # Implementer Subagent Prompt Template
2
+
3
+ Use this template when dispatching an implementer subagent for a specific task.
4
+
5
+ ```
6
+ Task tool:
7
+
8
+ description: "Implement Task N: [task name]"
9
+
10
+ prompt: |
11
+ You are implementing Task N: [task name]
12
+
13
+ ## Task Description
14
+
15
+ [FULL TEXT of task from plan - paste it here, don't make subagent read file]
16
+
17
+ ## Context
18
+
19
+ [Scene-setting: where this fits in the project, dependencies, architectural context]
20
+ [Reference any relevant PRD sections or prior tasks]
21
+
22
+ ## Before You Begin
23
+
24
+ If you have questions about:
25
+ - The requirements or acceptance criteria
26
+ - The approach or implementation strategy
27
+ - Dependencies or assumptions
28
+ - Anything unclear in the task description
29
+
30
+ **Ask them now.** Raise any concerns before starting work.
31
+
32
+ ## Your Job
33
+
34
+ Once you're clear on requirements:
35
+
36
+ 1. Implement exactly what the task specifies
37
+ 2. Write tests (following TDD if task says to)
38
+ 3. Verify implementation works (run tests, check build)
39
+ 4. Commit your work
40
+ 5. Self-review (see below)
41
+ 6. Report back
42
+
43
+ Work from: [directory/workspace]
44
+
45
+ **While you work:** If you encounter something unexpected or unclear, **ask questions**.
46
+ It's always OK to pause and clarify. Don't guess or make assumptions.
47
+
48
+ ## Before Reporting Back: Self-Review
49
+
50
+ Review your work with fresh eyes. Ask yourself:
51
+
52
+ **Completeness:**
53
+ - Did I fully implement everything in the spec?
54
+ - Did I miss any requirements?
55
+ - Are there edge cases I didn't handle?
56
+
57
+ **Quality:**
58
+ - Is this my best work?
59
+ - Are names clear and accurate (match what things do, not how they work)?
60
+ - Is the code clean and maintainable?
61
+
62
+ **Discipline:**
63
+ - Did I avoid overbuilding (YAGNI)?
64
+ - Did I only build what was requested?
65
+ - Did I follow existing patterns in the codebase?
66
+
67
+ **Testing:**
68
+ - Do tests actually verify behavior (not just mock behavior)?
69
+ - Did I follow TDD if required?
70
+ - Are tests comprehensive?
71
+
72
+ **If you find issues during self-review, fix them now before reporting.**
73
+
74
+ ## Report Format
75
+
76
+ When done, report:
77
+
78
+ ```
79
+ ## Implementation Complete
80
+
81
+ **Task:** [task name]
82
+ **Status:** Complete / Partial / Blocked
83
+
84
+ ### What I Implemented
85
+ - [List of changes made]
86
+
87
+ ### Files Changed
88
+ - `path/to/file.ts` - [what changed]
89
+
90
+ ### Test Results
91
+ [Paste test output or summary]
92
+
93
+ ### Self-Review Findings
94
+ - [Any issues found and fixed during self-review]
95
+ - [Or "No issues found"]
96
+
97
+ ### Issues or Concerns
98
+ - [Any remaining concerns or questions]
99
+ - [Or "None"]
100
+ ```
101
+ ```
102
+
103
+ ---
104
+
105
+ ## When to Use This Template
106
+
107
+ - Dispatching a subagent to implement a single task from the plan
108
+ - Each task gets its own fresh subagent (no context pollution)
109
+ - Subagent implements, tests, commits, and self-reviews before reporting
110
+
111
+ ## Key Points
112
+
113
+ 1. **Provide full task text** - Don't make subagent read the plan file
114
+ 2. **Include context** - Where this fits, what came before
115
+ 3. **Encourage questions** - Subagent should ask before guessing
116
+ 4. **Require self-review** - Catches issues before handoff
117
+ 5. **Structured report** - Clear summary of what was done
@@ -0,0 +1,121 @@
1
+ # Code Quality Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a code quality reviewer subagent.
4
+
5
+ **Purpose:** Verify implementation is well-built (clean, tested, maintainable)
6
+
7
+ **Only dispatch after spec compliance review passes.**
8
+
9
+ ```
10
+ Task tool:
11
+
12
+ description: "Review code quality for Task N"
13
+
14
+ prompt: |
15
+ You are reviewing the code quality of an implementation that has already
16
+ passed spec compliance review.
17
+
18
+ ## What Was Implemented
19
+
20
+ [From implementer's report - what they built]
21
+
22
+ ## Files to Review
23
+
24
+ [List of files changed with paths]
25
+
26
+ ## Review Dimensions
27
+
28
+ Evaluate the implementation across these dimensions:
29
+
30
+ ### 🔒 Security
31
+ - No hardcoded secrets, keys, or tokens
32
+ - Proper input validation
33
+ - Safe handling of user data
34
+ - No injection vulnerabilities
35
+
36
+ ### 🏗️ Architecture
37
+ - Follows existing project patterns
38
+ - Appropriate separation of concerns
39
+ - Consistent with codebase conventions
40
+ - No layer violations
41
+
42
+ ### 📏 Standards
43
+ - Clear, descriptive naming
44
+ - Reasonable function/method length
45
+ - DRY principle followed
46
+ - No console.logs in production code
47
+ - Proper TypeScript types (no `any` without reason)
48
+
49
+ ### ⚡ Performance
50
+ - No obvious N+1 patterns
51
+ - Appropriate async handling
52
+ - No unnecessary operations in loops
53
+ - Resources properly cleaned up
54
+
55
+ ### 🧪 Testing
56
+ - Tests actually test behavior (not mocks)
57
+ - Edge cases covered
58
+ - Error scenarios handled
59
+ - Tests are readable and maintainable
60
+
61
+ ## Report Format
62
+
63
+ ```
64
+ ## Code Quality Review
65
+
66
+ **Task:** [task name]
67
+ **Status:** ✅ Approved | ⚠️ Minor Issues | ❌ Needs Fixes
68
+
69
+ ### Strengths
70
+ - [What's done well]
71
+
72
+ ### Issues
73
+
74
+ **🔴 Critical** (must fix)
75
+ - [file:line] [issue description]
76
+
77
+ **🟠 Important** (should fix)
78
+ - [file:line] [issue description]
79
+
80
+ **🟡 Minor** (nice to fix)
81
+ - [file:line] [issue description]
82
+
83
+ ### Assessment
84
+ ✅ Approved - code is production ready
85
+ OR
86
+ ⚠️ Approved with notes - minor issues, can proceed
87
+ OR
88
+ ❌ Needs fixes - address critical/important issues before proceeding
89
+ ```
90
+ ```
91
+
92
+ ---
93
+
94
+ ## When to Use This Template
95
+
96
+ - AFTER spec compliance review passes (never before)
97
+ - Evaluates HOW code is written, not WHAT it does
98
+ - Final gate before marking task complete
99
+
100
+ ## Severity Levels
101
+
102
+ | Level | Meaning | Action |
103
+ |-------|---------|--------|
104
+ | 🔴 Critical | Security risk, broken functionality | Must fix |
105
+ | 🟠 Important | Significant quality issue | Should fix |
106
+ | 🟡 Minor | Style, optimization | Nice to fix |
107
+
108
+ ## Key Points
109
+
110
+ 1. **Only after spec passes** - Wrong order wastes time
111
+ 2. **Focus on quality** - Spec compliance already verified
112
+ 3. **Specific references** - file:line for every issue
113
+ 4. **Clear severity** - Helps prioritize fixes
114
+ 5. **Actionable feedback** - Say what to fix, not just what's wrong
115
+
116
+ ## If Issues Found
117
+
118
+ 1. Implementer fixes critical/important issues
119
+ 2. Quality reviewer reviews again
120
+ 3. Repeat until approved
121
+ 4. Only then mark task complete