Github pr review
Skill Bruno-Cunha-Souza/ValarMindSkills/skills/github-pr-review
A library of reusable skills for AI agents. Each skill/plugin is a Markdown file with YAML frontmatter that can be invoked as a slash command within Claude Code CLI or Antigravity IDE.
npx -y skills add Bruno-Cunha-Souza/ValarMindSkills --skill github-pr-reviewAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Structured GitHub PR review — correctness, security, performance, maintainability. Severity-ranked findings + verdict (Approve/Request Changes/Comment). Non-PR: @code-review. Triggers: 'review PR', 'revisar PR', 'analisar pull request', '/github-pr-review'.
SKILL.md
8.9 KB, as published. Nobody here has run it
Pull Request Code Review
Structured GitHub PR review with severity-ranked, citation-bound findings and a clear verdict.
Goal
Structured code review of a GitHub Pull Request — correctness, security, performance, maintainability. Findings ranked by severity, each tied to a verbatim diff citation, plus a verdict (Approve / Request Changes / Comment).
When to Use
- The user names a PR by number, URL, or branch and asks for a review.
- The user asks for "feedback", "thoughts", or "concerns" on a pull request.
- The user explicitly invokes
/github-pr-reviewor/valarmindskills:github-pr-review.
Do not use when
- The user asks about code-review methodology, not a specific GitHub PR → use
@code-review. - The user wants to author a commit or PR description, not review one → use
@github-commitor@github-release-note. - The PR contains no code diff (docs only, lockfile bumps, config-only) and the user wants security/perf analysis — refuse with
out of scope: no code diff to analyzeand hand off.
Inputs you must collect before starting
| Input | Required | How to obtain |
|---|---|---|
| PR identifier | Yes | Number, URL, or branch name; ask if missing |
| Repository | Yes | Infer from current directory; ask if ambiguous |
| Review depth | No | quick (high-level) or deep (line-by-line) — default: deep |
Procedure
Step 1 — Fetch PR metadata
gh pr view <number> --json title,body,author,baseRefName,headRefName,files,additions,deletions,commits,labels,state,isDraft
Record: title, author, base/head branch, files changed, lines added/removed, commits, state (open/closed/merged), draft flag.
If state != "OPEN" or isDraft == true, warn the user and ask whether to continue. Do not refuse — historical reviews are valid use cases.
Step 2 — Get the full diff
gh pr diff <number>
If the PR has more than 1000 changed lines, inform the user and ask whether to (a) continue full review, (b) prioritize a file subset, or (c) abort. Do not silently truncate.
Step 3 — Read description and linked issues
- Read the PR description for context and intent.
- Look up linked issues via
gh issue view <number>forCloses #N,Fixes #N,Refs #N. - Identify acceptance criteria, if any.
Step 4 — Analyze the changes
Analyze the diff across four dimensions. Only review changed code — not surrounding unchanged code.
Logic & Correctness
- Business requirements met?
- Edge cases (null, empty, boundaries, concurrency)?
- Error flows correct?
- Loop / recursion termination?
- Type consistency?
Security
- Inputs validated and sanitized?
- Injection risk (SQL, XSS, command, SSRF, path traversal)?
- AuthN / AuthZ checks?
- Sensitive data exposure (logs, responses, env)?
- OWASP Top 10 alignment?
Performance
- N+1 queries or inefficient DB access?
- Unbounded iteration?
- Allocation in hot loops?
- Algorithmic complexity vs. expected volume?
- Blocking calls where async fits?
Maintainability
- Naming clarity (variables, functions, classes)?
- Single responsibility, function size?
- Module coupling?
- Test coverage for the changes?
- Style consistency with the rest of the codebase?
Step 5 — Categorize each finding
Each finding must include Severity, Confidence, and a verbatim citation:
| Severity | Criteria |
|---|---|
| Critical | Crash, data loss, exploitable vulnerability, breaks existing functionality |
| Major | Bug in a likely scenario, significant performance issue, important standard violation |
| Minor | Recommended improvement, readability impact, incomplete error handling |
| Nitpick | Stylistic or naming suggestion — does not block approval |
| Confidence | Meaning |
|---|---|
| High | Mechanical evidence in the diff; reasoning is deterministic |
| Medium | Pattern matches but intent may justify it — flag for author |
| Low | A second opinion would change the verdict — escalate or downgrade |
Citation requirement. Cite path:line AND quote the exact code (3–8 lines from the diff). A finding without both is rejected. Never paraphrase the code; never invent paths, line numbers, or function names.
Step 6 — Write the executive summary
2–4 sentences with:
- What the PR does (paraphrased from the diff, not the description).
- Quality assessment.
- Key concerns, if any.
- Verdict: Approve, Request Changes, or Comment.
The verdict must match the highest finding severity:
- Any
CriticalorMajor→Request Changes. - Only
Minor/Nitpick→CommentorApprove(author discretion). - Zero findings after Step 8 verification →
ApprovewithLGTM.
Step 7 — Present the review
Follow the template in EXAMPLE.md. For zero-findings PRs, follow the LGTM template in the same file.
If the user explicitly approves, publish via:
gh pr review <number> --approve --body "<message>"
gh pr review <number> --request-changes --body "<message>"
gh pr review <number> --comment --body "<message>"
Never publish without explicit user approval — one approval is scoped to one publish action.
Step 8 — Verify before presenting
Before returning the review, check:
- Every cited
path:lineappears in the diff from Step 2. - Every code quote is verbatim from the diff (no paraphrase, no fabricated lines).
- Every finding has a
Severityand aConfidencefield. - The verdict in the executive summary matches the highest finding severity per Step 6.
- If zero findings, the output uses the
LGTMtemplate — not a synthesized Minor. - No finding was promoted from Minor to Major to fill the report.
If any check fails, repair before returning.
Refusal hooks
- Out of scope (non-code PR): if the PR is docs-only, lockfile-only, or config-only and the user asked for security / performance analysis, respond
out of scope: no code diff to analyze — switching to <appropriate skill>and hand off. - Ambiguous PR identifier: if multiple PRs match (e.g., a branch name with multiple open PRs), ask exactly one clarifying question listing the candidates, then stop.
- Base branch missing locally: if
gh pr difffails because the base ref is not fetched, requestgit fetch <remote> <base>from the user and stop. - Publish without approval: never call
gh pr review --approve|--request-changes|--commentwithout an explicit, in-conversation approval scoped to that PR.
Constraints
- Only review changed code — do not review surrounding unchanged code.
- Do not assume context not visible in the diff; read referenced files via
Readto understand the change, but do not flag them. - Be constructive — propose a fix alongside every finding.
- Prioritize by severity; do not bury Critical issues under Nitpicks.
- Cite
path:lineAND a verbatim 3–8 line code quote per finding. Never invent paths, line numbers, function names, CVE IDs, or RFC numbers. - Never fabricate findings to fill the report. Zero findings is a valid outcome — emit the
LGTMtemplate and stop. - Never promote a Minor to Major to look thorough. Severity is bound to impact × likelihood, not to report length.
- If the PR is > 1000 lines, ask before proceeding (Step 2).
- Never publish the review on GitHub without explicit, scoped user approval.
Output format
Structured review following the template in EXAMPLE.md:
- Executive summary (2–4 sentences) ending with the verdict.
- Findings grouped by severity (Critical → Major → Minor → Nitpick), each with
Confidence,path:line, code quote, suggested fix. - Summary by severity table.
- Zero-findings path:
LGTMtemplate fromEXAMPLE.md.
Example request
- "Review PR #42"
- "Analyze this pull request: https://github.com/org/repo/pull/123"
- "Do a quick review of the payment feature PR"
- "Revisar PR #87 desse repo"
- "Feedback no PR mais recente"
Related Skills
@code-review— lifecycle code-review skill (multi-language Go/Rust/TS). Use when the user wants methodology-driven review not tied to a GitHub PR (audit, pre-merge gate, refactor review).@code-debugger— when a finding here uncovers a runtime bug that needs root-cause analysis.@github-commit— when the review concludesApproveand the user wants to author the merge commit.@code-security-review— hand off security findings into a stack-aware audit (Go branch —references/golang/; Next branch —references/nextjs/).
References
| File | Purpose |
|---|---|
| EXAMPLE.md | Worked review (Request Changes) + zero-findings (Approve / LGTM) template |