Code review for all uncommitted changes (staging status is irrelevant). Checks CLAUDE.md compliance, identifies bugs, security issues, style problems, and simplification opportunities.
Review all uncommitted changes as code destined for commit. Staging status is irrelevant—both staged and unstaged changes are reviewed equally. Findings are presented in a comprehensive report grouped by severity.
git diff HEAD to capture all uncommitted changes. Staging status is irrelevant; all changes are treated as code intended for commit../CLAUDE.md)~/.claude/CLAUDE.md)Note: The review evaluates changes in the context of the entire project, not as isolated patches. This means considering how changes interact with existing code, patterns, and architecture.
Review changes in this order of priority:
Present each finding using this format:
## [SEVERITY] Category: Brief Title
**File:** `path/to/file.ts:42`
**Issue:**
Clear description of what's wrong and why it was flagged.
**Code:**
```diff
- problematic code here
+ suggested fix here
Why it matters: Brief explanation of the impact or risk.
## Report Structure
Present all findings in a single comprehensive report:
1. **Group by severity** - Critical issues first, then Warnings, then Info
2. **Section headers** - Each severity level gets its own section with count
3. **Summary at end** - Include total counts by severity and files affected
[All critical findings]
[All warning findings]
[All info findings]
## CLAUDE.md Integration
When a CLAUDE.md file is found, extract guidelines and check the diff against them. Common rule types to look for:
- Naming conventions
- File organization patterns
- Required error handling approaches
- Forbidden patterns or anti-patterns
- Testing requirements
- Documentation standards
If a change violates a CLAUDE.md rule, cite the specific rule in the finding.
## Example Session
Starting code review of local changes...
Found CLAUDE.md at project root. Analyzing diff (3 files changed, +45 -12 lines)...
File: src/api/client.ts:15
Issue: API key is hardcoded directly in the source code.
Code:
- const API_KEY = "sk-live-abc123xyz";
+ const API_KEY = process.env.API_KEY;
Why it matters: Hardcoded secrets get committed to version control and can be extracted from builds. Use environment variables instead.
File: src/api/client.ts:28
Issue: Async function lacks try/catch block. CLAUDE.md requires all async operations to have error handling.
Code:
- async function fetchData() {
- const response = await fetch(url);
- return response.json();
- }
+ async function fetchData() {
+ try {
+ const response = await fetch(url);
+ return response.json();
+ } catch (error) {
+ console.error('Failed to fetch data:', error);
+ throw error;
+ }
+ }
Why it matters: Unhandled promise rejections can crash the application or leave it in an inconsistent state.
No informational findings.
## Starting the Review
When invoked, begin with:
Starting code review of local changes...
[Checking for CLAUDE.md: found at X / using global / none found] [Analyzing diff: N files changed, +X -Y lines]
Then present all findings grouped by severity, followed by the summary.