|
| 1 | +Review a pull request by gathering all PR metadata, diff, and review comments, then provide a comprehensive review summary. |
| 2 | + |
| 3 | +## Instructions |
| 4 | + |
| 5 | +### 1. Identify the PR |
| 6 | + |
| 7 | +The user may provide a PR URL, number, or nothing: |
| 8 | + |
| 9 | +- **URL provided** (e.g., `https://github.com/RoboFinSystems/robosystems/pull/577`): Extract the repo and PR number |
| 10 | +- **Number provided** (e.g., `577`): Use the current repository |
| 11 | +- **Nothing provided**: Detect from the current branch using `gh pr view --json number,url` — if no open PR exists for the current branch, ask the user which PR to review |
| 12 | + |
| 13 | +### 2. Gather PR Data |
| 14 | + |
| 15 | +Run these `gh` commands to collect all context: |
| 16 | + |
| 17 | +```bash |
| 18 | +# PR metadata — use only valid fields |
| 19 | +gh pr view <NUMBER> --json title,body,author,state,labels,reviews,reviewRequests,statusCheckRollup,mergeStateStatus,headRefName,baseRefName,additions,deletions,changedFiles,createdAt,updatedAt |
| 20 | + |
| 21 | +# PR diff (the actual code changes) |
| 22 | +gh pr diff <NUMBER> |
| 23 | + |
| 24 | +# Inline review comments (gh api needs owner/repo — use gh repo view to get it) |
| 25 | +gh api repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/pulls/<NUMBER>/comments --paginate |
| 26 | + |
| 27 | +# Top-level PR conversation comments |
| 28 | +gh api repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/issues/<NUMBER>/comments --paginate |
| 29 | +``` |
| 30 | + |
| 31 | +**Important `gh pr view --json` field reference** (common mistakes to avoid): |
| 32 | +- Use `reviews` not `reviewers` (reviewers is not a valid field) |
| 33 | +- Use `reviewRequests` for pending review requests |
| 34 | +- Use `headRefOid` for the HEAD commit SHA |
| 35 | + |
| 36 | +### 3. Categorize Review Feedback |
| 37 | + |
| 38 | +Organize all comments and checks into categories: |
| 39 | + |
| 40 | +- **Human Reviews**: Comments from human reviewers (approve, request changes, general feedback) |
| 41 | +- **AI Reviews**: Comments from Claude, Copilot, or other AI review bots |
| 42 | +- **Code Quality**: Comments from linters, formatters, type checkers (e.g., CodeRabbit, SonarCloud, Codacy) |
| 43 | +- **Security**: Findings from security scanners (e.g., Snyk, Dependabot, CodeQL, GitGuardian) |
| 44 | +- **CI/CD**: Build status, test results, deployment checks |
| 45 | + |
| 46 | +### 4. Review the Diff |
| 47 | + |
| 48 | +With the full PR diff in hand, perform your own review focusing on: |
| 49 | + |
| 50 | +- **Correctness**: Does the code do what the PR description says? |
| 51 | +- **Patterns**: Does it follow existing codebase patterns (check CLAUDE.md)? |
| 52 | +- **Security**: Any OWASP top 10 concerns? |
| 53 | +- **Multi-tenancy**: Are graph operations scoped to `graph_id`? |
| 54 | +- **Error handling**: Appropriate for the context? |
| 55 | +- **Tests**: Are changes covered by tests? |
| 56 | +- **Missing changes**: Any files that should have been updated but weren't? |
| 57 | + |
| 58 | +### 5. Output Format |
| 59 | + |
| 60 | +Provide a structured review: |
| 61 | + |
| 62 | +``` |
| 63 | +## PR Summary |
| 64 | +**Title**: ... |
| 65 | +**Author**: ... | **Branch**: ... → ... |
| 66 | +**Status**: ... | **Changes**: +X / -Y across Z files |
| 67 | +
|
| 68 | +<Brief summary of what the PR does> |
| 69 | +
|
| 70 | +## Existing Review Feedback |
| 71 | +
|
| 72 | +### Human Reviews |
| 73 | +<Summarize human reviewer comments and their status> |
| 74 | +
|
| 75 | +### AI Reviews |
| 76 | +<Summarize AI review comments — highlight unresolved items> |
| 77 | +
|
| 78 | +### Code Quality |
| 79 | +<Summarize code quality bot findings> |
| 80 | +
|
| 81 | +### Security |
| 82 | +<Summarize security scanner findings — flag anything critical> |
| 83 | +
|
| 84 | +### CI/CD Status |
| 85 | +<Pass/fail status of all checks> |
| 86 | +
|
| 87 | +## My Review |
| 88 | +
|
| 89 | +### Issues (should fix before merge) |
| 90 | +<Numbered list of problems found> |
| 91 | +
|
| 92 | +### Suggestions (non-blocking improvements) |
| 93 | +<Numbered list of suggestions> |
| 94 | +
|
| 95 | +### Questions |
| 96 | +<Anything unclear that needs clarification> |
| 97 | +
|
| 98 | +## Verdict |
| 99 | +<APPROVE / REQUEST_CHANGES / NEEDS_DISCUSSION — with brief rationale> |
| 100 | +``` |
| 101 | + |
| 102 | +### Notes |
| 103 | + |
| 104 | +- If the PR diff is very large (>2000 lines), focus on the most important files and note which files were skimmed |
| 105 | +- For security findings, always err on the side of flagging — false positives are better than missed vulnerabilities |
| 106 | +- Cross-reference the PR description with the actual diff to catch scope creep or missing implementation |
| 107 | +- If the PR references an issue, check that the issue requirements are met |
| 108 | + |
| 109 | +$ARGUMENTS |
0 commit comments