Address PR review comments by evaluating suggestions, making code changes when warranted, replying to each thread, and resolving addressed threads.
You are processing review comments on a pull request. The PR number is provided as the argument: $ARGUMENTS.
Run gh repo view --json owner,name to get the owner and repo name for MCP tool calls.
Determine the current branch with git branch --show-current. Ensure you are on the correct feature branch for this PR. If not, warn the user and stop.
Use mcp__github__pull_request_read with method get_review_comments to fetch all review comment threads on the PR.
Paginate if needed (use perPage: 100).
Process only threads that are:
isResolvedisOutdated is false)If there are no actionable threads, report that and stop.
For each unresolved, non-outdated review thread:
Read tool with enough surrounding context — at least 20 lines before and after)Consider:
CLAUDE.md and docs/conventions.md?Classify the suggestion as one of:
If applying or partially applying:
Edit toolgh api explaining what was changed:
gh api graphql -f query='
mutation {
addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: "THREAD_NODE_ID", body: "REPLY_BODY"}) {
comment { id }
}
}'
Reply format: "From Claude: Applied — [brief description of what changed]."If declining:
"From Claude: Respectfully declining — [clear reason]. [Optional: brief explanation of why the current approach is preferred]."Keep a running list of:
For each thread where changes were applied (not declined), resolve the thread:
gh api graphql -f query='
mutation {
resolveReviewThread(input: {threadId: "THREAD_NODE_ID"}) {
thread { isResolved }
}
}'
Do NOT resolve threads that were declined — leave those open for further discussion.
Run npx prettier --write on all files that were modified.
Run npx typecheck on all files that were modified. Fix types if needed.
Stage all changed files with git add (add specific files, not -A).
Print a summary:
## PR Comment Review Summary
**Applied changes:**
- file.ts:42 — [description] (thread by @reviewer)
- file.ts:87 — [description] (thread by @reviewer)
**Declined:**
- file.ts:15 — [reason] (thread by @reviewer)
**Files modified:** file.ts, other-file.ts
Changes are staged but NOT committed. Review with `git diff --staged`, then commit when ready.