skills/review-github-pr/SKILL.md
Review a PR and submit suggestions as comments, along with an optional approval/request for changes.
npx skillsauth add afollestad/personal-ai-skills review-github-prInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Read-only: Do not modify any files. Your job is to review, report, and submit feedback on GitHub. Do not to make local changes.
Before proceeding, verify prerequisites:
gh auth status to confirm GitHub CLI is authenticated. If not, stop and tell the user to run gh auth login.Review a GitHub pull request, generate prioritized inline comments, and submit them as a batch review.
Use when: reviewing, evaluating, critiquing, auditing, or assessing a GitHub PR. Triggers on requests like "review this PR", "review PR #123", or when given a PR URL to review.
All GitHub interactions must use the gh CLI tool. Do not use curl, direct API URLs, or web fetching. Always use gh pr, gh api, or other gh subcommands.
Use gh CLI to get the full diff and PR metadata:
gh pr view <PR> --json number,title,body,baseRefName,headRefName
gh pr diff <PR>
If the user provides a URL, extract the repo and PR number from it. For private repos, always use gh CLI rather than fetching URLs directly.
Organize all findings into priority levels:
Before finalizing, review all findings — including P3 nits — and deliberately decide whether each is worth including. Do not silently drop nits; either include them or note that they were considered and omitted. Try to frame feedback as questions.
Present the full list of comments to the user, grouped and sorted by priority, before submitting. Each comment should include:
Ask the user if they want to submit all feedback, or just some, and how they want to submit the review:
The user may skip submitting certain feedback by index (provided in part 3).
Construct a JSON payload and submit all comments as a single review using gh api with --input.
Always write the JSON to a temp file rather than piping via echo — comment bodies often contain single quotes, backticks, and other characters that break shell quoting:
cat <<'PAYLOAD' > /tmp/pr_review.json
<json_payload>
PAYLOAD
gh api repos/{owner}/{repo}/pulls/{number}/reviews --method POST --input /tmp/pr_review.json
JSON payload format:
{
"event": "APPROVE|REQUEST_CHANGES|COMMENT",
"body": "",
"comments": [
{
"path": "relative/file/path.ext",
"line": 42,
"side": "RIGHT",
"body": "**[P0]** Comment text here"
}
]
}
Every comment body must start with the priority as a bold prefix: **[P0]**, **[P1]**, **[P2]**, or **[P3]**.
For the review body/summary, leave it empty ("body": ""). Do not include summaries, priority counts (e.g. "1 P1, 3 P2"), fluff, filler, or praise. All feedback belongs in inline comments only.
Important — use line and side, NOT position:
line: The actual file line number in the new version of the file on the PR branch. Do NOT try to calculate this from diff hunk headers — hunk offsets are error-prone. Instead, fetch the real file from the PR branch to confirm each line number before submitting:
gh api "repos/{owner}/{repo}/contents/{path}?ref={head_branch}" --jq '.content' | base64 -d | cat -n | sed -n '{start},{end}p'
gh pr diff output — they may not exist, leading to 404 errors.side: Always "RIGHT" for comments on new/changed lines.position field — it refers to a line's offset within the diff hunk and is error-prone across multi-hunk files.Handling lines between diff hunks: If a comment targets a line that falls between diff hunks (i.e. it's unchanged code not shown as context in any hunk), the line-based review comment will be rejected with a 422 error. In this case, submit that comment separately as a file-level comment using the individual comment endpoint:
cat <<'PAYLOAD' > /tmp/pr_file_comment.json
{
"body": "**[P2]** Comment text here",
"path": "relative/file/path.ext",
"subject_type": "file",
"commit_id": "<head_commit_sha>"
}
PAYLOAD
gh api repos/{owner}/{repo}/pulls/{number}/comments --method POST --input /tmp/pr_file_comment.json
Get the head commit SHA from gh pr view <PR> --json headRefOid --jq '.headRefOid'. Reference the specific line number in the comment body so the author knows where to look. Never combine multiple comments into a single comment body to work around this limitation — always submit each finding as its own comment.
Return the review URL to the user when complete.
documentation
Review a PR and submit suggestions as comments, along with an optional approval/request for changes.
development
Self-review, self review, self-reviewing, audit, check, or fix the current uncommitted Git diff or other uncommitted local Git changes before a commit or pull request. Use when the user asks for a repo-aware quality audit, pre-commit review, review of their diff, another pass, or another pass over local changes, or when asked to inspect local diffs, staged changes, unstaged changes, or untracked files for bugs, regressions, missing tests, lint, accessibility, stale code, or similar issues. The workflow loops after automatic or confirmed fixes until two consecutive clean passes verify that nothing remains to fix or report.
documentation
Address, fix, respond to, or resolve GitHub pull request feedback. Use when the user asks to handle PR review comments, or address feedback on PRs.
development
Invoke this skill whenever the user asks you to produce a prompt, summary, or context package intended as input for a future AI session. This covers: handoff prompts, context dumps, new-thread prompts, paste-ready prompts for fresh sessions, or any request to distill this conversation so another Claude instance or background agent can continue the work. Also invoke when the user mentions context window limits, thread length concerns, or wanting to reset/wrap up while preserving progress for a next session. This skill owns the output format and relevance filtering — do not attempt these handoffs without it. Do NOT invoke for human-audience artifacts: docs, READMEs, commit messages, tickets, release notes, standup updates, code explanations, or handoffs to human coworkers.