Loading...
Loading...
Triage unresolved PR review comments, produce a severity-ordered fix plan, then resolve or fix each issue with subagents. Use when addressing PR feedback before merge.
npx skill4agent add casper-studios/casper-marketplace pr-comments/pr-comments/pr-comments 608# Auto-detect from current branch, or use the provided PR number
gh pr view --json number,headRepositoryOwner,title,headRefName,baseRefNamegh api graphql -f query='
{
repository(owner: "{OWNER}", name: "{REPO_NAME}") {
pullRequest(number: {PR_NUMBER}) {
reviewThreads(first: 100) {
nodes {
id
isResolved
isOutdated
path
line
comments(first: 20) {
nodes {
databaseId
author { login }
body
path
line
originalLine
createdAt
url
}
}
}
}
}
}
}'hasNextPageisResolved == falseisOutdatedgh api --paginate "repos/{OWNER}/{REPO_NAME}/issues/{PR_NUMBER}/comments?per_page=100"| Bot | Format | Example |
|---|---|---|
| Emoji badge in body | |
| SVG image alt text | |
| Shield badge | |
| HTML comment metadata | Parse |
securitybugcorrectnessperformanceaccessibilitystyleconfigdocs.mdisOutdated == true.claude/scratchpad/pr-{PR_NUMBER}-review-plan.md# PR #{PR_NUMBER} Review Plan — "{PR_TITLE}"
**Branch:** {branch_name}
**PR URL:** {pr_url}
**Threads fetched:** {total} total, {unresolved} unresolved, {outdated} outdated
**Bot breakdown:** {count per bot}
---
## Issues to Fix (ordered by severity)
Only include issues that will actually be fixed. Items classified as ignored in Phase 2 go EXCLUSIVELY in the Ignored section below — never list them here.
### 1. [{SEVERITY}] {Short description of the issue}
- **File:** `path/to/file.ts#L{line}`
- **Category:** {category}
- **Flagged by:** @bot1, @bot2
- **Comment URL:** {url to first comment}
- **What's wrong:** {1-2 sentence explanation in plain english}
- **Suggested fix:** {concrete description of what to change}
> Original comment (from @bot1):
> {relevant excerpt — strip boilerplate/badges}
---
### 2. [{SEVERITY}] ...
---
## Ignored (with reasoning)
Each ignored item appears ONLY here — not duplicated in the Issues to Fix section above.
### I1. @{bot} on `path/to/file.ts#L{line}`
- **Why ignored:** {specific reason — e.g., "contradicts project convention in AGENTS.md to not use explicit return types", "outdated thread, code already changed", "style nitpick on a config file"}
- **Original comment:** {link to comment}
### I2. ...
---
## Summary
- **{N} issues to fix** across {M} files
- **{K} comments ignored** ({reasons breakdown})
- Estimated complexity: {low/medium/high}Review plan written to. {N} issues to fix, {K} ignored. Please review and confirm to proceed..claude/scratchpad/pr-{PR_NUMBER}-review-plan.md
# Post a reply comment on the thread
gh api -X POST "repos/{OWNER}/{REPO_NAME}/pulls/{PR_NUMBER}/comments" \
-f body="Acknowledged — {reason}. Resolving." \
-F in_reply_to={COMMENT_DATABASE_ID}
# Resolve the thread via GraphQL
gh api graphql -f query='
mutation {
resolveReviewThread(input: { threadId: "{THREAD_NODE_ID}" }) {
thread { isResolved }
}
}'Launch a Task subagent (subagent_type: "general-purpose") for each group:
Prompt template:
"Fix the following PR review issue(s) on branch {BRANCH}:
Issue: {description}
File: {path}#{line}
What's wrong: {explanation}
Suggested fix: {fix description}
Read the file, understand the surrounding context, and make the fix.
After fixing, verify the change is correct.
Do NOT touch unrelated code."subagent_type: "general-purpose"as