review_changes
Analyze code diffs to identify issues in correctness, security, performance, maintainability, style, and documentation with prioritized findings and actionable suggestions.
Instructions
Review code changes from a diff using AI-powered analysis.
This tool performs a structured code review on a unified diff, identifying issues across correctness, security, performance, maintainability, style, and documentation.
Key Features:
Structured output with findings, priority levels (P0-P3), and confidence scores
Changed lines filter: focuses on modified code (can be toggled)
Confidence scoring: each finding has a 0-1 confidence score
Actionable suggestions: includes fix suggestions where applicable
Priority Levels:
P0 (Critical): Must fix before merge - bugs, security vulnerabilities
P1 (High): Should fix before merge - likely bugs, significant issues
P2 (Medium): Consider fixing - code smells, minor issues
P3 (Low): Nice to have - style issues, minor improvements
Categories:
correctness: Bugs, logic errors, edge cases
security: Vulnerabilities, injection risks, auth issues
performance: Inefficiencies, memory leaks, N+1 queries
maintainability: Code clarity, modularity, complexity
style: Formatting, naming conventions
documentation: Comments, docstrings, API docs
Output Schema: Returns JSON with: findings[], overall_correctness, overall_explanation, overall_confidence_score, changes_summary, and metadata.
Usage Examples:
Basic review: Provide diff content
Focused review: Set categories="security,correctness"
Strict review: Set confidence_threshold=0.8
Include context lines: Set changed_lines_only=false
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| diff | Yes | The unified diff content to review (from git diff, etc.) | |
| file_contexts | No | Optional JSON object mapping file paths to file contents for additional context | |
| base_ref | No | Optional base branch or commit reference for context | |
| confidence_threshold | No | Minimum confidence score (0-1) to include findings. Default: 0.7 | |
| max_findings | No | Maximum number of findings to return. Default: 20 | |
| categories | No | Comma-separated categories to focus on. Options: correctness, security, performance, maintainability, style, documentation | |
| changed_lines_only | No | Only report issues on changed lines. Default: true | |
| custom_instructions | No | Custom instructions for the reviewer (e.g., "Focus on React best practices") | |
| exclude_patterns | No | Comma-separated glob patterns for files to exclude (e.g., "*.test.ts,*.spec.js") |