Code Review Assistant
Automated code review with intelligent analysis of changes, quality checks, and actionable feedback generation.
When to Use
- Reviewing pull requests - Analyze diffs and provide feedback
- Change summarization - Generate PR descriptions from code changes
- Quality checks - Style guide compliance, best practices
- Security review - Detect potential security issues in changes
- Review automation - Auto-approve simple changes, flag complex ones
- Learning tool - Explain changes for knowledge sharing
Core Workflow
Phase 1: Change Analysis
- Identify modified files - Categorize by type and risk level
- Calculate metrics - Lines changed, complexity delta, test coverage
- Detect patterns - New features, bug fixes, refactoring, dependencies
- Assess risk - Critical paths, public APIs, security-sensitive areas
Phase 2: Quality Assessment
- Style compliance - Check against project style guide
- Best practices - Design patterns, code organization
- Test coverage - Verify tests accompany changes
- Documentation - Check for necessary doc updates
- Security scan - Identify potential vulnerabilities
Phase 3: Feedback Generation
- Summarize changes - High-level description of what changed
- Identify issues - Bugs, anti-patterns, performance concerns
- Suggest improvements - Refactoring opportunities, optimizations
- Highlight positives - Good practices to reinforce
- Generate review comments - Specific, actionable feedback
File Risk Assessment
| Risk Level |
Patterns |
Examples |
| Critical |
Auth, security, payment |
**/auth/**, **/security/**, **/payment/** |
| High |
API, models, database |
**/api/**, **/models/**, **/database/** |
| Medium |
Services, utils |
**/services/**, **/helpers/** |
| Low |
Tests, docs |
**/tests/**, **/*.md |
Change Metrics
| Metric |
Threshold |
Action |
| Files Changed |
> 20 |
Extra review needed |
| Lines Changed |
> 500 |
Consider splitting PR |
| Complexity Delta |
+10 |
Needs scrutiny |
| Test Coverage |
< 80% |
Flag for tests |
| TODO/FIXME |
> 3 |
Needs triage |
Quality Checks
Style Violations
# Common patterns to check
STYLE_CHECKS = {
'python': [
('line_length', r'.{101,}'),
('missing_docstrings', r'^def (?!__).*:\n(?!\s*""")'),
],
'javascript': [
('console_logs', r'console\.(log|debug)'),
('var_usage', r'\bvar\s+'),
],
}
Security Patterns
SECURITY_CHECKS = [
('hardcoded_secrets', r'(password|secret|key)\s*=\s*["'][^"']+'),
('sql_injection', r'execute\s*\([^)]*%'),
('unsafe_eval', r'eval\s*\('),
]
Review Comment Templates
Issue Template
**Issue**: {description}
**Suggestion**: {suggestion}
**Why**: {explanation}
Praise Template
✨ **Nice!** {description}
This {practice} improves {benefit}.
GitHub Integration
See references/github-integration.md for API usage, auto-approval criteria, and webhook setup.
Auto-Approve Criteria
AUTO_APPROVE_CRITERIA = {
'max_files': 5,
'max_lines': 100,
'no_critical_files': True,
'test_coverage_threshold': 80,
'no_severity_blocking': True,
}
Review Summary Template
## Code Review Summary
### 📊 Change Overview
- **Files Changed**: {file_count}
- **Lines Modified**: +{additions}/-{deletions}
- **Risk Level**: {risk_level}
- **Estimated Review Time**: {review_time} minutes
### ⚠️ Issues Found
{issues_table}
### ✅ Positive Observations
{positive_observations}
### 🏁 Review Decision
**{decision}** - {decision_reason}
CI Integration
name: Automated Code Review
version: "0.2.10"
on:
pull_request:
types: [opened, synchronize]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Code Review Assistant
uses: ./.github/actions/code-review
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Quality Checklist
Rationalizations
| Rationalization |
Reality |
| "The PR is too large to review properly" |
Large PRs hide defects; split them or request a breakdown before approving. |
| "Auto-approve is good enough for small changes" |
Small changes in critical paths (auth, payments) still need human scrutiny. |
| "Review comments are just noise" |
Actionable feedback prevents repeated mistakes and builds team knowledge. |
Red Flags
References
references/github-integration.md - GitHub API integration
references/security-patterns.md - Security review patterns
references/style-guides.md - Common style guide configurations
Source: d-o-hub/github-template-ai-agents — distributed by TomeVault.
1---2name: code-review-assistant-63description: Automated code review with PR analysis, change summaries, and quality checks. Use for reviewing pull requests, generating review comments, checking against best practices, and identifying potential issues. Includes style guide compliance, security issue detection, and review automation. Use when this capability is needed.4---56# Code Review Assistant78Automated code review with intelligent analysis of changes, quality checks, and actionable feedback generation.910## When to Use1112- **Reviewing pull requests** - Analyze diffs and provide feedback13- **Change summarization** - Generate PR descriptions from code changes14- **Quality checks** - Style guide compliance, best practices15- **Security review** - Detect potential security issues in changes16- **Review automation** - Auto-approve simple changes, flag complex ones17- **Learning tool** - Explain changes for knowledge sharing1819## Core Workflow2021### Phase 1: Change Analysis22231. **Identify modified files** - Categorize by type and risk level242. **Calculate metrics** - Lines changed, complexity delta, test coverage253. **Detect patterns** - New features, bug fixes, refactoring, dependencies264. **Assess risk** - Critical paths, public APIs, security-sensitive areas2728### Phase 2: Quality Assessment29301. **Style compliance** - Check against project style guide312. **Best practices** - Design patterns, code organization323. **Test coverage** - Verify tests accompany changes334. **Documentation** - Check for necessary doc updates345. **Security scan** - Identify potential vulnerabilities3536### Phase 3: Feedback Generation37381. **Summarize changes** - High-level description of what changed392. **Identify issues** - Bugs, anti-patterns, performance concerns403. **Suggest improvements** - Refactoring opportunities, optimizations414. **Highlight positives** - Good practices to reinforce425. **Generate review comments** - Specific, actionable feedback4344## File Risk Assessment4546| Risk Level | Patterns | Examples |47|------------|----------|----------|48| **Critical** | Auth, security, payment | `**/auth/**`, `**/security/**`, `**/payment/**` |49| **High** | API, models, database | `**/api/**`, `**/models/**`, `**/database/**` |50| **Medium** | Services, utils | `**/services/**`, `**/helpers/**` |51| **Low** | Tests, docs | `**/tests/**`, `**/*.md` |5253## Change Metrics5455| Metric | Threshold | Action |56|--------|-----------|--------|57| **Files Changed** | > 20 | Extra review needed |58| **Lines Changed** | > 500 | Consider splitting PR |59| **Complexity Delta** | +10 | Needs scrutiny |60| **Test Coverage** | < 80% | Flag for tests |61| **TODO/FIXME** | > 3 | Needs triage |6263## Quality Checks6465### Style Violations6667```python68# Common patterns to check69STYLE_CHECKS = {70 'python': [71 ('line_length', r'.{101,}'),72 ('missing_docstrings', r'^def (?!__).*:\n(?!\s*""")'),73 ],74 'javascript': [75 ('console_logs', r'console\.(log|debug)'),76 ('var_usage', r'\bvar\s+'),77 ],78}79```8081### Security Patterns8283```python84SECURITY_CHECKS = [85 ('hardcoded_secrets', r'(password|secret|key)\s*=\s*["'][^"']+'),86 ('sql_injection', r'execute\s*\([^)]*%'),87 ('unsafe_eval', r'eval\s*\('),88]89```9091## Review Comment Templates9293### Issue Template9495```96**Issue**: {description}9798**Suggestion**: {suggestion}99100**Why**: {explanation}101```102103### Praise Template104105```106✨ **Nice!** {description}107108This {practice} improves {benefit}.109```110111## GitHub Integration112113See `references/github-integration.md` for API usage, auto-approval criteria, and webhook setup.114115## Auto-Approve Criteria116117```python118AUTO_APPROVE_CRITERIA = {119 'max_files': 5,120 'max_lines': 100,121 'no_critical_files': True,122 'test_coverage_threshold': 80,123 'no_severity_blocking': True,124}125```126127## Review Summary Template128129```markdown130## Code Review Summary131132### 📊 Change Overview133- **Files Changed**: {file_count}134- **Lines Modified**: +{additions}/-{deletions}135- **Risk Level**: {risk_level}136- **Estimated Review Time**: {review_time} minutes137138### ⚠️ Issues Found139{issues_table}140141### ✅ Positive Observations142{positive_observations}143144### 🏁 Review Decision145**{decision}** - {decision_reason}146```147148## CI Integration149150```yaml151name: Automated Code Review152version: "0.2.10"153154on:155 pull_request:156 types: [opened, synchronize]157158jobs:159 review:160 runs-on: ubuntu-latest161 steps:162 - uses: actions/checkout@v4163 with:164 fetch-depth: 0165 - name: Run Code Review Assistant166 uses: ./.github/actions/code-review167 with:168 github-token: ${{ secrets.GITHUB_TOKEN }}169```170171## Quality Checklist172173- [ ] All new code has corresponding tests174- [ ] No hardcoded secrets or credentials175- [ ] Security-sensitive code properly reviewed176- [ ] Documentation updated for API changes177- [ ] Error handling added for new code paths178- [ ] Performance implications considered179- [ ] Style guide compliance verified180- [ ] No debugging code left in (console.log, print)181- [ ] Meaningful commit messages182- [ ] Breaking changes documented183184## Rationalizations185186| Rationalization | Reality |187|-----------------|---------|188| "The PR is too large to review properly" | Large PRs hide defects; split them or request a breakdown before approving. |189| "Auto-approve is good enough for small changes" | Small changes in critical paths (auth, payments) still need human scrutiny. |190| "Review comments are just noise" | Actionable feedback prevents repeated mistakes and builds team knowledge. |191192## Red Flags193194- [ ] Approving PRs without checking test coverage195- [ ] Ignoring security-pattern findings in review comments196- [ ] Auto-approving changes in critical-path files without inspection197198## References199200- `references/github-integration.md` - GitHub API integration201- `references/security-patterns.md` - Security review patterns202- `references/style-guides.md` - Common style guide configurations203204---205> Source: [d-o-hub/github-template-ai-agents](https://github.com/d-o-hub/github-template-ai-agents) — distributed by [TomeVault](https://tomevault.io).206<!-- tomevault:4.0:skill_md:2026-06-16 -->