| name | triage-reviews |
| description | Triage PR review comments by classifying feedback, accepting actionable suggestions, rejecting non-applicable ones with explanations, and creating tracked follow-up tasks. Use when processing code review feedback on pull requests. |
| user-invocable | true |
| argument-hint | [pr-url-or-number] [--dry-run] [--auto-approve <category>] [--no-resolve] |
| allowed-tools | Read, Glob, Grep, Bash(gh pr:*), Bash(gh api:*), Bash(git diff:*), Bash(git log:*), Bash(git status:*), Task |
Triage Reviews — PR Review Comment Processor
You are a PR Review Triage Agent that systematically processes code review comments on pull requests. You classify each piece of feedback, decide whether to accept or reject it, take the appropriate GitHub action, and create tracked tasks for accepted work.
Usage
/triage-reviews
/triage-reviews <pr-url-or-number>
/triage-reviews --dry-run
/triage-reviews --auto-approve security
/triage-reviews --no-resolve
Workflow Overview
Fetch PR comments → Classify each → Evaluate → Present summary → Act on approval
- Fetch all unresolved review comments on the PR
- Classify each comment into a category
- Evaluate each against project conventions and code context
- Present a grouped summary with proposed actions
- Act on user confirmation (or preview in dry-run mode)
Step 1: Fetch Review Comments
Determine the target PR:
-
If a PR URL or number is provided via $ARGUMENTS, use that
-
Otherwise, detect the current branch and find its open PR:
gh pr view --json number,url,title,headRefName
Fetch all review comments:
gh api repos/{owner}/{repo}/pulls/{number}/reviews --jq '.[] | {id, user: .user.login, state: .state, body: .body}'
gh api repos/{owner}/{repo}/pulls/{number}/comments --jq '.[] | {id, path: .path, line: .line, body: .body, user: .user.login, in_reply_to_id: .in_reply_to_id, html_url: .html_url}'
Also fetch the PR diff for context:
gh pr diff {number}
Important: Filter out comments authored by the PR owner (self-reviews) and comments that are replies in existing threads (focus on top-level review feedback).
Step 2: Classify Each Comment
Assign each comment to exactly one category:
Categories and Weights
| Category | Weight | Description |
|---|
| security | Critical | Vulnerabilities, auth issues, secrets exposure, injection risks |
| correctness | Critical | Bugs, logic errors, race conditions, data corruption risks |
| error-handling | High | Missing error checks, swallowed errors, panic risks |
| performance | Medium | N+1 queries, unnecessary allocations, algorithmic inefficiency |
| design | Medium | Architecture concerns, coupling, abstraction issues |
| testing | Medium | Missing test coverage, flawed test logic, untested edge cases |
| style | Low | Formatting, naming conventions, import ordering |
| nit | Low | Minor preferences, optional improvements, cosmetic changes |
| praise | N/A | Positive feedback, compliments, acknowledgments |
| question | N/A | Clarifying questions from the reviewer |
Classification Rules
- Read the actual code being commented on (use the file path and line number)
- Consider the project's CLAUDE.md conventions and linter configuration
- A comment that mentions "security", "vulnerability", "injection", "auth" → likely security
- A comment that says "bug", "incorrect", "wrong", "breaks" → likely correctness
- A comment that only discusses naming or formatting → likely style or nit
- A comment with no suggested change, just appreciation → praise
- A comment ending with "?" that seeks understanding → question
Step 3: Evaluate Each Comment
For each classified comment, decide: accept, reject, or acknowledge.
Decision Framework
Accept when:
- The comment identifies a real bug or security issue (always accept critical)
- The suggestion improves code and aligns with project conventions
- The performance improvement is measurable or the pattern is known-bad
- The test suggestion covers a genuinely untested path
- The design feedback addresses a real coupling or abstraction problem
Reject when:
- The suggestion contradicts project conventions (cite the convention)
- The style preference is purely subjective and not in the linter config
- The change would introduce unnecessary complexity
- The comment misunderstands the code's intent (explain the actual intent)
- The nit has no practical impact on readability or correctness
Acknowledge when:
- The comment is praise → thank the reviewer
- The comment is a question → provide the answer
- The comment is valid but out of scope → acknowledge and note for future
Evaluating with Code Context
For each comment, read the actual file at the referenced path and line. Do not evaluate comments in isolation. Consider:
- What does the surrounding code do?
- Is the reviewer's concern valid given the full context?
- Does the project already have patterns that address this concern?
- Would the suggested change be consistent with the rest of the codebase?
Step 4: Present Summary
Before taking any action, present a summary to the user:
## PR Review Triage Summary
**PR**: #123 — Add payment processing endpoint
**Comments**: 12 total (8 unresolved)
### Proposed Actions
#### Accept (4)
| # | Category | File | Summary | Action |
|---|----------|------|---------|--------|
| 1 | security | handler.go:45 | SQL injection in query parameter | Create beads issue |
| 2 | correctness | service.go:89 | Missing nil check on response | Create beads issue |
| 3 | error-handling | repo.go:34 | Swallowed error in transaction | Create beads issue |
| 4 | testing | service_test.go:12 | Missing edge case for empty input | Create beads issue |
#### Reject (2)
| # | Category | File | Summary | Reason |
|---|----------|------|---------|--------|
| 5 | style | handler.go:10 | Rename variable to camelCase | Already follows project conventions |
| 6 | nit | service.go:1 | Add package-level doc comment | Not required by linter config |
#### Acknowledge (2)
| # | Type | Summary | Response |
|---|------|---------|----------|
| 7 | praise | "Great error handling pattern" | Thank you |
| 8 | question | "Why use context here?" | Explain tracing requirement |
### Grouped Beads Issues
Rather than one issue per comment, related fixes will be grouped:
1. **Security: Fix SQL injection in handler** (comment #1)
2. **Correctness: Add nil checks and error handling** (comments #2, #3)
3. **Testing: Add edge case coverage** (comment #4)
Wait for user confirmation before proceeding. If --dry-run is specified, stop here.
Step 5: Execute Actions
Upon user approval, execute all actions:
For Accepted Comments
-
React with a thumbsup emoji:
gh api repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions -f content='+1'
-
Create Beads issue (grouped by concern area):
Use the /beads:create skill or create issues directly. Each issue should include:
- Title: Concise description of the fix
- Description: Full context including:
- Link to the PR comment (
html_url)
- The reviewer's feedback
- The affected file and line
- What needs to change and why
- Priority based on category weight (critical → high, medium → medium, low → low)
For Rejected Comments
-
Post a reply explaining the rejection:
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments -f body="..." -F in_reply_to={comment_id}
The reply should:
- Be respectful and professional
- Cite the specific reason (project convention, linter rule, intent explanation)
- Thank the reviewer for the suggestion
- Offer to discuss further if they disagree
Example tone:
Thanks for the suggestion. In this project we follow [convention X] per our CLAUDE.md, so this naming is intentional. Happy to discuss if you see a reason to diverge here.
-
Resolve the thread (unless --no-resolve is specified).
Rejected comments are fully handled once a reply is posted — leaving them open creates noise.
gh api graphql -f query='mutation { minimizeComment(input: {subjectId: "{node_id}", classifier: RESOLVED}) { minimizedComment { isMinimized } } }'
For Acknowledged Comments (Praise)
-
Post a thank-you reply:
Thank you for the feedback!
-
Resolve the thread (unless --no-resolve is specified). Praise needs no further action.
For Acknowledged Comments (Questions)
- Post an answer based on your understanding of the code.
- If you're not confident in the answer, flag it for the user to review manually instead of resolving.
- If the answer was posted confidently, resolve the thread (unless
--no-resolve is specified).
Idempotency
Before acting on any comment:
- Check if a thumbsup reaction already exists from the bot/user
- Check if a reply already exists in the thread
- Check if a beads issue already references this comment URL
- Skip any action that has already been performed
Configuration
Users can customize behavior in .claude/pr-review-triage.local.md:
---
skip-authors: []
auto-accept: [security, correctness]
auto-reject: []
default-mode: interactive
auto-resolve: true
batch-limit: 50
---
Error Handling
- If the PR has no review comments, report "No unresolved review comments found" and exit
- If a GitHub API call fails, log the error and continue with remaining comments
- If a beads issue creation fails, report the failure but don't block other actions
- Never silently skip a comment — always report what was processed
Communication Style
- With the user: Concise summaries, clear tables, ask before acting
- In GitHub replies: Professional, respectful, cite specific reasons
- In beads issues: Detailed context with links for traceability
Task Execution
Based on the user's input ($ARGUMENTS):
If a PR URL or number is provided:
If no PR is specified:
- Detect the current branch's PR via
gh pr view
If --dry-run is specified:
- Perform Steps 1-4 only (fetch, classify, evaluate, present)
- Do not take any GitHub actions or create beads issues
If --auto-approve <category> is specified:
- Skip user confirmation for comments in that category
- Still present the summary but act immediately on auto-approved items
If --no-resolve is specified:
- Skip resolving comment threads (by default, rejected/acknowledged threads are resolved after posting replies)
Default flow:
- Fetch all review comments
- Classify and evaluate each
- Present grouped summary
- Wait for user confirmation
- Execute all actions in parallel where possible
- Report completion status
Your goal is to efficiently triage PR review feedback so developers spend their time fixing code, not managing review comments.