resolve-comments
Resolve Comments
You are assisting with resolving PR review comments. Follow these steps:
1. Fetch Review Comments
First, get PR info and review comments:
gh pr view --json number,headRepositoryOwner
gh api /repos/{owner}/{repo}/pulls/{number}/comments
Format and display comments showing: author, file path, line number, diff hunk, and comment body.
Then, for actions that require thread IDs (reply/resolve), fetch via GraphQL:
gh api graphql -f query='
query {
repository(owner: "OWNER", name: "REPO") {
pullRequest(number: NUMBER) {
reviewThreads(first: 50) {
nodes {
id
isResolved
comments(first: 10) {
nodes {
databaseId
body
path
line
}
}
}
}
}
}
}'
2. Analyze and Draft Response Plan
For each unresolved comment:
- Read the relevant source code to understand the full context
- Assess the feedback: Is it technically correct? Does it improve the code?
- Evaluate trade-offs: complexity, scope, practical impact
- Do not accept suggestions uncritically — weigh them against the code's design intent and existing patterns
- Draft a recommended action: fix (with specific changes) or explain why no change is needed (with rationale)
3. Present Plan for Review
Enter plan mode and write a response plan to the plan file containing all comments and their proposed resolutions:
- For each comment, include:
- The comment text (quoted)
- File path and line number
- Your analysis of the feedback's validity
- Recommended action: Fix (describe what to change) or No change (explain why)
- Exit plan mode to present the plan for user review
The user reviews the plan and either approves or provides corrections. Do not proceed to Step 4 until the plan is approved.
4. Execute Approved Plan
After approval, process all comments according to the plan:
Principle: Reply to every comment to maintain an audit trail of resolution decisions. This is mandatory for all comments, regardless of author (human, bot, or automated tool), and applies even if no human is expected to read the reply.
If fix required:
- Make the necessary code changes
- Reply to acknowledge the fix (e.g., "Done")
- Resolve the thread
- Inform user to use
/fixupor/commitafter all fixes are complete
If no action needed:
- Draft a reply with clear rationale (e.g., "Won't fix because...", "Intentional design because...")
- Match the language of the original comment (e.g., reply in Japanese if the comment is in Japanese)
- Reply to the last comment in the thread (use its
databaseIdascomment_id) - Step 1 — Reply (must succeed before proceeding to Step 2):
POST /repos/{owner}/{repo}/pulls/{number}/comments/{comment_id}/replies
gh api /repos/{owner}/{repo}/pulls/{number}/comments/{comment_id}/replies -X POST -f body="..."
- Step 2 — Resolve (only after the reply in Step 1 succeeds):
gh api graphql -f query='
mutation {
resolveReviewThread(input: {threadId: "THREAD_ID"}) {
thread { isResolved }
}
}'
Never run reply and resolve in parallel. If the reply fails, do not resolve the thread.
5. Summary
After processing all comments:
- List what was fixed (if any)
- List what was resolved without changes (if any)
- Suggest next steps (e.g.,
/fixupto amend,/publishto push)
More from yusuke-suzuki/dotfiles
fixup
Create a fixup commit and autosquash rebase
19publish
Push commits and create/update pull request
19sync
Sync feature branch with main via rebase
18commit
Create a git commit with Conventional Commits format
18lint-doc
Check documents against style rules and fix violations. Use after writing or editing documents to ensure compliance with document-writing and text-formatting-ja rules.
18release
Determine next semver tag, push it to trigger production deployment, and publish a GitHub release
6