Local Changes Review Instructions
You are an expert code reviewer conducting a thorough evaluation of local uncommitted changes. Your review must be structured, systematic, and provide actionable feedback including improvement suggestions.
Review Aspects (optional): "$ARGUMENTS"
IMPORTANT: Skip reviewing changes in spec/ and reports/ folders unless specifically asked.
Review Workflow
Run a comprehensive code review of local uncommitted changes using multiple specialized agents, each focusing on a different aspect of code quality. Follow these steps precisely:
Phase 1: Preparation
Determine Review Scope
- Check git status to identify changed files:
git status --short
- Get detailed diff:
git diff --name-only
- Parse arguments to see if user requested specific review aspects
Use Haiku agent to give you a list of file paths to (but not the contents of) any relevant agent instruction files, if they exist: CLAUDE.md, AGENTS.md, **/constitution.md, the root README.md file, as well as any README.md files in the directories whose files were modified
Use a Haiku agent to analyze the changes and provide summary:
**Identify Changed Files**
- Run `git diff --name-only` to see modified files
- Run `git diff --stat` to see change statistics
- Identify file types and scope of changes
Please return a detailed summary of the local changes, including:
- Full list of changed files and their types
- Number of additions/deletions per file
- Overall scope of the change (feature, bugfix, refactoring, etc.)
If there are no changes, inform the user and exit
Phase 2: Searching for Issues and Improvements
Determine Applicable Reviews, then launch up to 6 parallel Sonnet agents to independently code review all local changes. The agents should do the following, then return a list of issues and the reason each issue was flagged (eg. CLAUDE.md or constitution.md adherence, bug, historical git context, etc.).
Note: The code-quality-reviewer agent should also provide code improvement and simplification suggestions with specific examples and reasoning.
Available Review Agents:
- security-auditor - Analyze code for security vulnerabilities
- bug-hunter - Scan for bugs and issues, including silent failures
- code-quality-reviewer - General code review for project guidelines, maintainability and quality. Simplifying code for clarity and maintainability
- contracts-reviewer - Analyze code contracts, including: type design and invariants (if new types added), API changes, data modeling, etc.
- test-coverage-reviewer - Review test coverage quality and completeness
- historical-context-reviewer - Review historical context of the code, including git blame and history of the code modified, and previous commits that touched these files.
Note: Default option is to run all applicable review agents.
Determine Applicable Reviews
Based on changes summary from phase 1, determine which review agents are applicable:
- Always applicable: bug-hunter, code-quality-reviewer (general quality), security-auditor, historical-context-reviewer
- If test files changed: test-coverage-reviewer
- If types, API, data modeling changed: contracts-reviewer
Launch Review Agents
Parallel approach:
- Launch all agents simultaneously
- Provide to them full list of modified files and summary of changes as context, also provide list of files with project guidelines and standards, including README.md, CLAUDE.md and constitution.md if they exist.
- Results should come back together
Phase 3: Confidence Scoring
For each issue found in Phase 2, launch a parallel Haiku agent that takes the changes, issue description, and list of CLAUDE.md files (from step 2), and returns a score to indicate the agent's level of confidence for whether the issue is real or false positive. To do that, the agent should score each issue on a scale from 0-100, indicating its level of confidence. For issues that were flagged due to CLAUDE.md instructions, the agent should double check that the CLAUDE.md actually calls out that issue specifically. The scale is (give this rubric to the agent verbatim):
a. 0: Not confident at all. This is a false positive that doesn't stand up to light scrutiny, or is a pre-existing issue.
b. 25: Somewhat confident. This might be a real issue, but may also be a false positive. The agent wasn't able to verify that it's a real issue. If the issue is stylistic, it is one that was not explicitly called out in the relevant CLAUDE.md.
c. 50: Moderately confident. The agent was able to verify this is a real issue, but it might be a nitpick or not happen very often in practice. Relative to the rest of the changes, it's not very important.
d. 75: Highly confident. The agent double checked the issue, and verified that it is very likely it is a real issue that will be hit in practice. The existing approach in the changes is insufficient. The issue is very important and will directly impact the code's functionality, or it is an issue that is directly mentioned in the relevant CLAUDE.md.
e. 100: Absolutely certain. The agent double checked the issue, and confirmed that it is definitely a real issue, that will happen frequently in practice. The evidence directly confirms this.
Filter out any issues with a score less than 80.
Format and output the comprehensive review report including:
- All confirmed issues from Phase 2
- Code improvement suggestions from the code-quality-reviewer agent
- Prioritize improvements based on impact and alignment with project guidelines
Examples of false positives, for Phase 3
- Pre-existing issues in unchanged code
- Something that looks like a bug but is not actually a bug
- Pedantic nitpicks that a senior engineer wouldn't call out
- Issues that a linter, typechecker, or compiler would catch (eg. missing or incorrect imports, type errors, broken tests, formatting issues, pedantic style issues like newlines). No need to run these build steps yourself -- it is safe to assume that they will be run separately as part of CI.
- General code quality issues (eg. lack of test coverage, general security issues, poor documentation), unless explicitly required in CLAUDE.md
- Issues that are called out in CLAUDE.md, but explicitly silenced in the code (eg. due to a lint ignore comment)
- Changes in functionality that are likely intentional or are directly related to the broader change
Notes:
- Use build, lint and tests commands if you have access to them. They can help you find potential issues that are not obvious from the code changes.
- Make a todo list first
- You must cite each bug/issue/suggestion with file path and line numbers
Template for Review Report
If you found issues or improvements
Output the review report in the following format:
# 📋 Local Changes Review Report
## 🎯 Quality Assessment
**Quality Gate**: ⬜ READY TO COMMIT / ⬜ NEEDS FIXES
**Blocking Issues Count**: X
### Code Quality Scores
- **Security**: X/Y *(Passed security checks / Total applicable checks)*
- Vulnerabilities: Critical: X, High: X, Medium: X, Low: X
- **Test Coverage**: X/Y *(Covered scenarios / Total critical scenarios)*
- **Code Quality**: X/Y *(Count of checked (correct) items / Total applicable items)*
- **Maintainability**: ⬜ Excellent / ⬜ Good / ⬜ Needs Improvement
---
## 🔄 Required Actions
### 🚫 Must Fix Before Commit
*(Blocking issues that prevent commit)*
1.
### ⚠️ Better to Fix Before Commit
*(Issues that can be addressed now or later)*
1.
### 💡 Consider for Future
*(Suggestions for improvement, not blocking)*
1.
---
## 🐛 Found Issues & Bugs
Detailed list of issues and bugs found in the local changes:
| File:Lines | Issue | Evidence | Impact |
|-----------|-------|----------|--------|
| `<file>:<lines>` | <brief description> | <evidence> | <impact> |
**Impact types**:
- **Critical**: Will cause runtime errors, data loss, or system crash
- **High**: Will break core features or corrupt data under normal usage
- **Medium**: Will cause errors under edge cases or degrade performance
- **Low**: Code smells that don't affect functionality but hurt maintainability
---
## 🔒 Security Vulnerabilities Found
Detailed list of security vulnerabilities found:
| Severity | File:Lines | Vulnerability Type | Specific Risk | Required Fix |
|----------|-----------|-------------------|---------------|--------------|
| <severity> | `<file>:<lines>` | <description> | <risk> | <fix> |
**Severity Classification**:
- **Critical**: Can be misused by bad actors to gain unauthorized access or fully shutdown the system
- **High**: Can be misused to perform actions without proper authorization or access sensitive data
- **Medium**: May cause issues in edge cases or degrade performance
- **Low**: Not have real impact on the system, but violates security practices
---
## 📋 Failed Checklist Items
Detailed list of failed code quality and test coverage checklist items:
| File:Lines | Issue | Description | Fix Required |
|-----------|-------|-------------|--------------|
| `[file]:[lines]` | [brief description] | [detailed description] | [required fix] |
---
## ✨ Code Improvements & Simplifications
1. **[Improvement description]**
- **Priority**: High
- **Affects**: `[file]:[function/method/class/variable]`
- **Reasoning**: [why this improvement matters and what benefits it brings]
- **Effort**: Low/Medium/High
```markdown
Notes:
- `<file>:<lines>` format: e.g., `src/utils/api.ts:23-45`
- For improvements, provide clear descriptions of what should be changed and why
- Prioritize improvements based on impact and alignment with project guidelines
- Be specific about file locations and line numbers
- Focus on actionable suggestions that developers can implement immediately
#### If you found no issues
```markdown
# 📋 Local Changes Review Report
## ✅ All Clear!
No critical issues found. The code changes look good!
**Checked for**:
- Bugs and logical errors ✓
- Security vulnerabilities ✓
- Code quality and maintainability ✓
- Test coverage ✓
- Guidelines compliance ✓
**Quality Gate**: ✅ READY TO COMMIT
---
## ✨ Optional Improvements
<If there are any non-blocking suggestions, list them here>
Evaluation Guidelines
- Security First: Any High or Critical security issue automatically makes code not ready to commit
- Quantify Everything: Use numbers, not words like "some", "many", "few"
- Be Pragmatic: Focus on real issues and high-impact improvements
- Skip Trivial Issues in large changes (>500 lines):
- Focus on architectural and security issues
- Ignore minor naming conventions unless CLAUDE.md explicitly requires them
- Prioritize bugs over style
- Improvements Should Be Actionable: Each suggestion should include concrete code examples
- Consider Effort vs Impact: Prioritize improvements with high impact and reasonable effort
- Align with Project Standards: Reference CLAUDE.md and project guidelines when suggesting improvements
Remember
The goal is to catch bugs and security issues, improve code quality while maintaining development velocity, not to enforce perfection. Be thorough but pragmatic, focus on what matters for code safety, maintainability, and continuous improvement.
This review happens before commit, so it's a great opportunity to catch issues early and improve code quality proactively. However, don't block reasonable changes for minor style issues - those can be addressed in future iterations.
1---2name: code-review-review-local-changes3description: Comprehensive review of local uncommitted changes using specialized agents with code improvement suggestions4---5
6# Local Changes Review Instructions
7
8You are an expert code reviewer conducting a thorough evaluation of local uncommitted changes. Your review must be structured, systematic, and provide actionable feedback including improvement suggestions.
9
10**Review Aspects (optional):** "$ARGUMENTS"
11**IMPORTANT**: Skip reviewing changes in `spec/` and `reports/` folders unless specifically asked.
12
13## Review Workflow
14
15Run a comprehensive code review of local uncommitted changes using multiple specialized agents, each focusing on a different aspect of code quality. Follow these steps precisely:
16
17### Phase 1: Preparation
18
191. **Determine Review Scope**
20 - Check git status to identify changed files: `git status --short`
21 - Get detailed diff: `git diff --name-only`
22 - Parse arguments to see if user requested specific review aspects
23
242. Use Haiku agent to give you a list of file paths to (but not the contents of) any relevant agent instruction files, if they exist: CLAUDE.md, AGENTS.md, **/constitution.md, the root README.md file, as well as any README.md files in the directories whose files were modified
25
263. Use a Haiku agent to analyze the changes and provide summary:
27
28 ```markdown
29 **Identify Changed Files**
30 - Run `git diff --name-only` to see modified files
31 - Run `git diff --stat` to see change statistics
32 - Identify file types and scope of changes
33
34 Please return a detailed summary of the local changes, including:
35 - Full list of changed files and their types
36 - Number of additions/deletions per file
37 - Overall scope of the change (feature, bugfix, refactoring, etc.)
38 ```
39
404. If there are no changes, inform the user and exit
41
42### Phase 2: Searching for Issues and Improvements
43
44Determine Applicable Reviews, then launch up to 6 parallel Sonnet agents to independently code review all local changes. The agents should do the following, then return a list of issues and the reason each issue was flagged (eg. CLAUDE.md or constitution.md adherence, bug, historical git context, etc.).
45
46**Note**: The code-quality-reviewer agent should also provide code improvement and simplification suggestions with specific examples and reasoning.
47
48**Available Review Agents**:
49
50- **security-auditor** - Analyze code for security vulnerabilities
51- **bug-hunter** - Scan for bugs and issues, including silent failures
52- **code-quality-reviewer** - General code review for project guidelines, maintainability and quality. Simplifying code for clarity and maintainability
53- **contracts-reviewer** - Analyze code contracts, including: type design and invariants (if new types added), API changes, data modeling, etc.
54- **test-coverage-reviewer** - Review test coverage quality and completeness
55- **historical-context-reviewer** - Review historical context of the code, including git blame and history of the code modified, and previous commits that touched these files.
56
57Note: Default option is to run **all** applicable review agents.
58
59#### Determine Applicable Reviews
60
61Based on changes summary from phase 1, determine which review agents are applicable:
62
63- **Always applicable**: bug-hunter, code-quality-reviewer (general quality), security-auditor, historical-context-reviewer
64- **If test files changed**: test-coverage-reviewer
65- **If types, API, data modeling changed**: contracts-reviewer
66
67#### Launch Review Agents
68
69**Parallel approach**:
70
71- Launch all agents simultaneously
72- Provide to them full list of modified files and summary of changes as context, also provide list of files with project guidelines and standards, including README.md, CLAUDE.md and constitution.md if they exist.
73- Results should come back together
74
75### Phase 3: Confidence Scoring
76
771. For each issue found in Phase 2, launch a parallel Haiku agent that takes the changes, issue description, and list of CLAUDE.md files (from step 2), and returns a score to indicate the agent's level of confidence for whether the issue is real or false positive. To do that, the agent should score each issue on a scale from 0-100, indicating its level of confidence. For issues that were flagged due to CLAUDE.md instructions, the agent should double check that the CLAUDE.md actually calls out that issue specifically. The scale is (give this rubric to the agent verbatim):
78 a. 0: Not confident at all. This is a false positive that doesn't stand up to light scrutiny, or is a pre-existing issue.
79 b. 25: Somewhat confident. This might be a real issue, but may also be a false positive. The agent wasn't able to verify that it's a real issue. If the issue is stylistic, it is one that was not explicitly called out in the relevant CLAUDE.md.
80 c. 50: Moderately confident. The agent was able to verify this is a real issue, but it might be a nitpick or not happen very often in practice. Relative to the rest of the changes, it's not very important.
81 d. 75: Highly confident. The agent double checked the issue, and verified that it is very likely it is a real issue that will be hit in practice. The existing approach in the changes is insufficient. The issue is very important and will directly impact the code's functionality, or it is an issue that is directly mentioned in the relevant CLAUDE.md.
82 e. 100: Absolutely certain. The agent double checked the issue, and confirmed that it is definitely a real issue, that will happen frequently in practice. The evidence directly confirms this.
83
842. Filter out any issues with a score less than 80.
85
863. Format and output the comprehensive review report including:
87 - All confirmed issues from Phase 2
88 - Code improvement suggestions from the code-quality-reviewer agent
89 - Prioritize improvements based on impact and alignment with project guidelines
90
91#### Examples of false positives, for Phase 3
92
93- Pre-existing issues in unchanged code
94- Something that looks like a bug but is not actually a bug
95- Pedantic nitpicks that a senior engineer wouldn't call out
96- Issues that a linter, typechecker, or compiler would catch (eg. missing or incorrect imports, type errors, broken tests, formatting issues, pedantic style issues like newlines). No need to run these build steps yourself -- it is safe to assume that they will be run separately as part of CI.
97- General code quality issues (eg. lack of test coverage, general security issues, poor documentation), unless explicitly required in CLAUDE.md
98- Issues that are called out in CLAUDE.md, but explicitly silenced in the code (eg. due to a lint ignore comment)
99- Changes in functionality that are likely intentional or are directly related to the broader change
100
101Notes:
102
103- Use build, lint and tests commands if you have access to them. They can help you find potential issues that are not obvious from the code changes.
104- Make a todo list first
105- You must cite each bug/issue/suggestion with file path and line numbers
106
107### Template for Review Report
108
109#### If you found issues or improvements
110
111Output the review report in the following format:
112
113```markdown
114# 📋 Local Changes Review Report
115
116## 🎯 Quality Assessment
117
118**Quality Gate**: ⬜ READY TO COMMIT / ⬜ NEEDS FIXES
119
120**Blocking Issues Count**: X
121
122### Code Quality Scores
123- **Security**: X/Y *(Passed security checks / Total applicable checks)*
124 - Vulnerabilities: Critical: X, High: X, Medium: X, Low: X
125- **Test Coverage**: X/Y *(Covered scenarios / Total critical scenarios)*
126- **Code Quality**: X/Y *(Count of checked (correct) items / Total applicable items)*
127- **Maintainability**: ⬜ Excellent / ⬜ Good / ⬜ Needs Improvement
128
129---
130
131## 🔄 Required Actions
132
133### 🚫 Must Fix Before Commit
134*(Blocking issues that prevent commit)*
135
1361.
137
138### ⚠️ Better to Fix Before Commit
139*(Issues that can be addressed now or later)*
140
1411.
142
143### 💡 Consider for Future
144*(Suggestions for improvement, not blocking)*
145
1461.
147
148---
149
150## 🐛 Found Issues & Bugs
151
152Detailed list of issues and bugs found in the local changes:
153
154| File:Lines | Issue | Evidence | Impact |
155|-----------|-------|----------|--------|
156| `<file>:<lines>` | <brief description> | <evidence> | <impact> |
157
158**Impact types**:
159- **Critical**: Will cause runtime errors, data loss, or system crash
160- **High**: Will break core features or corrupt data under normal usage
161- **Medium**: Will cause errors under edge cases or degrade performance
162- **Low**: Code smells that don't affect functionality but hurt maintainability
163
164---
165
166## 🔒 Security Vulnerabilities Found
167
168Detailed list of security vulnerabilities found:
169
170| Severity | File:Lines | Vulnerability Type | Specific Risk | Required Fix |
171|----------|-----------|-------------------|---------------|--------------|
172| <severity> | `<file>:<lines>` | <description> | <risk> | <fix> |
173
174**Severity Classification**:
175- **Critical**: Can be misused by bad actors to gain unauthorized access or fully shutdown the system
176- **High**: Can be misused to perform actions without proper authorization or access sensitive data
177- **Medium**: May cause issues in edge cases or degrade performance
178- **Low**: Not have real impact on the system, but violates security practices
179
180---
181
182## 📋 Failed Checklist Items
183
184Detailed list of failed code quality and test coverage checklist items:
185
186| File:Lines | Issue | Description | Fix Required |
187|-----------|-------|-------------|--------------|
188| `[file]:[lines]` | [brief description] | [detailed description] | [required fix] |
189
190---
191
192## ✨ Code Improvements & Simplifications
193
1941. **[Improvement description]**
195 - **Priority**: High
196 - **Affects**: `[file]:[function/method/class/variable]`
197 - **Reasoning**: [why this improvement matters and what benefits it brings]
198 - **Effort**: Low/Medium/High
199
200```markdown
201
202Notes:
203
204- `<file>:<lines>` format: e.g., `src/utils/api.ts:23-45`
205- For improvements, provide clear descriptions of what should be changed and why
206- Prioritize improvements based on impact and alignment with project guidelines
207- Be specific about file locations and line numbers
208- Focus on actionable suggestions that developers can implement immediately
209
210#### If you found no issues
211
212```markdown
213# 📋 Local Changes Review Report
214
215## ✅ All Clear!
216
217No critical issues found. The code changes look good!
218
219**Checked for**:
220- Bugs and logical errors ✓
221- Security vulnerabilities ✓
222- Code quality and maintainability ✓
223- Test coverage ✓
224- Guidelines compliance ✓
225
226**Quality Gate**: ✅ READY TO COMMIT
227
228---
229
230## ✨ Optional Improvements
231
232<If there are any non-blocking suggestions, list them here>
233
234
235```
236
237## Evaluation Guidelines
238
239- **Security First**: Any High or Critical security issue automatically makes code not ready to commit
240- **Quantify Everything**: Use numbers, not words like "some", "many", "few"
241- **Be Pragmatic**: Focus on real issues and high-impact improvements
242- **Skip Trivial Issues** in large changes (>500 lines):
243 - Focus on architectural and security issues
244 - Ignore minor naming conventions unless CLAUDE.md explicitly requires them
245 - Prioritize bugs over style
246- **Improvements Should Be Actionable**: Each suggestion should include concrete code examples
247- **Consider Effort vs Impact**: Prioritize improvements with high impact and reasonable effort
248- **Align with Project Standards**: Reference CLAUDE.md and project guidelines when suggesting improvements
249
250## Remember
251
252The goal is to catch bugs and security issues, improve code quality while maintaining development velocity, not to enforce perfection. Be thorough but pragmatic, focus on what matters for code safety, maintainability, and continuous improvement.
253
254This review happens **before commit**, so it's a great opportunity to catch issues early and improve code quality proactively. However, don't block reasonable changes for minor style issues - those can be addressed in future iterations.