CtrlK
BlogDocsLog inGet started
Tessl Logo

triage-reviews

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.

60

Quality

72%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Low

Low-risk findings worth noting

Fix and improve this skill with Tessl

tessl review fix ./plugins/pr-review-triage/skills/triage-reviews/SKILL.md
SKILL.md
Quality
Evals
Security

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 on current branch's PR
/triage-reviews <pr-url-or-number>       # Triage a specific PR
/triage-reviews --dry-run                # Preview decisions without acting
/triage-reviews --auto-approve security  # Auto-accept a category
/triage-reviews --no-resolve             # Skip resolving comment threads

Workflow Overview

Fetch PR comments → Classify each → Evaluate → Present summary → Act on approval
  1. Fetch all unresolved review comments on the PR
  2. Classify each comment into a category
  3. Evaluate each against project conventions and code context
  4. Present a grouped summary with proposed actions
  5. 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

CategoryWeightDescription
securityCriticalVulnerabilities, auth issues, secrets exposure, injection risks
correctnessCriticalBugs, logic errors, race conditions, data corruption risks
error-handlingHighMissing error checks, swallowed errors, panic risks
performanceMediumN+1 queries, unnecessary allocations, algorithmic inefficiency
designMediumArchitecture concerns, coupling, abstraction issues
testingMediumMissing test coverage, flawed test logic, untested edge cases
styleLowFormatting, naming conventions, import ordering
nitLowMinor preferences, optional improvements, cosmetic changes
praiseN/APositive feedback, compliments, acknowledgments
questionN/AClarifying 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

  1. React with a thumbsup emoji:

    gh api repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions -f content='+1'
  2. 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

  1. 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.

  2. 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)

  1. Post a thank-you reply:

    Thank you for the feedback!

  2. Resolve the thread (unless --no-resolve is specified). Praise needs no further action.

For Acknowledged Comments (Questions)

  1. Post an answer based on your understanding of the code.
  2. If you're not confident in the answer, flag it for the user to review manually instead of resolving.
  3. 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:

---
# Authors to skip (e.g., bots you don't want to process)
skip-authors: []

# Categories to auto-accept without user confirmation
auto-accept: [security, correctness]

# Categories to auto-reject without user confirmation
auto-reject: []

# Default mode: "interactive" or "dry-run"
default-mode: interactive

# Resolve rejected/acknowledged threads after acting (default: true)
auto-resolve: true

# Maximum comments to process in one batch
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:

  • Target that specific PR

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:

  1. Fetch all review comments
  2. Classify and evaluate each
  3. Present grouped summary
  4. Wait for user confirmation
  5. Execute all actions in parallel where possible
  6. Report completion status

Your goal is to efficiently triage PR review feedback so developers spend their time fixing code, not managing review comments.

Repository
rikdc/ai-skills
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.