agentleFS
JaxsbrJaxsbr/sabs/skills/review-pr/SKILL.md

review-pr

Skill0 starsChanged 6 months agoMITView on GitHub

Reviews a GitHub pull request for correctness, security, design, and maintainability — posts inline comments or displays locally

185 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use diagnose-ci-failures, docs-loop and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • zerx-labSkill

    diagnose-ci-failures

    Diagnose CI failures for a PR using the GitHub CLI, extract error logs, and generate a plan to fix them. Use when the user asks to check CI status, pull CI issues, triage test failures, or investigate PR build failures.

    Also in 3 projects that use this

  • GeiserXSkill

    docs-loop

    Use when the user asks to audit docs, check documentation for stale claims, or verify docs against the code.

    Also in 3 projects that use this

  • GeiserXSkill

    full-loop

    Drive a repository to done with sergio-loop, then keep improving it with refine-loop at a descending theta. Use only when the user explicitly invokes full-loop.

    Also in 3 projects that use this

  • n24q02mSkill

    review-delta

    Review only changes since last commit using impact analysis. Token-efficient delta review with automatic blast-radius detection.

    Also in 3 projects that use this

  • n24q02mSkill

    build-graph

    Build or update the code review knowledge graph. Run this first to initialize, or let hooks keep it updated automatically.

    Also in 3 projects that use this

  • +7 more from GeiserX

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. 0 are common, 17 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 178 edited versions we read keep these.

  • 17

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the PR touches more than ~30 files, prioritise:

    line 78
  2. Very specific:

    Use the file list from gh pr view NUMBER --json files to sort by additions + deletions.

    line 86
  3. Distinctive:

    If the PR is too large to review meaningfully (100+ files with substantive logic changes), say so.

    line 88
  4. Distinctive:

    Before looking for problems:

    line 92
  5. Distinctive:

    Read the PR title, description, and commit messages to understand intent.

    line 94
  6. Distinctive:

    Read surrounding source code for files with non-trivial changes.

    line 96
  7. Distinctive:

    Do not start flagging issues until you understand what the author was trying to achieve and why.

    line 99
  8. Distinctive:

    If the PR description is empty or uninformative:

    line 101
  9. Distinctive:

    If intent remains unclear after reading the code, ask the user before proceeding.

    line 105
  10. Distinctive:

    If it works, is readable, and follows project conventions — don't comment.

    line 120
  11. Distinctive:

    Never auto-approve and never block for style alone.

    line 124
  12. Distinctive:

    Before posting anything (remote mode) or finalising (local mode), present findings:

    line 128
  13. Very specific:

    If auto=false (default): Wait for user confirmation before proceeding.

    line 150
  14. Distinctive:

    After confirmation, resolve OWNER, REPO, and the latest commit SHA:

    line 159
  15. Very specific:

    Default to COMMENT when unsure.

    line 174
  16. Very specific:

    If auto=true: Always use COMMENT regardless of findings.

    line 176
  17. Distinctive:

    After posting, confirm to the user what was posted and provide the PR URL.

    line 210
  18. Distinctive:

    If the user says "post it":

    line 220
  19. Distinctive:

    Do not re-analyse the diff.

    line 224
  20. Distinctive:

    Don't duplicate existing feedback: Check existing review threads before posting.

    line 229
  21. Distinctive:

    Check CI before reviewing: If CI is red, note it but don't spend time reviewing code that may change.

    line 230

“Common” is measured: kept by at least 6 in 10 of the 178 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- version: 3 -->

Review a GitHub pull request for correctness, security, design, and maintainability. Default mode is remote (posts comments to GitHub). Pass mode=local to display findings without posting.

Parameters

  • pr — PR number or URL (optional; auto-detected from current branch if omitted)
  • mode — remote (default) or local
  • auto — true or false (default false). When true, skip the operator confirmation gate (Step 4) and proceed directly to posting/displaying. Use COMMENT as the review event (never REQUEST_CHANGES or APPROVE without a human). Intended for build-loop autonomous invocation.
ModeBehaviour
remote (default)Full review -> post comments and submit review on GitHub
localSame analysis -> display findings in chat only, nothing posted

0. Identify the PR

Detect from context (current branch, parameter, or URL). Prefer:

gh pr view --json number,url,baseRefName,headRefName

Fall back to asking the user.

1. Fetch the diff and PR metadata

gh pr diff NUMBER
gh pr view NUMBER --json title,body,files,additions,deletions,commits,isDraft,headRefOid

Fetch existing review comments to avoid duplicating feedback:

gh api graphql -f query='
  query($owner:String!,$repo:String!,$pr:Int!) {
    repository(owner:$owner,name:$repo) {
      pullRequest(number:$pr) {
        reviewThreads(first:100) {
          pageInfo { hasNextPage endCursor }
          nodes {
            id
            isResolved
            isOutdated
            path
            line
            viewerCanResolve
            comments(first:30) {
              nodes {
                id
                databaseId
                body
                author { login }
                path
                line
                originalLine
                createdAt
              }
            }
          }
        }
      }
    }
  }' -f owner=OWNER -f repo=REPO -F pr=NUMBER

1.5. Scope the review (large PRs)

If the PR touches more than ~30 files, prioritise:

PriorityFile typeAction
DeepCore logic, security-sensitive, public API surfaces, files with complex diffsRead surrounding context, review line-by-line
ScanTests (verify they test the right thing), internal utilities, straightforward refactorsQuick read for obvious issues
SkimGenerated files, lockfiles, config/CI, docs, renames/movesSpot-check only; skip if mechanical

Use the file list from gh pr view NUMBER --json files to sort by additions + deletions. Start with the highest-churn non-generated files.

If the PR is too large to review meaningfully (100+ files with substantive logic changes), say so. Recommend the author split it, and offer to review a subset they nominate.

2. Understand the change

Before looking for problems:

  1. Read the PR title, description, and commit messages to understand intent.
  2. Scan the full diff to grasp the shape of the change.
  3. Read surrounding source code for files with non-trivial changes.
  4. Identify the type of change: feature, bugfix, refactor, config, docs, etc.

Do not start flagging issues until you understand what the author was trying to achieve and why.

If the PR description is empty or uninformative:

  1. Infer intent from commit messages and the diff itself.
  2. Note the gap in triage output: "PR has no description — review is based on code and commit messages only. Risk of misunderstanding intent."
  3. If intent remains unclear after reading the code, ask the user before proceeding.

3. Triage — pragmatic, not pedantic

Review changed files (using the priority order from step 1.5 for large PRs). For each potential finding, classify it:

CategoryWhen to flagExample
CriticalBugs, security holes, data loss, broken logic, missing error handling that will bite in productionRace condition, SQL injection, unchecked null on a critical path
ConcernDesign issues, maintainability risks, unclear intent, missing tests for important behaviourTight coupling, duplicated logic across files, ambiguous naming on a public API
NitStyle preference, minor naming, formatting — only flag if pervasive patternSingle inconsistent variable name (skip), systematic naming convention violation across the PR (flag)
SkipAcceptable as-is. Readable, works, follows project conventions — or too subjective to be worth raisingPreferring forEach over for...of, minor comment wording

Ground rules:

  • If it works, is readable, and follows project conventions — don't comment.
  • Challenge your own findings: "Would I mass-reject a PR over this?" If no, consider skipping.
  • Group related issues. Don't leave 5 comments about the same pattern — leave one with context.
  • Acknowledge what's done well when something is genuinely good.
  • Never auto-approve and never block for style alone.

4. Present triage for confirmation

Before posting anything (remote mode) or finalising (local mode), present findings:

## PR Review Triage — PR #123: <title>

**Critical (must fix):**
- `src/auth.ts:42` — JWT secret read from env without fallback; server crashes on missing var
- `src/db.ts:88-91` — Raw SQL interpolation -> SQL injection risk

**Concern (worth discussing):**
- `src/api/handler.ts:15-30` — New retry logic has no backoff; could hammer downstream service

**Nit (minor, pattern-level):**
- Inconsistent error message format across 4 new handlers (some use template literals, some concatenation)

**Positive:**
- Clean separation of validation logic into its own module
- Good test coverage on the happy path

**Skipped:** 3 minor style items — not worth comment noise.

If auto=false (default): Wait for user confirmation before proceeding. The user may reclassify findings, drop items, or add context.

If auto=true: Log the triage for auditability (include it in the PR summary comment later), then proceed immediately — do not wait for confirmation.

5a. Remote mode — post the review

After confirmation, resolve OWNER, REPO, and the latest commit SHA:

gh repo view --json owner,name --jq '"\(.owner.login) \(.name)"'
COMMIT_SHA=$(gh pr view NUMBER --json headRefOid --jq '.headRefOid')

Choose the review event based on confirmed findings:

FindingsEvent
Any Critical itemsREQUEST_CHANGES — only if user confirms
Only Concern / NitCOMMENT
Nothing to flagAPPROVE — only if user confirms

Default to COMMENT when unsure. Never auto-approve or auto-request-changes without user confirmation. For draft PRs, always use COMMENT regardless of findings.

If auto=true: Always use COMMENT regardless of findings. The operator reviews the PR after the autonomous cycle completes — they decide whether to request changes or approve.

Submit a single review with inline comments using --input -:

jq -n \
  --arg event "COMMENT" \
  --arg body "$(cat <<'BODY'
## Review summary

**Critical:** 2 items flagged (see inline)
**Concerns:** 1 item flagged (see inline)
**Overall:** Good direction, a few items to address before merge.
BODY
)" \
  --arg sha "$COMMIT_SHA" \
  '{
    event: $event,
    body: $body,
    commit_id: $sha,
    comments: [
      {path: "src/auth.ts", line: 42, side: "RIGHT",
       body: "**Critical:** JWT secret has no fallback — server will crash on missing env var. Consider a startup check or default."},
      {path: "src/db.ts", line: 91, side: "RIGHT", start_line: 88, start_side: "RIGHT",
       body: "**Critical:** Raw SQL interpolation -> SQL injection risk."}
    ]
  }' \
| gh api repos/OWNER/REPO/pulls/NUMBER/reviews --method POST --input -

For multi-line comments, include both start_line/start_side and line/side. Use the category prefix (Critical, Concern, Nit) in each comment body.

After posting, confirm to the user what was posted and provide the PR URL.

5b. Local mode — display only

Present the full review in chat using the same format as the triage in step 4, but with full comment bodies for each finding. Nothing is posted to GitHub.

End with:

Local review complete. Say "post it" to submit this review to GitHub (I'll confirm the event type first), or adjust findings.

If the user says "post it":

  1. Confirm the review event type (see event table in step 5a).
  2. Execute the remote posting flow from step 5a using the already-triaged findings.
  3. Do not re-analyse the diff.

Notes

  • Respect the author's context. They may know things you don't. Frame concerns as questions when uncertain: "Is there a reason this doesn't use...?"
  • Don't duplicate existing feedback. Check existing review threads before posting. If someone already raised it, skip or +1 briefly.
  • Check CI before reviewing. If CI is red, note it but don't spend time reviewing code that may change. Tell the user: "CI is failing — worth fixing that before a deep review."
  • Forks. gh pr diff and gh pr view work across forks transparently. The headRefOid from gh pr view is the correct commit for inline comments regardless of fork origin.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.