|
| 1 | +# Claude Code Review - Agent Guidelines |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +AI-powered code review tool using Claude to analyze PRs for code quality and security issues. Uses a unified multi-agent approach for comprehensive analysis in a single pass. |
| 6 | + |
| 7 | +## Architecture |
| 8 | + |
| 9 | +``` |
| 10 | +claudecode/ |
| 11 | +├── github_action_audit.py # Main orchestrator - entry point |
| 12 | +├── prompts.py # Review prompt templates |
| 13 | +├── findings_filter.py # False positive filtering |
| 14 | +├── claude_api_client.py # Claude API client |
| 15 | +├── json_parser.py # JSON extraction utilities |
| 16 | +├── constants.py # Configuration constants |
| 17 | +└── evals/ # Evaluation framework |
| 18 | +``` |
| 19 | + |
| 20 | +## Key Patterns |
| 21 | + |
| 22 | +### Prompt Structure |
| 23 | +- `get_unified_review_prompt()` - Combined code quality + security review |
| 24 | +- Prompts require JSON-only output with specific schema |
| 25 | +- Always include confidence scores (0.7-1.0 threshold) |
| 26 | + |
| 27 | +### Finding Categories |
| 28 | +- **Code Quality:** correctness, reliability, performance, maintainability, testing |
| 29 | +- **Security:** security (injection, auth, crypto, data exposure) |
| 30 | + |
| 31 | +### Severity Levels |
| 32 | +- **HIGH**: Production bugs, data loss, exploitable vulnerabilities |
| 33 | +- **MEDIUM**: Limited scope, specific conditions required |
| 34 | +- **LOW**: Minor issues, use sparingly |
| 35 | + |
| 36 | +### Filtering Pipeline |
| 37 | +1. Hard exclusion rules (regex patterns in `HardExclusionRules`) |
| 38 | +2. Claude API validation (optional, uses `claude_api_client.py`) |
| 39 | +3. Directory exclusion filtering |
| 40 | + |
| 41 | +## Testing |
| 42 | + |
| 43 | +```bash |
| 44 | +pytest claudecode -v # Run all tests (177 passing) |
| 45 | +``` |
| 46 | + |
| 47 | +## Code Style |
| 48 | +- Python 3.9+ |
| 49 | +- Type hints encouraged |
| 50 | +- Comprehensive docstrings |
| 51 | +- Tests required for new functionality |
| 52 | + |
| 53 | +## Key Files |
| 54 | + |
| 55 | +| File | Purpose | |
| 56 | +|------|---------| |
| 57 | +| `action.yml` | GitHub Action definition | |
| 58 | +| `.claude/commands/review.md` | Slash command for Claude Code | |
| 59 | +| `docs/` | Customization documentation | |
| 60 | + |
| 61 | +## Common Tasks |
| 62 | + |
| 63 | +### Adding a review category |
| 64 | +1. Update category lists in `prompts.py` |
| 65 | +2. Add exclusion patterns in `findings_filter.py` if needed |
| 66 | +3. Add tests in `test_prompts.py` |
| 67 | + |
| 68 | +### Modifying filtering rules |
| 69 | +1. Edit `HardExclusionRules` in `findings_filter.py` |
| 70 | +2. Add tests in `test_hard_exclusion_rules.py` |
0 commit comments