agentleFS
jonathascostajonathascosta/claude-code-workflow/.claude/skills/pr-review/SKILL.md

pr-review

Skill2 starsChanged 15 days agoMITView on GitHub

Review a GitHub pull request end to end - read what others already commented, run the Atlas (with context) and Spock (without context) reviewers, verify their findings against the diff, propose short review comments, and post them as one review only after the user's ok. Use when the user gives a pull request URL or number and asks to review it.

198 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use expert-reset, updates 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.
  • jtenniswoodSkill

    expert-reset

    Reimagine this repository from first principles using the current product and user experience as the target. Use when the user says "/expert-reset", asks how the project should be rebuilt if starting again, wants bold architecture or component-structure recommendations, or wants a research-only reset plan unconstrained by current implementation details.

    Also in 3 projects that use this

  • jtenniswoodSkill

    updates

    Summarize user-facing project updates from the last 7 days, ordered by importance and written as one-sentence "Feature: description" entries. Use when the user says "/updates", asks what changed recently, or wants a concise list of recent features, device support, fixes that users will notice, or other product value.

    Also in 3 projects that use this

  • openchamberSkill

    clack-cli-patterns

    Use when creating or modifying OpenChamber CLI commands, prompts, terminal output, non-TTY behavior, `--quiet`, or `--json` behavior.

    Also in 3 projects that use this

  • openchamberSkill

    drag-to-reorder

    Use when implementing or modifying OpenChamber sortable or drag-to-reorder behavior, especially `@dnd-kit`, touch/mobile interactions, variable-width items, or wrapping layouts.

    Also in 3 projects that use this

  • CES-LtdSkill

    oss-pr

    Use when creating a pull request, after committing changes, or when user invokes /oss-pr. Covers branch management, quality checks, commit, push, and PR creation.

    Also in 3 projects that use this

  • CES-LtdSkill

    pr-automation

    PR Automation Orchestrator: poll open PRs, check CI, run review, fix, and merge eligible PRs. Use when: (1) Invoked by daemon via scripts/pr-automation.sh, (2) User says "/pr-automation".

    Also in 3 projects that use this

  • +6 more from openchamber

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 4 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 181 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read-only: Never check out the PR, switch branches, stash, reset or pull.

    line 13
  2. Very specific:

    Run gh through the Bash tool, not PowerShell (PowerShell breaks --jq quoting).

    line 17
  3. Very specific:

    When the user gives bare numbers ("post 1, 2 and 4") and more than one review has proposed comments, ask which PR.

    line 31
  4. Distinctive:

    Read the ids from the file, not from memory of the conversation.

    line 32
  5. Distinctive:

    If the current directory is a clone of that repo (git remote get-url origin), fetch without touching the working tree and save the diff:

    line 46
  6. Distinctive:

    Keep the list of points already raised by others.

    line 56
  7. Very specific:

    If atlas/spock are not registered as agent types in the session, launch general-purpose agents with the body of .claude/agents/atlas.md / …

    line 68
  8. Very specific:

    Check that the line can carry a comment: it must be inside a diff hunk (git diff origin/<base>...origin/pr-$N -- <path> | grep '^@@').

    line 80
  9. Distinctive:

    Run the dry run first; post only the comments the user approved, for the PR they named.

    line 122

“Common” is measured: kept by at least 6 in 10 of the 181 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

PR review

Review the pull request in $ARGUMENTS. The user is a reviewer of someone else's change, on the same team as the author.

Rules that hold for the whole review

  • Read-only. Never check out the PR, switch branches, stash, reset or pull. Read the PR's files with git show <ref>:<path>. To run code, export a copy with git archive into the scratchpad and run it there.
  • Nothing reaches GitHub without an explicit ok for this PR, in this conversation. An ok to post the comments is not an ok to approve or to request changes.
  • Never repeat a point someone already raised, even if worded differently.
  • Talk to the user in their language. Everything written for GitHub is in the language project.md sets for artifacts, English unless it says otherwise.
  • Run gh through the Bash tool, not PowerShell (PowerShell breaks --jq quoting). Files written by Windows Python have CRLF: pipe lists through tr -d '\r' before using them in a shell loop.
  • Project context (what the system is, how to run its tests, team conventions) comes from .claude/project.md, the project's memory and CLAUDE.md, not from this skill.
  • The repository host is assumed to be GitHub.com, through the gh CLI.

Several reviews at once

Each PR has its own review file, and it is the only source of truth for that PR's comment numbers:

~/.claude/pr-reviews/<owner>__<repo>/pr<number>.json
  • A comment is always named <PR number>-<id>, for example 123-2. Show it that way to the user every time, never as a bare "2". If two open reviews share a PR number in different repos, add the repo's short name: web#4-2.
  • An id is permanent inside its file. It is never renumbered or reused: a dropped comment keeps its number, and a second round of review on the same PR continues the numbering.
  • When the user gives bare numbers ("post 1, 2 and 4") and more than one review has proposed comments, ask which PR. Never guess from the order of the conversation. post_review.py --status lists the open reviews and their pending ids.
  • Read the ids from the file, not from memory of the conversation; the conversation may have been summarized since.
  • The file lives outside the scratchpad on purpose, so it survives the session and can be used from another chat. Diffs, probes and other throwaway files stay in the scratchpad, in a folder per PR (<scratchpad>/<repo>-pr<number>/), with reviewer probe folders named per PR as well.

1. Gather

Work in <scratchpad>/<repo>-pr<number>/. With R=<owner>/<repo> and N=<number>:

gh pr view $N -R $R --json title,author,body,baseRefName,headRefName,headRefOid,additions,deletions,changedFiles,reviewDecision,files,statusCheckRollup
gh api repos/$R/pulls/$N/comments --paginate --jq '.[]|"\(.id) re:\(.in_reply_to_id) \(.user.login) \(.path):\(.line) \(.body|gsub("\n";" "))"'
gh api repos/$R/pulls/$N/reviews --paginate --jq '.[]|"\(.user.login) \(.state) \(.body|gsub("\n";" "))"'
gh api repos/$R/issues/$N/comments --paginate --jq '.[]|"\(.user.login) \(.body|gsub("\n";" "))"'

If the current directory is a clone of that repo (git remote get-url origin), fetch without touching the working tree and save the diff:

git fetch origin <base> +pull/$N/head:refs/remotes/origin/pr-$N      # the + lets it follow a force-push
mkdir -p <scratchpad>/<repo>-pr$N
git diff origin/<base>...origin/pr-$N > <scratchpad>/<repo>-pr$N/diff

Otherwise use gh pr diff $N -R $R and read files through gh api repos/$R/contents/<path>?ref=<head sha>.

Keep the list of points already raised by others; it is used in steps 2 and 4.

2. Review

Small change (roughly under 150 changed lines, or documentation only): review it yourself, reading the surrounding code.

Anything larger: launch atlas and spock in parallel, in the background, in one message. Keep the asymmetry between them:

  • Atlas gets: where the diff is, the goal of the change (from the PR description), the decisions and evidence the author states, what you know about the system from the project memory, the points other reviewers already raised (to skip), the specific risks you want checked, and the repo conventions.
  • Spock gets only: where the diff is. No goal, no description, no claims.
  • Both get: the read-only rule, how to run code on a git archive copy (and the project's test command, if known), their own probe folder (<scratchpad>/probes/atlas<N> and <scratchpad>/probes/spock<N>; create and delete files only there), "do not post anything to GitHub", and the report format: findings by severity, each with the path, the line number in the PR head version, a concrete failure scenario, and whether it was reproduced or only reasoned.

If atlas/spock are not registered as agent types in the session, launch general-purpose agents with the body of .claude/agents/atlas.md / spock.md inlined.

While they run, do not duplicate their read. Tell the user the review is running and what the PR is about. Never predict their results.

3. Verify and consolidate

The reviewers' reports are leads, not conclusions. For each finding:

  1. Open the cited line in the head version (git show origin/pr-$N:<path> | sed -n '<a>,<b>p') and confirm the code says what the finding claims. Correct the line number if it is off.
  2. Reproduce it when that is cheap (a probe on the archive copy, a unit test). Mark what stays "plausible".
  3. Drop it if someone already raised it; tell the user "already raised by X" instead.
  4. Drop style nits and anything without a concrete failure scenario.
  5. Check that the line can carry a comment: it must be inside a diff hunk (git diff origin/<base>...origin/pr-$N -- <path> | grep '^@@'). If it is not, anchor on the nearest changed line about the same thing, name the real path:line in the text, and tell the user it was moved.

Note where Atlas and Spock agree: a finding both reached independently is stronger.

4. Report to the user

In this order:

  1. The verdict in one or two sentences: can it be approved as is, and what is the most serious point.
  2. The findings worth a comment, most serious first: what goes wrong, in which situation, and how sure you are (reproduced or reasoned).
  3. The proposed comments, each under its name (123-1, 123-2, ...) with the path:line, and each in its own code fence so it can be copied raw. Style: English, short, a humble question rather than a verdict ("Question: could X happen when Y? ..."), with the exact path:line, and a suggested fix in one line when there is one. No ticket numbers, no people's names beyond the thread itself.
  4. What was checked and found sound, briefly, plus points left out because someone already raised them.
  5. Offer to post the comments, naming the PR. Wait for the answer.

Before showing the report, write the review file (~/.claude/pr-reviews/<owner>__<repo>/pr<N>.json) with exactly the comments shown, in the same order, so the numbers on screen and in the file are the same thing:

{
  "pr_url": "https://github.com/<owner>/<repo>/pull/<N>",
  "head": "<head sha reviewed>",
  "comments": [
    {"id": 1, "path": "src/module/file.py", "line": 42, "body": "Question: ...", "status": "proposed"}
  ]
}

If the file already exists (an earlier round on the same PR), keep its comments and append the new ones with the next ids. If the user edits a comment's wording, change the body in the file; if they reject one, set its status to dropped.

Usually three to five comments is the right size. Keep minor points in the report to the user and out of GitHub unless the user asks for them.

5. Post, only after the ok

From the Bash tool, with F=~/.claude/pr-reviews/<owner>__<repo>/pr<N>.json:

python .claude/skills/pr-review/scripts/post_review.py "$F" --only 1,2,4          # dry run
python .claude/skills/pr-review/scripts/post_review.py "$F" --only 1,2,4 --post   # send
python .claude/skills/pr-review/scripts/post_review.py --status                   # open reviews, pending ids

A dry run without --only shows every comment still proposed. With --post, the script requires --only, or --all to send every proposed comment, so a comment left over from an earlier round is never sent by accident. The script reads the PR from the file, so one PR's comments cannot be sent to another. It refuses to post when an id does not exist or was already posted or dropped, when the PR head moved since the review (re-check the lines first), or when a line is outside the diff. It sends the chosen comments as one review with event COMMENT, so the author gets a single notification, and then marks them posted in the file with the review link.

Run the dry run first; post only the comments the user approved, for the PR they named.

Afterwards, tell the user what was posted (by name) and give the review link.

When the author answers

When the user says the author replied or fixed the points, or asks to review the PR again, use the pr-recheck skill: it verifies each thread against the new code, reruns the tests, looks for new defects in what changed, and resolves the verified threads after the user's ok. Do not reply in the threads unless asked.

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.