Review pr

From hmislk/hmis · View interactive version

Review pr is an AI agent skill from the GitHub repository hmislk/hmis. Handle CodeRabbit and Codex review comments on a GitHub PR. Fetches the PR, investigates each comment against the codebase, discusses validity with the user, batches valid fixes, and guides through push and reply steps.

How to use this skill

Skill file

PR Review Workflow

Handle review comments (CodeRabbit, Codex, human reviewers) on a GitHub pull request.

Arguments

Steps

1. Fetch and Checkout

git fetch origin
gh pr checkout $0

Always fetch first — automated tools may have pushed fixes not yet local.

2. Load PR Comments

gh pr view $0 --comments
pr_number=$(gh pr view $0 --json number --jq '.number')
gh api repos/hmislk/hmis/pulls/$pr_number/comments

List all review comments. Group them by file/topic.

3. Investigate Each Comment

For each comment:

Common false positives in this project:

4. Present Findings to User

For each comment, report:

Wait for user confirmation before making any changes.

5. Batch Valid Fixes

Apply all confirmed fixes. Group into one or a few logical commits:

Fix CodeRabbit review comments (#<issue>)

Closes #<issue>

Co-Authored-By: Claude <noreply@anthropic.com>

6. Pre-Push Checklist

7. Push

git push

Verify CI passes before proceeding.

8. Reply to Existing Reviewer Threads

⚠️ Cardinal rules — read before posting anything:

1. Do NOT create new top-level inline comments on the PR. Each one becomes a thread the author must manually resolve. This is noise.

2. Reply only after fixing (or explicitly dismissing). Bots cannot fix anything — describe action taken, not requested.

- Valid + fixed → "Fixed in <commit-sha>: <what was changed>"

- Dismissed → "Dismissed because: <specific reasoning>"

⚠️ "Please resolve" wording on a CodeRabbit thread triggers CodeRabbit Chat — it opens a NEW PR (📝 CodeRabbit Chat: Implement requested code changes, branch coderabbitai/chat/<sha>) attempting the fix against a stale snapshot. These auto-PRs often duplicate work the author has already done and have shipped unsafe diffs (e.g. deleted a params.put(...) line on PR #20979). If you accidentally trigger one: close it, delete the branch.

3. Replies go UNDER existing reviewer threads only (/replies endpoint). Never as new top-level comments.

4. Self-review items go in the commit message (or PR description if deferred). Never as new inline comments.

5. ONE re-review request at the end, not per item.

Order: discuss → fix → push → reply to existing threads → one re-review request.

For each existing reviewer comment, post a threaded reply under the parent. The four endpoints are easy to confuse:

| Want | Endpoint | Use? |

|---|---|---|

| Reply under existing reviewer comment (threaded) | POST /pulls/{pr}/comments/{id}/replies | YES — this is the only legitimate reply form |

| New standalone inline comment on a line | POST /pulls/{pr}/comments | NO — creates a fresh thread the author must manually resolve |

| Bundled review | POST /pulls/{pr}/reviews | NO — grouping wrapper, doesn't match how bots post |

| General PR comment (only genuine PR-wide notes) | POST /issues/{n}/comments | Sparingly — only for actual PR-wide announcements |

For self-review items you spot on your own PR — don't post a new inline comment. Fix in the next commit and reference the file:line in the commit message:

refactor(cashier): address self-review items

- PaymentSettlementController.java:117 — add comment on shallow snapshot
- settle_non_cash.xhtml:203 — use lastSettlementBill.institution.name

Find existing comment IDs to reply to:

gh api "repos/hmislk/hmis/pulls/<PR>/comments" \
  --jq '.[] | "\(.id) \(.user.login) \(.path):\(.line // .original_line)"'

Post a threaded reply:

gh api -X POST "repos/hmislk/hmis/pulls/<PR>/comments/<COMMENT_ID>/replies" \
  -f body="Fixed in <commit-sha>: <what was changed>."

Do NOT resolve human reviewers' conversations. Resolve a bot (CodeRabbit/Codex) thread yourself after replying with a fix or a §2a decline; the repository will not merge with an unresolved conversation.

Full API recipes and cleanup commands: see Posting PR Comments via gh CLI.

9. Re-Request Review

Click "Re-request review" on the PR page after pushing. Do not rely on reviewers noticing the new push.

10. Post-Merge Cleanup

After merge:

git branch -d <branch-name>

Also confirm "Delete branch" was checked in the GitHub merge dialog.

Reference

Full workflow documentation: developer_docs/git/pr-review-workflow.md

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.