From pr-review
AI-powered PR review with contract verification, frontend and backend rules, inbox mode, and incremental re-review. Auto-detects project type and applies relevant rules. Use when user says "review PR 42", "review my PRs", "check my PR inbox", "pr review", or invokes /pr-review.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pr-review:pr-reviewThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Interactive PR review for any GitHub repo. Runs a reviewer subagent with rules tailored to the project's stack, performs contract verification, and walks through findings interactively.
Interactive PR review for any GitHub repo. Runs a reviewer subagent with rules tailored to the project's stack, performs contract verification, and walks through findings interactively.
CRITICAL: All review comments MUST be posted on the specific line where the issue exists. NEVER post code review feedback as general PR comments. Use the GitHub review API with line-specific comments.
Two modes: single PR mode (argument provided) or inbox mode (no argument).
Argument can be a PR number (42), a PR URL (https://github.com/owner/repo/pull/42), or a branch name. Normalize to {NUMBER} and {OWNER}/{REPO} for subsequent commands.
# If argument is a URL, parse owner/repo/number
# If argument is just a number, detect repo via:
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
Detect current repo and list PRs awaiting the user's review:
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
gh search prs --review-requested=@me --repo="$REPO" --state=open --json number,title,author,url,isDraft
For each PR, fetch enrichment data:
gh pr view {NUMBER} --json number,title,author,additions,deletions,isDraft,statusCheckRollup
Build a summary table with emoji check status:
| Emoji | Meaning |
|---|---|
| ✅ | All checks pass |
| ❌ | One or more checks failed |
| ⏳ | Checks pending / in progress |
| ➖ | No checks configured |
Mark drafts with [DRAFT] prefix. Example output:
PRs awaiting your review in owner/repo:
#142 ✅ feat: add user export (alice) +240 -30
#138 ❌ fix: race in webhook handler (bob) +45 -12
#135 ⏳ [DRAFT] chore: upgrade deps (carol) +800 -800
#130 ➖ docs: update README (dave) +15 -2
(A)ll / (P)ick / (N)one?
gh pr view {NUMBER} --json title,author,body,additions,deletions,isDraft,baseRefName,headRefName,url,headRefOid
gh pr checks {NUMBER}
gh pr diff {NUMBER}
gh pr view {NUMBER} --json files --jq '.files[].path'
Edge cases:
CURRENT_USER=$(gh api user --jq '.login')
gh api repos/{OWNER}/{REPO}/pulls/{NUMBER}/reviews --jq ".[] | select(.user.login == \"$CURRENT_USER\")"
If prior reviews exist, get the most recent review's submitted_at and commit_id. Count new commits since that review:
gh api repos/{OWNER}/{REPO}/pulls/{NUMBER}/commits --jq '.[] | select(.commit.author.date > "{LAST_REVIEW_AT}")'
If new commits exist, offer:
You already reviewed this PR. {N} new commits since your last review.
(F)ull re-review
(I)ncremental (only new commits)
(S)kip
For incremental: fetch the delta diff using the parent SHA of the first new commit:
PARENT_SHA=$(gh api repos/{OWNER}/{REPO}/commits/{FIRST_NEW_COMMIT_SHA} --jq '.parents[0].sha')
gh api repos/{OWNER}/{REPO}/compare/$PARENT_SHA...{HEAD_SHA} --jq '.files[] | {filename, patch}'
If the delta diff is empty (rebase detected or force-push rewrote history), print a note and fall back to full review.
Exclude these paths before counting size or sending to the subagent:
*.lock
*.min.js
*.min.css
*.snap
*.generated.*
package-lock.json
yarn.lock
pnpm-lock.yaml
*.g.dart
*.pb.go
*_generated.go
dist/**
build/**
src/generated/**
*.graphql.ts (if auto-generated)
Note: Prisma migration SQL files under prisma/migrations/**/migration.sql are generated output and should be excluded, BUT the schema.prisma changes they reflect SHOULD be reviewed.
Count non-generated diff lines.
| Size | Strategy |
|---|---|
< 2000 lines | Full diff, one subagent |
2000-8000 lines | Ask user: full review or split by directory? |
> 8000 lines | Auto-split by top-level directory |
For splits:
apps/web/, apps/api/, packages/*/, etc.){file}:{line}:{title}Inspect changed file paths to determine what rule files to include.
Frontend if diff contains any of:
*.tsx, *.jsxsrc/components/, src/pages/, src/app/, pages/, app/*.vue, *.svelteBackend if diff contains any of:
apps/api/, apps/*-api/, services/, server/packages/*/src/ containing *.service.ts, *.repository.ts, *.controller.ts, *.router.ts, *.resolver.tsschema.prisma, *.sqlFull-stack if both detected.
Read these from this skill's directory based on detection:
references/severity-definitions.mdreferences/contract-verification.mdreferences/frontend-rules.mdreferences/backend-rules.mdCache the contents in memory for the subagent prompt assembly in Step 7.
Before dispatching the reviewer subagent, perform a lightweight contract verification pass to catch silent typo bugs that AI review often misses.
Read references/contract-verification.md for the detailed checks. Summary:
For each changed file:
where/select/data exist in the current schema.prismaCollect all contract findings into a list. Attach them to the diff context before dispatching the subagent (Step 7).
Read these files from this skill's directory:
review-lens.mdoutput-contract.mdThe prompt passed to the Agent tool is a concatenation of:
review-lens.md verbatim (top-level reviewer instructions)output-contract.md verbatim (JSON schema the subagent must return)severity-definitions.md, contract-verification.md, and frontend-rules.md and/or backend-rules.md based on detection## Pre-scan Contract Findings heading)## PR Context
Title: {TITLE}
Author: {AUTHOR}
Base: {BASE} ← Head: {HEAD}
CI: {STATUS}
URL: {URL}
### Description
{BODY or "(no description)"}
### Changed Files
{FILE_LIST}
### Diff
{FILTERED_DIFF}
## Incremental Review\nYou previously reviewed this PR at commit {OLD_SHA}. Only the following commits are new: {LIST}. Focus exclusively on the delta diff above.Use the Agent tool with a general-purpose subagent. For chunked reviews, dispatch multiple Agent calls in parallel (same turn). Each returns a JSON object matching output-contract.md. Merge findings by deduplicating on {file}:{line}:{title}.
Parse the subagent's JSON response and render a summary box:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PR #{NUMBER} - {TITLE} ({AUTHOR})
Checks: {CHECK_EMOJI} {STATUS} | +{ADD} -{DEL}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Verdict: {EMOJI} {VERDICT}
Summary: {SUMMARY}
Description alignment: {STATUS} {NOTES}
🔴 {N} Critical 🟡 {N} Important ⚪ {N} Minor
Strengths:
- {STRENGTH_1}
- {STRENGTH_2}
Walk through findings? (y/n/skip)
Verdict emoji:
approve → ✅request-changes → ❌comment → 💬If findings is empty, skip the walkthrough and go directly to Step 10.
Present each finding one at a time, ordered by severity (critical → important → minor):
[{INDEX}/{TOTAL}] {SEVERITY_EMOJI} {SEVERITY} - {TITLE}
File: {FILE}:{LINE_RANGE}
{DIFF_HUNK}
{EXPLANATION}
Why it matters: {WHY}
Suggestion: {SUGGESTION}
(A)ccept / (R)eject / (E)dit / (D)etails?
suggestion_code is present, include it as a GitHub suggestion block (```suggestion ... ```) inside the comment body.Track the accepted/rejected counts for Step 10.
Show a submission summary:
Review ready to submit:
Accepted: {N_ACCEPTED}
Rejected: {N_REJECTED}
Recommended verdict: {VERDICT}
Submit? (y/n)
commentrequest-changescommentapprove → approveapproveCOMMIT_ID=$(gh pr view {NUMBER} --json headRefOid --jq '.headRefOid')
cat <<EOF | gh api repos/{OWNER}/{REPO}/pulls/{NUMBER}/reviews --method POST --input -
{
"commit_id": "$COMMIT_ID",
"event": "{EVENT}",
"body": "{REVIEW_BODY}",
"comments": [
{
"path": "{FILE}",
"line": {LINE},
"side": "RIGHT",
"body": "{COMMENT_BODY_WITH_OPTIONAL_SUGGESTION_BLOCK}"
}
]
}
EOF
Event mapping:
approve → APPROVErequest-changes → REQUEST_CHANGEScomment → COMMENTAfter successful submission, print:
✅ Review submitted: {PR_URL}
After iterating through all selected PRs in inbox mode, print a final table:
Session Summary:
PR Verdict Findings (C/I/M)
──── ──────────────── ────────────────
#142 ✅ approve 0 / 0 / 1
#138 ❌ request-changes 2 / 1 / 0
#135 💬 comment 0 / 3 / 2
#130 skipped -
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub colorpulse6/claude-skills --plugin pr-review