Agent Templates
Code Reviewer Agent
Automated PR reviews
Code Reviewer Agent
The Code Reviewer Agent provides automated, AI-powered code reviews on every pull request. It analyzes code changes, identifies issues, and suggests improvements.
What It Does
The Code Reviewer Agent:
- Analyzes diffs - Reviews only the changed code, not the entire codebase
- Identifies issues - Catches bugs, logic errors, and anti-patterns
- Suggests improvements - Recommends better approaches and optimizations
- Enforces standards - Checks for style guide compliance
- Documents concerns - Explains why each issue matters
Supported Languages
| Language | Support Level | |----------|--------------| | TypeScript/JavaScript | Full | | Python | Full | | Go | Full | | Rust | Full | | Java | Full | | C/C++ | Partial | | Ruby | Partial |
Configuration Options
agents:
- name: code-reviewer
template: code-reviewer
config:
# Review thoroughness: quick, balanced, thorough
review_style: balanced
# Minimum severity to report: info, warning, error
min_severity: warning
# Auto-approve PRs with no issues
auto_approve: false
# Focus on specific file patterns
include_patterns:
- "src/**/*.ts"
- "lib/**/*.py"
# Ignore certain files
exclude_patterns:
- "**/*.test.ts"
- "**/__mocks__/**"
# Review aspects to focus on
focus_areas:
- security
- performance
- maintainability
- testing
Review Output
The agent posts a structured review comment:
Summary
A brief overview of the changes and overall assessment.
Issues Found
Each issue includes:
- Severity - Error, Warning, or Info
- Location - File and line number
- Description - What the issue is
- Suggestion - How to fix it
- Code snippet - Suggested replacement code
Example Review
## Code Review Summary
This PR adds user authentication to the API. Overall, the implementation
looks good with a few suggestions for improvement.
### Issues Found
#### 1. Potential SQL Injection (Error)
📍 `src/auth/login.ts:45`
The user input is directly interpolated into the SQL query without
sanitization.
**Current:**
\`\`\`typescript
const query = `SELECT * FROM users WHERE email = '${email}'`;
\`\`\`
**Suggested:**
\`\`\`typescript
const query = 'SELECT * FROM users WHERE email = $1';
const result = await db.query(query, [email]);
\`\`\`
#### 2. Missing Error Handling (Warning)
📍 `src/auth/login.ts:52`
The async operation doesn't handle potential errors...
Best Practices
- Start with balanced mode - Adjust after seeing initial reviews
- Exclude test files - Unless you want test reviews too
- Set minimum severity - Start with "warning" to reduce noise
- Review the reviews - Agents learn from your feedback
Integration with Approval Workflows
Combine with approval workflows:
approval_workflow:
require_review: true
block_on_errors: true
allow_override: true