Automated AI code reviews for every git commit, powered by Claude Sonnet 4.5
ClaudeReview automatically reviews your code changes using Anthropic's Claude AI whenever you make a git commit. Get instant, detailed feedback on security issues, bugs, code quality, and best practices - right in your editor.
- 🤖 Automatic Reviews - Triggers on every git commit across all repositories
- 🔍 Deep Analysis - Examines security, correctness, performance, and code quality
- 📝 Detailed Reports - CodeRabbit-style reviews with file:line references and exact patches
- 🎯 Context-Aware - Includes full file contents, related imports, README, and commit history
- 🚀 Fast - Reviews complete in 5-10 seconds
- 💰 Cost Effective - ~$0.03-0.10 per commit review
- 🔔 Smart Notifications - macOS notifications and auto-opens in Cursor/VSCode
- 🌍 Global - Works across ALL git repositories automatically
# Review Summary
- **Scope:** 1 file, 26+ / 0-
- **Top risks:** SQL injection vulnerability, missing input validation
- **Confidence:** High
# Findings
## Critical / High
1) **[Critical | Security]** `user_service.js:9`
- **Issue:** SQL injection vulnerability from string interpolation
- **Why it matters:** Attackers can execute arbitrary SQL commands
- **Fix (patch):**
```diff
- const query = `SELECT * FROM users WHERE id = ${userId}`;
+ const query = 'SELECT * FROM users WHERE id = ?';
+ return await this.db.query(query, [userId]);
```- Node.js 18 or higher
- Git
- An Anthropic API key
-
Clone the repository
git clone https://github.com/solaris-partners/ClaudeReview.git cd ClaudeReview -
Install dependencies
npm install
-
Configure API key
cp .env.example .env # Edit .env and add your Anthropic API key -
Install global git hook
# Copy hook to global hooks directory mkdir -p ~/.git-hooks cp hooks/post-commit ~/.git-hooks/post-commit chmod +x ~/.git-hooks/post-commit # Configure git to use global hooks git config --global core.hooksPath ~/.git-hooks
-
Update hook path (if needed)
Edit
~/.git-hooks/post-commitand update line 16 with your ClaudeReview path:CLAUDE_REVIEW_DIR="$HOME/path/to/ClaudeReview" -
Test it!
# Make any commit in any repo cd ~/your-project git commit -m "test" # Review should appear automatically in 5-10 seconds
Once installed, ClaudeReview works automatically:
- Make a commit in any git repository
- Review runs in the background (doesn't block your commit)
- Notification appears when review is ready
- Review opens automatically in Cursor/VSCode
- Review saved to
~/.code-reviews/for later reference
You can also run reviews manually:
cd ClaudeReview
node src/index.js /path/to/repo <commit-hash>All reviews are saved as markdown files:
ls -lt ~/.code-reviews/
open ~/.code-reviews/your-repo_commit-hash_timestamp.mdBy default, reviews open in Cursor. To change this, edit src/index.js line ~258:
// For VSCode
execSync(`code "${reviewFile}"`);
// For any other app
execSync(`open -a "YourEditor" "${reviewFile}"`);To disable reviews for a specific repo:
cd /path/to/repo
git config --local core.hooksPath ""To re-enable:
cd /path/to/repo
git config --local --unset core.hooksPath# Disable
git config --global --unset core.hooksPath
# Re-enable
git config --global core.hooksPath ~/.git-hooks┌─────────────────────┐
│ Git Commit │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Global Post-Commit │◄── ~/.git-hooks/post-commit
│ Hook (Bash) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ ClaudeReview │
│ (Node.js) │
├─────────────────────┤
│ • Get commit diff │
│ • Get full files │
│ • Get README │
│ • Get related files │
│ • Get commit history│
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Claude API │◄── Anthropic Sonnet 4.5
│ (Code Review) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Review Report │
│ • Security issues │
│ • Bugs & errors │
│ • Code quality │
│ • Exact patches │
│ • Test suggestions │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Save to ~/.code- │
│ reviews/ │
│ + Open in editor │
│ + macOS notification│
└─────────────────────┘
For accurate reviews, ClaudeReview provides:
- Commit diff - Exact changes made
- Full file contents - Complete files after the commit (first 10)
- Related files - Imported/required files (up to 5)
- Repository README - Project overview and conventions (first 5000 chars)
- Recent commits - Last 5 commits for development context
- Commit metadata - Author, date, message, stats
This rich context allows Claude to:
- Verify method existence before flagging issues
- Understand project conventions and patterns
- Catch integration issues with related code
- Provide more accurate, fewer false positives
ClaudeReview prioritizes:
- Correctness - Logic errors, null pointer issues, race conditions
- Security - SQL injection, XSS, auth issues, credential exposure
- Performance - N+1 queries, inefficient algorithms, memory leaks
- Reliability - Error handling, input validation, edge cases
- Readability - Code structure, naming, maintainability
The system is designed to minimize false positives:
- Verifies assumptions against full file contents
- "When in doubt, don't flag it" principle
- Only reports issues with high confidence
- Provides exact code patches for verification
ClaudeReview uses Claude Sonnet 4.5:
- Per commit: ~$0.03-0.10 (varies by commit size)
- Average: ~$0.05 per commit
- 100 commits/month: ~$5/month
- 500 commits/month: ~$25/month
Tips to reduce costs:
- Reviews only analyze changed files (not entire codebase)
- Large commits cost more - consider smaller, focused commits
- Context limits prevent runaway token usage
-
Check git config:
git config --global --get core.hooksPath # Should output: /Users/yourusername/.git-hooks -
Check hook is executable:
ls -la ~/.git-hooks/post-commit | grep 'x'
-
Check API key:
cat ClaudeReview/.env
-
Test manually:
cd ClaudeReview node src/index.js /path/to/repo $(git rev-parse HEAD)
- Ensure you're using the latest version
- Check that context gathering is working (look for "Full File Contents" in review)
- Report false positives as GitHub issues
cd ClaudeReview
node src/index.js /path/to/repo <old-commit-hash>ClaudeReview/
├── src/
│ └── index.js # Main review engine
├── hooks/
│ └── post-commit # Git hook template
├── config/ # Future: per-project configs
├── .env # API key (not committed)
├── .env.example # Template
├── .gitignore
├── package.json
├── LICENSE
└── README.md
npm test # Coming soonContributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Test file detection and pairing
- Project-specific config files (
.claudereview.json) - GitHub PR integration
- Slack notifications
- Support for more editors
- Caching of analysis for unchanged files
- Custom review templates per language/framework
- Team/organization shared configs
- CI/CD pipeline integration
MIT License - see LICENSE file for details
Built by the Solaris Partners team using:
- Anthropic Claude API
- Node.js
- Inspired by CodeRabbit
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with ❤️ by Solaris Partners