pr-comments
npx skills add https://github.com/mblode/agent-skills --skill pr-comments
Agent 安装分布
Skill 文档
PR Comment Triage
Triage and resolve PR review comments from humans and bots in a structured four-phase workflow.
Scope
- Use for: unresolved review threads on open PRs, both human and bot comments
- Skip: closed PRs, PRs with no unresolved threads, draft PRs unless explicitly requested
Reference Files
| File | Read When |
|---|---|
references/github-api.md |
Default: GraphQL queries for fetching, replying, and resolving threads |
references/bot-patterns.md |
Phase 2: bot detection, severity parsing, deduplication, false positive rules |
references/fix-plan-template.md |
Phase 3: generating the fix plan document |
Workflow
Copy this checklist to track progress:
PR comment triage progress:
- [ ] Phase 1: Fetch unresolved review threads, reviews, and comments
- [ ] Phase 2: Triage and classify all items
- [ ] Phase 3: Write fix plan and get approval
- [ ] Phase 4: Execute fixes and resolve threads
Phase 1: Fetch
Load references/github-api.md for query templates.
- Identify the PR â auto-detect from current branch (
gh pr view --json number) or accept an explicit PR number argument - Extract owner/repo â
gh repo view --json owner,name - Fetch all review threads â use the GraphQL
reviewThreadsquery with pagination. Collect every thread, then filter toisResolved == false - Fetch PR reviews â use the REST reviews endpoint. Collect all reviews with their state, body, and author. Pay attention to
CHANGES_REQUESTEDreviews with body text â these contain the reviewer’s summary of what needs to change - Fetch issue-level comments â use the REST endpoint for all PR conversation comments. Do not filter by author â bot comments from
github-actions[bot]may contain actionable findings (DangerJS warnings, schema compatibility checks) - Early exit â if zero unresolved threads, zero actionable reviews, and zero actionable issue comments, report “No unresolved review items found” and stop
Output: three lists â unresolved threads, reviews with content, and issue-level comments.
Phase 2: Triage
Load references/bot-patterns.md for detection and parsing rules.
For each item across all three sources:
- Identify author type â human or bot. For bots, classify by content first, then username:
github-actions[bot]is a shared identity â match on DangerJS markers, schema compatibility tables, or other patterns to determine if actionabledevin-ai-integration[bot]is an active reviewer â but “No Issues Found” reviews are noiselinear[bot]is always noise (project linkback)
- Skip noise â auto-classify noise items (linear linkbacks, vercel deployments, Devin “no issues” reviews, changeset releases, event-lib triggers)
- Parse severity â extract from bot-specific format (emoji, SVG, HTML tables). Human comments: default to Major for
CHANGES_REQUESTED, Minor forAPPROVED+ question - Deduplicate â group inline comments on the same file within a 3-line range. Keep the highest-severity, most-actionable comment. Mark others as
ignore-duplicate - Classify each remaining item:
- Category: bug, security, performance, style, correctness, docs, test-coverage
- Severity: critical, major, minor, nitpick
- Confidence: high (human or multi-bot), medium (single bot, clear issue), low (single bot, likely false positive)
- Disposition: fix or ignore (with reason)
- Source type: thread (resolvable), conversation (reply-only)
- Flag ignore candidates with specific reasoning:
- Pre-existing code not changed in this PR
- Bot flagged .md, config, lock, or migration files (no security implications)
- Contradicts project CLAUDE.md/AGENTS.md conventions
- Outdated thread where code has changed substantially
- Noise bot boilerplate or badge injection
Human comments are never auto-ignored. Always classify as fix unless clearly already resolved or the reviewer explicitly marked it as optional (“up to you”, “but not blocking”).
Phase 3: Plan
Load references/fix-plan-template.md for the output template.
- Create plan file â write to
.claude/scratchpad/pr-{N}-review-plan.md(create directory if needed) - Issues to Fix â ordered by severity (critical first), each with thread ID, file:line, author, category, finding, fix approach, and commit group label
- Conversation Items â issue-level comments and review bodies that need fixes but have no thread ID. These get a reply but no resolve mutation
- Ignored â each with thread ID or comment ID, author, reason, and the brief reply to post when resolving
- Summary table â disposition-by-severity matrix for quick scanning
- Present to user â print a summary showing counts (N to fix, K conversation items, M to ignore) and ask for approval
Stop here. Do not proceed to Phase 4 until the user reviews and approves the plan.
The user may edit the plan â move items between fix/conversation/ignore, change priorities, add notes. Re-read the plan file before executing.
Phase 4: Execute
After user approval, re-read .claude/scratchpad/pr-{N}-review-plan.md in case it was edited.
4a. Resolve ignored threads:
For each ignored item that has a thread ID:
- Post a brief reply explaining the decision
- Resolve the thread via GraphQL mutation
Use concise, specific reasons:
- “Duplicate of thread addressing the same finding â resolving.”
- “Contradicts project convention (see CLAUDE.md) â resolving.”
- “Outdated thread â code has been refactored. Resolving.”
- “CI notification â not actionable. Resolving.”
For ignored noise without a thread ID (issue-level bot comments), do nothing â no reply needed.
4b. Fix real issues:
Group fixes by commit group label from the plan. For each group:
- If fixes touch independent files, launch parallel subagents (one per file group)
- If fixes touch the same file or overlapping lines, execute sequentially
- Each subagent reads the file, applies the fix, and verifies correctness
Subagent prompt template:
Fix the following PR review issue(s) on branch {BRANCH}:
Issue: {finding}
File: {path}:{line}
Fix approach: {fix_approach}
Read the file, understand the surrounding context, and make the fix.
After fixing, verify the change is correct.
Do NOT touch unrelated code.
4c. Commit and push:
- Run project lint/test commands if available
- One commit per logical fix group, message format:
fix({scope}): {description} - Push the branch
4d. Resolve and reply:
- Resolved threads: post reply (“Fixed in latest push.”) then resolve via GraphQL
- Conversation items: post reply acknowledging the fix
- Issue-level comments have no resolve mechanism â the reply is the acknowledgment
4e. Verify:
- Re-fetch threads from GitHub (fresh API call) to confirm zero unresolved remain
- Check CI status with
gh pr checks - Report results to the user
Anti-patterns
- Resolving threads without posting a reply â reviewers need to see the reasoning
- Auto-ignoring human comments â always classify for user review
- Fixing items the plan marked as ignore without approval
- One commit per individual comment â group related fixes by commit group label
- Pushing before verifying lint/test pass locally
- Skipping Phase 3 approval â the fix plan is the quality gate
- Classifying
github-actions[bot]as always noise â it is a shared identity used by DangerJS, schema checkers, and other active tools. Classify by content. - Filtering issue-level comments to humans only â bot comments from DangerJS and schema checkers are actionable
Related skills
review-prfor reviewing PRs and posting comments (outbound â complementary to this skill)plan-featurefor complex feature planning when a PR comment requires significant rework