Comprehensive GitHub Pull Request code review skill. Use when asked to "review this PR", "code review", "review pull request", "check this PR", or when a GitHub PR URL is provided...
Conduct comprehensive, professional code reviews for GitHub Pull Requests using industry-standard criteria and automated tooling.
This skill performs code reviews by:
Activate this skill when:
IMPORTANT: This skill uses a two-stage approval process. Nothing is posted to GitHub until explicit approval with /send or /send-decline.
/show)/send (approve) or /send-decline (request changes)Use fetch_pr_data.py to automatically collect all PR information:
python scripts/fetch_pr_data.py <pr_url> [--output-dir <dir>] [--no-clone]
Actions performed:
<output-dir>/PRs/<repo-name>/<PR-NUMBER>/Example:
python scripts/fetch_pr_data.py https://github.com/facebook/react/pull/28476
# Custom output directory
python scripts/fetch_pr_data.py https://github.com/owner/repo/pull/123 --output-dir /tmp/reviews
# Skip cloning (faster, no git diff)
python scripts/fetch_pr_data.py https://github.com/owner/repo/pull/123 --no-clone
Output structure:
/tmp/PRs/<repo-name>/<PR-NUMBER>/
├── metadata.json # PR metadata (title, author, branches)
├── diff.patch # PR diff from gh CLI
├── git_diff.patch # Git diff (if cloned)
├── comments.json # Review comments on code
├── commits.json # Commit history
├── related_issues.json # Linked GitHub issues
├── ticket_numbers.json # Extracted ticket references
├── SUMMARY.txt # Human-readable summary
└── source/ # Cloned repository (if not --no-clone)
After fetching, analyze collected data against review criteria:
SUMMARY.txt - High-level overviewmetadata.json - PR context, labels, assigneesdiff.patch - Code changescomments.json - Existing feedbackcommits.json - Commit quality and messagesrelated_issues.json - Linked tickets/issuesUse the Read tool to examine files:
Read /tmp/PRs/<repo-name>/<PR-NUMBER>/SUMMARY.txt
Read /tmp/PRs/<repo-name>/<PR-NUMBER>/metadata.json
Read /tmp/PRs/<repo-name>/<PR-NUMBER>/diff.patch
CRITICAL: After analysis, use generate_review_files.py to create structured review documents:
python scripts/generate_review_files.py <pr_review_dir> --findings <findings_json> [--metadata <metadata_json>]
Creates three files in pr_review_dir/pr/:
pr/review.md - Detailed internal review with emojis and line numberspr/human.md - Clean review for posting (no emojis, em-dashes, line numbers)pr/inline.md - Proposed inline comments with code snippetsAlso creates slash commands in .claude/commands/:
/send - Post human.md and approve PR/send-decline - Post human.md and request changes/show - Open review directory in VS CodeFindings JSON structure:
{
"summary": "Overall assessment of the PR...",
"metadata": {
"repository": "owner/repo",
"number": 123,
"title": "PR title",
"author": "username",
"head_branch": "feature",
"base_branch": "main"
},
"blockers": [
{
"category": "Security",
"issue": "SQL injection vulnerability",
"file": "src/db/queries.py",
"line": 45,
"details": "Using string concatenation for SQL query",
"fix": "Use parameterized queries",
"code_snippet": "result = db.execute('SELECT * FROM users WHERE id = ' + user_id)"
}
],
"important": [...],
"nits": [...],
"suggestions": ["Consider adding...", "Future enhancement..."],
"questions": ["Is this intended to...", "Should we..."],
"praise": ["Excellent test coverage", "Clear documentation"],
"inline_comments": [
{
"file": "src/app.py",
"line": 42,
"comment": "Consider edge case handling for empty input",
"code_snippet": "def process(data):\n return data.strip()",
"start_line": 41,
"end_line": 43,
"owner": "owner",
"repo": "repo",
"pr_number": 123
}
]
}
Use /show to open the review directory in VS Code.
Actions available:
pr/review.md - Detailed analysispr/human.md - Modify before postingpr/inline.md - Check proposed commentsNOTHING is posted until explicit approval in Step 5.
Post the review when ready:
Option A: Approve the PR
/send
pr/human.md as commentOption B: Request Changes
/send-decline
pr/human.md as commentPosting inline comments (optional, after /send or /send-decline):
Review pr/inline.md and run the provided commands for specific code comments.
Reference references/review_criteria.md for comprehensive checklist. Review against these categories:
| Category | Key Questions |
|---|---|
| Functionality | Does code solve the problem? Bugs? Edge cases? |
| Readability | Clear code? Meaningful names? DRY? |
| Style | Follows linter rules? Consistent with codebase? |
| Performance | Efficient algorithms? Scalable? |
| Security | Vulnerabilities addressed? Secrets protected? |
| Testing | Tests exist? Cover happy paths and edge cases? |
| PR Quality | Focused scope? Clean commits? Clear description? |
Priority markers for findings:
For detailed criteria: Read references/review_criteria.md
This skill includes comprehensive reference guides:
| Reference | Purpose |
|---|---|
references/review_criteria.md |
Complete checklist covering functionality, security, testing, and more |
references/gh_cli_guide.md |
Quick reference for GitHub CLI commands |
references/scenarios.md |
Detailed workflows for common review scenarios |
references/troubleshooting.md |
Common issues and solutions |
scripts/fetch_pr_data.pyAutomated PR data fetching and organization.
python scripts/fetch_pr_data.py <pr_url> [options]
Options:
--output-dir DIR Base output directory (default: /tmp)
--no-clone Skip cloning repository
scripts/generate_review_files.pyGenerate structured review files from analysis findings.
python scripts/generate_review_files.py <pr_review_dir> --findings <findings_json> [--metadata <metadata_json>]
Creates:
pr/review.md - Detailed internal reviewpr/human.md - Clean review for postingpr/inline.md - Proposed inline comments with commands.claude/commands/send.md - Slash command to approve and post.claude/commands/send-decline.md - Slash command to request changes.claude/commands/show.md - Slash command to open in VS CodeREVIEW_READY.txt - Summary of next stepsscripts/add_inline_comment.pyAdd inline code review comments to specific lines in PR.
python scripts/add_inline_comment.py <owner> <repo> <pr_number> <commit_id> <file_path> <line> "<comment>" [options]
Options:
--side RIGHT|LEFT Side of diff (default: RIGHT)
--start-line N Starting line for multi-line comment
--start-side RIGHT|LEFT Starting side for multi-line comment
review_criteria.md as checklistFor detailed scenarios: Read references/scenarios.md
# Fetch PR data
python scripts/fetch_pr_data.py https://github.com/owner/repo/pull/123
# Add inline comment
python scripts/add_inline_comment.py owner repo 123 latest "src/app.py" 42 "Comment"
# View PR in browser
gh pr view 123 --repo owner/repo --web
# Check PR status
gh pr checks 123 --repo owner/repo
# View existing comments
gh api /repos/owner/repo/pulls/123/comments --jq '.[] | {path, line, body}'
For troubleshooting: Read references/troubleshooting.md
references/review_criteria.mdreferences/gh_cli_guide.mdreferences/scenarios.mdreferences/troubleshooting.md