File size: 7,528 Bytes
7f0ec95 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | # PR Review Toolkit
A comprehensive collection of specialized agents for thorough pull request review, covering code comments, test coverage, error handling, type design, code quality, and code simplification.
## Overview
This plugin bundles 6 expert review agents that each focus on a specific aspect of code quality. Use them individually for targeted reviews or together for comprehensive PR analysis.
## Agents
### 1. comment-analyzer
**Focus**: Code comment accuracy and maintainability
**Analyzes:**
- Comment accuracy vs actual code
- Documentation completeness
- Comment rot and technical debt
- Misleading or outdated comments
**When to use:**
- After adding documentation
- Before finalizing PRs with comment changes
- When reviewing existing comments
**Triggers:**
```
"Check if the comments are accurate"
"Review the documentation I added"
"Analyze comments for technical debt"
```
### 2. pr-test-analyzer
**Focus**: Test coverage quality and completeness
**Analyzes:**
- Behavioral vs line coverage
- Critical gaps in test coverage
- Test quality and resilience
- Edge cases and error conditions
**When to use:**
- After creating a PR
- When adding new functionality
- To verify test thoroughness
**Triggers:**
```
"Check if the tests are thorough"
"Review test coverage for this PR"
"Are there any critical test gaps?"
```
### 3. silent-failure-hunter
**Focus**: Error handling and silent failures
**Analyzes:**
- Silent failures in catch blocks
- Inadequate error handling
- Inappropriate fallback behavior
- Missing error logging
**When to use:**
- After implementing error handling
- When reviewing try/catch blocks
- Before finalizing PRs with error handling
**Triggers:**
```
"Review the error handling"
"Check for silent failures"
"Analyze catch blocks in this PR"
```
### 4. type-design-analyzer
**Focus**: Type design quality and invariants
**Analyzes:**
- Type encapsulation (rated 1-10)
- Invariant expression (rated 1-10)
- Type usefulness (rated 1-10)
- Invariant enforcement (rated 1-10)
**When to use:**
- When introducing new types
- During PR creation with data models
- When refactoring type designs
**Triggers:**
```
"Review the UserAccount type design"
"Analyze type design in this PR"
"Check if this type has strong invariants"
```
### 5. code-reviewer
**Focus**: General code review for project guidelines
**Analyzes:**
- CLAUDE.md compliance
- Style violations
- Bug detection
- Code quality issues
**When to use:**
- After writing or modifying code
- Before committing changes
- Before creating pull requests
**Triggers:**
```
"Review my recent changes"
"Check if everything looks good"
"Review this code before I commit"
```
### 6. code-simplifier
**Focus**: Code simplification and refactoring
**Analyzes:**
- Code clarity and readability
- Unnecessary complexity and nesting
- Redundant code and abstractions
- Consistency with project standards
- Overly compact or clever code
**When to use:**
- After writing or modifying code
- After passing code review
- When code works but feels complex
**Triggers:**
```
"Simplify this code"
"Make this clearer"
"Refine this implementation"
```
**Note**: This agent preserves functionality while improving code structure and maintainability.
## Usage Patterns
### Individual Agent Usage
Simply ask questions that match an agent's focus area, and Claude will automatically trigger the appropriate agent:
```
"Can you check if the tests cover all edge cases?"
β Triggers pr-test-analyzer
"Review the error handling in the API client"
β Triggers silent-failure-hunter
"I've added documentation - is it accurate?"
β Triggers comment-analyzer
```
### Comprehensive PR Review
For thorough PR review, ask for multiple aspects:
```
"I'm ready to create this PR. Please:
1. Review test coverage
2. Check for silent failures
3. Verify code comments are accurate
4. Review any new types
5. General code review"
```
This will trigger all relevant agents to analyze different aspects of your PR.
### Proactive Review
Claude may proactively use these agents based on context:
- **After writing code** β code-reviewer
- **After adding docs** β comment-analyzer
- **Before creating PR** β Multiple agents as appropriate
- **After adding types** β type-design-analyzer
## Installation
Install from your personal marketplace:
```bash
/plugins
# Find "pr-review-toolkit"
# Install
```
Or add manually to settings if needed.
## Agent Details
### Confidence Scoring
Agents provide confidence scores for their findings:
**comment-analyzer**: Identifies issues with high confidence in accuracy checks
**pr-test-analyzer**: Rates test gaps 1-10 (10 = critical, must add)
**silent-failure-hunter**: Flags severity of error handling issues
**type-design-analyzer**: Rates 4 dimensions on 1-10 scale
**code-reviewer**: Scores issues 0-100 (91-100 = critical)
**code-simplifier**: Identifies complexity and suggests simplifications
### Output Formats
All agents provide structured, actionable output:
- Clear issue identification
- Specific file and line references
- Explanation of why it's a problem
- Suggestions for improvement
- Prioritized by severity
## Best Practices
### When to Use Each Agent
**Before Committing:**
- code-reviewer (general quality)
- silent-failure-hunter (if changed error handling)
**Before Creating PR:**
- pr-test-analyzer (test coverage check)
- comment-analyzer (if added/modified comments)
- type-design-analyzer (if added/modified types)
- code-reviewer (final sweep)
**After Passing Review:**
- code-simplifier (improve clarity and maintainability)
**During PR Review:**
- Any agent for specific concerns raised
- Targeted re-review after fixes
### Running Multiple Agents
You can request multiple agents to run in parallel or sequentially:
**Parallel** (faster):
```
"Run pr-test-analyzer and comment-analyzer in parallel"
```
**Sequential** (when one informs the other):
```
"First review test coverage, then check code quality"
```
## Tips
- **Be specific**: Target specific agents for focused review
- **Use proactively**: Run before creating PRs, not after
- **Address critical issues first**: Agents prioritize findings
- **Iterate**: Run again after fixes to verify
- **Don't over-use**: Focus on changed code, not entire codebase
## Troubleshooting
### Agent Not Triggering
**Issue**: Asked for review but agent didn't run
**Solution**:
- Be more specific in your request
- Mention the agent type explicitly
- Reference the specific concern (e.g., "test coverage")
### Agent Analyzing Wrong Files
**Issue**: Agent reviewing too much or wrong files
**Solution**:
- Specify which files to focus on
- Reference the PR number or branch
- Mention "recent changes" or "git diff"
## Integration with Workflow
This plugin works great with:
- **build-validator**: Run build/tests before review
- **Project-specific agents**: Combine with your custom agents
**Recommended workflow:**
1. Write code β **code-reviewer**
2. Fix issues β **silent-failure-hunter** (if error handling)
3. Add tests β **pr-test-analyzer**
4. Document β **comment-analyzer**
5. Review passes β **code-simplifier** (polish)
6. Create PR
## Contributing
Found issues or have suggestions? These agents are maintained in:
- User agents: `~/.claude/agents/`
- Project agents: `.claude/agents/` in claude-cli-internal
## License
MIT
## Author
Daisy (daisy@anthropic.com)
---
**Quick Start**: Just ask for review and the right agent will trigger automatically!
|