spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

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