pr-review-response
npx skills add https://github.com/ideoshi/skills --skill pr-review-response
Agent 安装分布
Skill 文档
PR Review Response
Evaluate and respond to PR review comments critically rather than accepting them blindly.
Usage
Invoke with a PR number or let it auto-detect from the current branch:
/pr-review-response 42
/pr-review-response
Or trigger naturally: “respond to PR review comments”, “handle the review feedback on my PR”, “address the bot comments on PR #42”.
Workflow
1. Identify the PR
# If PR number given as argument, use it. Otherwise detect from branch:
BRANCH=$(git branch --show-current)
PR_NUMBER=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number')
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
If no open PR is found, tell the user and stop.
2. Fetch all review comments
gh api "repos/${REPO}/pulls/${PR_NUMBER}/comments" --paginate
Also fetch PR review bodies (top-level review summaries):
gh api "repos/${REPO}/pulls/${PR_NUMBER}/reviews" --paginate
Parse each comment to extract:
id– comment ID for replyingpath– file pathline/original_line– line number in diffbody– the comment textdiff_hunk– surrounding diff contextuser.login– who left it (bot vs human)in_reply_to_id– thread parent (skip if already replied to)
3. Read full context
For each commented file, read the entire file â not just the diff hunk. Bots only see the diff; you see the whole project.
Also read these if they exist:
AGENTS.mdorCLAUDE.mdâ project conventionsREADME.mdâ project intent- Adjacent files that inform the decision (imports, types, configs)
4. Evaluate each comment
For every comment, decide one of three outcomes:
Accept
The suggestion is correct and improves the code. Criteria:
- Fixes a real bug or correctness issue
- Aligns with project conventions (check AGENTS.md/existing patterns)
- The proposed fix is actually better than what’s there
Decline
The suggestion is wrong, irrelevant, or conflicts with project intent. Common reasons:
- Bot lacks project context (e.g., suggesting strict TS options when intentionally relaxed)
- Suggestion conflicts with AGENTS.md or established patterns
- It’s a stylistic preference, not a correctness issue
- The bot misunderstands the architecture or tooling
- The “fix” would break something the bot can’t see
Discuss
You’re unsure, or the comment raises a legitimate question that needs the user’s input.
5. Present assessment for approval
Before making ANY changes, show the user a summary table:
PR #42 â 3 review comments from gemini-code-assist[bot]
| # | File | Comment (summary) | Verdict | Reason |
|---|------------------|--------------------------------|---------|-------------------------------------------|
| 1 | package.json | module field wrong path | ACCEPT | Genuine bug â entry point is src/index.ts |
| 2 | tsconfig.json | Enable noUnusedLocals/Params | DECLINE | Intentionally relaxed for development |
| 3 | .gitignore | Commit bun.lock | ACCEPT | Correct â lockfiles should be committed |
Planned actions:
- Fix package.json module field
- Fix .gitignore to stop ignoring bun.lock
- Commit and push changes
- Post PR comment with responses to all 3 comments
Proceed? (changes will be committed and pushed)
Wait for user approval. Do not proceed without it.
6. Apply changes
On approval:
- Apply accepted fixes â edit the files as needed
- Stage and commit with a clear message:
git add -A && git commit -m "address PR review: accept N, decline M comments" - Push to the PR branch:
git push
7. Post PR responses
Compose a single PR comment that addresses every review comment. Format:
BODY=$(cat <<'COMMENT'
## Review Response
### package.json â module field path â
Accepted. Fixed `module` from `index.ts` to `src/index.ts`. Good catch â the entry point was incorrect.
### tsconfig.json â strict unused checks â
Declined. `noUnusedLocals` and `noUnusedParameters` are intentionally disabled. During active development, unused variables are common as code evolves. This is a deliberate choice documented in project conventions, not an oversight.
### .gitignore â commit bun.lock â
Accepted. Removed `bun.lock` from `.gitignore`. Lockfiles should be committed for reproducible builds.
---
*2 accepted, 1 declined*
COMMENT
)
gh pr comment "$PR_NUMBER" --body "$BODY"
Use reply threads where possible â reply to individual comments:
# Reply to a specific review comment
gh api "repos/${REPO}/pulls/${PR_NUMBER}/comments/${COMMENT_ID}/replies" \
-f body="Accepted. Fixed in latest push â changed module field to \`src/index.ts\`."
Key Principles
- Never blindly accept â bots lack project context. A suggestion that looks reasonable in isolation may conflict with project intent.
- Read the full file â don’t evaluate based on the diff hunk alone. The surrounding code matters.
- Check conventions first â AGENTS.md, CLAUDE.md, and existing patterns take precedence over generic best practices.
- Explain declines â a declined suggestion deserves a clear reason. This helps the reviewer (human or bot) and documents the decision.
- Batch everything â one commit for all fixes, one comment for all responses. Don’t create noise with per-comment commits.
- User approval gate â never push code or post comments without explicit user approval.
Watch Mode
After pushing a PR, you can use the watch script to automatically respond once a review comes in:
./skills/pr-review-response/scripts/watch-pr.sh 42
# or auto-detect:
./skills/pr-review-response/scripts/watch-pr.sh
This polls for new comments, waits for the review to stabilize (60s cooldown), then invokes this skill. See scripts/watch-pr.sh for details.