|
| 1 | +--- |
| 2 | +name: reviewing-prs |
| 3 | +description: General workflow for fetching, inspecting, reviewing GitHub Pull Requests using the gh CLI, drafting user-aligned review comments, and securing approval before posting. Use when asked to review a GitHub PR or pull request. |
| 4 | +--- |
| 5 | + |
| 6 | +# Reviewing Pull Requests |
| 7 | + |
| 8 | +This skill outlines the workflow for inspecting GitHub Pull Requests using the `gh` CLI, drafting review feedback, and securing user approval before posting review comments. |
| 9 | + |
| 10 | +## Approval Safeguard (Strict Requirement) |
| 11 | + |
| 12 | +> [!IMPORTANT] |
| 13 | +> **NEVER post comments or reviews to GitHub without explicit prior user approval.** |
| 14 | +> Always present draft review comments to the user in natural language first. Only execute write commands (`gh pr comment`, `gh pr review`) after the user approves. |
| 15 | +
|
| 16 | +## Workflow |
| 17 | + |
| 18 | +### 1. Request Information via GitHub CLI |
| 19 | + |
| 20 | +- **PR Details**: |
| 21 | + ```bash |
| 22 | + gh pr view <pr-number> --repo <owner/repo> --json title,body,author,state,headRefName,baseRefName,comments,reviews,files |
| 23 | + ``` |
| 24 | +- **Code Diff**: |
| 25 | + ```bash |
| 26 | + gh pr diff <pr-number> --repo <owner/repo> |
| 27 | + ``` |
| 28 | +- **Existing Inline Comments**: |
| 29 | + ```bash |
| 30 | + gh api repos/<owner/repo>/pulls/<pr-number>/comments |
| 31 | + ``` |
| 32 | +- **CI / Status Checks**: |
| 33 | + ```bash |
| 34 | + gh pr checks <pr-number> --repo <owner/repo> |
| 35 | + ``` |
| 36 | + |
| 37 | +### 2. Inspect Context & Prior Feedback |
| 38 | + |
| 39 | +- Read the PR description, linked issues, and full diff. |
| 40 | +- Verify whether existing bot or human comments have already been addressed in subsequent commits. |
| 41 | + |
| 42 | +### 3. Draft Review Comments |
| 43 | + |
| 44 | +- Keep comments direct, concise, and focused on code quality and correctness. |
| 45 | +- **Approvals**: Keep comments concise (`LGTM` or `A couple comments but lgtm.`). Avoid fluffy praise or re-summarizing the PR. |
| 46 | +- **Actionable Feedback**: Reference specific files, line numbers, and rationale when leaving suggestions. |
| 47 | + |
| 48 | +### 4. Present Draft & Post Only Upon User Approval |
| 49 | + |
| 50 | +> [!IMPORTANT] |
| 51 | +> **NEVER post comments or reviews to GitHub without explicit prior user approval.** |
| 52 | +
|
| 53 | +1. Present the drafted review comments to the user in your response window. |
| 54 | +2. Ask for confirmation: *"Would you like me to submit this review to GitHub?"* |
| 55 | +3. Once explicitly approved by the user, post the review: |
| 56 | + ```bash |
| 57 | + gh pr review <pr-number> --repo <owner/repo> --comment --body "<approved review text>" |
| 58 | + ``` |
0 commit comments