CommunityCoding & Developmentgithub.com

review-pr

Review a pull request end to end. Use when asked to review a PR or prepare review feedback.

What is review-pr?

review-pr is a Claude Code agent skill that review a pull request end to end. Use when asked to review a PR or prepare review feedback.

Works with✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/luainkernel/harness/tree/HEAD/.agents/skills/review-pr

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

The process is process.md beside this card — before the verdict, findings, fixups, comments, after a round. Follow it whole; this card is only the GitHub mechanics.

Reading and driving the branch

  • git fetch origin +pull/<N>/head:review/<N> brings the author's head; the + takes a head a squash or a rebase rewrote, which a plain fetch declines without a word, so the fetched SHA is checked against gh api repos/.../pulls/<N> --jq .head.sha before anything is diffed. Check it out in a worktree of its own (git worktree add <scratch>/w<N> review/<N>, then git submodule update --init), since a worktree named for a task may be another session's; build and run it as the project's AGENTS.md asks, the lunatik-cycle skill in Lunatik. The worktree goes when the review is posted, unless the launching session asked to keep it: rm -rf <tree> && git worktree prune, since git worktree remove refuses one with submodules, and each one left behind carries a build on a disk the sessions share.
  • Read the pull request through the REST API, which needs no read:org scope. The spellings below assume the gh CLI; where the machine has none, the same call is curl -sS -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/<path>", and review.js takes gh: false to write them that way. gh api repos/<owner>/<repo>/pulls/<N> for the PR, of the repository the checkout's origin names, gh api repos/.../issues/<N>/comments and gh api repos/.../pulls/<N>/comments for the conversation, gh api -X PATCH repos/.../pulls/<N> -f title=... -F body=@file to edit.

Before the verdict

  • Write the matrix the change is held to: for each guard or mechanism it adds, the operations by types by outcomes, and read the tests against it, cell by cell. A test set taken as given because it came with the branch, or with the branch a rewrite replaces, is the review not done. A cell the suite leaves uncovered and the review does not fill leaves as an issue, and the review body carries its number.
  • Run the passes, not only the rules: the simplification pass over every field, helper, wrapper and comment the diff adds (what does it buy over the minimal shape), the shape pass grepping the file's siblings for the form the tree uses, and, for a guard or a primitive added to shared code, Lunatik's core among it, the sweep over every caller with the same shape. Each pass is its own read of the diff; the first round of #848 and #849 ran the rules and left all three for a second.
  • The body closes what the pull request finishes: Closes #<phase issue> for a phase of an epic, or #<epic>, which it does not close. bash tools/checks/pr-body.sh <body> <changed files> fails one that ties itself to an issue and does neither; the ten bodies of the fsnotify stack did, and its phase issues stayed open after every merge.

Fixups

  • One finding in the working tree at a time: edit, commit, next. Two findings edited together are told apart afterwards by a reset and a cherry-pick, which is where a hunk lands in the wrong fixup.
  • bash tools/checks/advisory.sh origin/master HEAD, the heuristic checks of the harness and those the project's .agents/harness.conf names over the files and the commits of the branch, CHECK_BASE=origin/master bash tools/checks/lua-style.sh over its Lua files and bash tools/checks/author-email.sh origin/master..HEAD over the branch are passes of the first round, not of the second: #850's maintainer asked for the argcheck, the lunatik_try and the shared helper the first round had read past, and #618's for the dispatch and the route spelled once that a review calling it ready had read past.
  • A fixup is made on review/<N> and pushed onto the pull request's branch, a fast-forward: git push <url> HEAD:refs/heads/<branch>; then gh api repos/.../pulls/<N>/commits is what says it is on the pull request, since the pull request lists that branch alone. review/<N> left on its own is invisible there. The push is a command of its own, never chained after a rebase: one that stops on a conflict leaves HEAD on the base, and the push publishes that; push-guard.sh refuses it.
  • Answer a maintainer's comment in its thread, gh api -X POST repos/.../pulls/<N>/comments -F in_reply_to=<comment id> -F body=@file, quoting the line it answers.

Reviewing as an agent that can die

A review that lives only in one agent's context is lost the moment the provider drops that agent, and a long one is dropped often enough to plan for it. The rules below, and review.js beside this card is the workflow that follows them (Workflow({scriptPath: '.agents/skills/review-pr/review.js', args})):

  • Findings go to a checkpoint file as they close, one line each (file:line | what | disposition), not to the final message; the message is assembled from the file, and a successor reads the file first and continues from it instead of reading the branch again.
  • A finding a phase leaves as an issue goes in its answer's findings_left too, a title and a body that can be filed as they stand, its severity and the open issue it belongs to where there is one; review.js returns them together, so they are filed from its answer and not copied out of the checkpoint.
  • A review is phases, not one agent: a reviewer, then a build. The reviewer reads first what tools/review-packet.sh gathers, the commits, the files, every check's lines over the change and the diff with each function it touches whole, and answers each check's line; the build runs in the lunatik-host agent, which loads no CLAUDE.md, so args.machine says how this machine gets root. Between them the lunatik-reader agent reads the title and the body the run returns, with none of the change's history, and the run is ready only on the ones it passed. Each phase returns a schema, so a crash loses one phase and the cache replays the ones that completed under resumeFromRunId.
  • A head the suite already passed is not built again by the review: the totals, the core srcversion and the examples run on it go in the briefing (args.validated), and the build phase runs only when a fixup changed a file the build, the install or the suite reads, or an example the change touches (the project's tools/checks/examples-touched.sh over the changed files, where it has one, passed as args.examples) is not among them. The suite is not the examples, and an example is the binding at the rate a user drives it. A first build, with no head validated, asks tools/checks/functional.sh over the branch against its base, and runs nothing, the examples included, when it names no file. The check reads what this tree's suite reads, so it skips no run args.build spells.
  • A phase writes its own answer back into the checkpoint before it returns, not only the findings as it closes them, so an agent dropped between its last tool call and the runner's record still leaves the verdict on disk.
  • A fixup is a commit before it is anything else. Where the host refuses a push from an agent (args.push: false), it stays a commit on review-<name>-<pr>-fixups and the session that launched the review pushes it, naming the SHAs the phase reported. A refused command is written down and not tried again.
  • args.github names the repository the threads are read from, with no default, so a review of one project never reads the other's threads, and args.mount where the checkout mounts the harness, whose scripts the phases run. What the reviewer and the build do of the project's own, its kernel readings, its contract, its build and its suite, they do as the project's AGENTS.md asks, which the prompts say in a clause and restate none of; the build's agent, which loads no CLAUDE.md, reads the file in its worktree. A pull request of a repository that carries no harness is reviewed the same way, with args.packet this tree's tools/review-packet.sh by its absolute path, and args.build what its host run is, or false where nothing runs on the host.

What a dead run left is read before it is launched again: <transcriptDir>/journal.jsonl carries a result line for every phase that finished, the checkpoints carry what each one wrote, and the fixup branches carry the commits. Editing only the failing unit's arguments in the persisted script and relaunching with resumeFromRunId replays the rest from the cache; a phase that completed is not run again to be safe, which is the cost the checkpoint exists to avoid.

A live run is not stopped to make way for a merge or a restack: a reviewer writes its findings as it closes them, so one stopped while it reads takes its reading with it, and the run launched after pays it again. The restack waits for the run's answer, and an approval the maintainer gives meanwhile is merged after it. #2189's first review was stopped this way, an empty checkpoint and some 25 thousand tokens of reading gone, and the maintainer asked for the review back.

A fan-out of agents is bounded before it is launched, not after: one unit as a pilot and timed, a wall-clock cap, and an inactivity monitor over the agents' own logs, tools/workflow-watch.sh as a Monitor's command, with the launching session left idle so it can stop them. Report what a run cost before launching another, since the workflow runner restarts an agent from zero on a provider error and nothing else counts the restarts. What the reviews catch is read with tools/review-stat.sh: the commits and the comments each reviewed pull request still took after its label.

Posting the review (only when asked; placement is decided BEFORE posting)

Each finding goes inline on its line; the review body is only the verdict, opening with the author's @handle (process.md, "Comments and the verdict"). The posting account authors the pull requests here, and GitHub answers 422 to APPROVE or REQUEST_CHANGES on one's own, so event is COMMENT and the verdict is the body's first line. Because that account is the maintainer's, every text an agent posts under it, the body and each inline comment, opens with GitHub's note, > [!NOTE] and > This review was written by an LLM, not a human. (comment in an inline comment or a reply), then a blank line, so a reader knows who wrote the words. tools/checks/review-post-guard.sh refuses a post whose body or inline comment lacks that note, and, on a pull request the posting account did not open, one that lacks REVIEW_POST_OK=1: there, show the exact text, get the OK, then prefix the marker to the command. On a pull request the account opened, the maintainer's own, the review he asked for is posted as written; the guard reads the author from GitHub with the credential the command carries.

  • Review with inline comments in one shot: gh api -X POST repos/.../pulls/<N>/reviews -f commit_id=<head sha> -f event=COMMENT -F body=@<verdict> with a JSON comments array (path, line, side: "RIGHT", body) — build the payload with --input file.json. GitHub resolves each line against the diff of commit_id, so a line only a fixup touches anchors at the head, not at the author's commit: the review of #969 answered 422 "Line could not be resolved" at the author's commit for a README row its fixup had changed.
  • A failure the branch's suite showed is in the journal before it is in the review (sudo bash tools/journal.sh "<the test's print>"); the review names the mechanism or the hypothesis, and review-post-guard.sh refuses the word that skips both.
  • A single inline comment after the fact: gh api -X POST repos/.../pulls/<N>/comments -f commit_id=<head sha> -f path=... -F line=... -f side=RIGHT -F body=@file.
  • Fix a submitted review's body: gh api -X PUT repos/.../pulls/<N>/reviews/<id> -F body=@file.
  • A submitted review cannot be deleted, only dismissed. Getting the placement wrong means editing the body down to the verdict and re-posting each finding inline — rework, not repair.
  • Once the review is posted, label the pull request as read end to end: gh api -X POST repos/.../issues/<N>/labels -f 'labels[]=workflow-reviewed'; tools/pr-status.sh reads that label as the sign that someone read it. One whose complexity: label is not the one bash tools/complexity.sh <N> prints, since the review's fixups moved it or since it carries none, takes that one in the same call, and the old one is removed (AGENTS.md, Patches and commits).

After the merge

When the maintainer reports a merge, run GH_TOKEN=... bash tools/issues.sh <epic> over the epic the pull request is part of, or over the issue it answers, and hand him, in the same message, what the merge closed, what stays open and what the report flags. What the merge finished and GitHub left open, an issue the pull request named without a closing keyword or an epic whose issues are all closed, the session closes, with a comment that says what finished it; the board moves the card.

Related Skills