# Review Pr

> Annai review — PR mode

- Skill: `asermax/review-pr` (Agent Skill)
- Install (CLI): `npx skillmds@latest add asermax/review-pr`
- Raw SKILL.md: https://api.skillmd.com/api/skills/asermax/review-pr/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: asermax (https://skillmd.com/u/asermax)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/asermax/review-pr

---


# Annai review — PR mode

Entry point for reviewing a GitHub pull request. The mode-specific steps are inlined below; for everything else (surface authoring rules, launch, watch, react, cleanup) load the `annai:review` skill — it owns the shared procedure. When the shared procedure says "this step is mode-specific", come back here.

## Step 1 — Determine PR + repo path

- The user's invocation gives you either a PR URL, a PR number, or "the current branch".
- Resolve the local repo path. If the user gave a URL or unclear identifier, ask: "Which local clone should I use?" — diff reconstruction and full-file expansion need it.
- Use `gh pr view <id> --json number,title,url,headRefName,baseRefName,additions,deletions,changedFiles` to confirm PR metadata exists and you can read it. The scaffold step re-runs this for you; you don't need to plumb the JSON through by hand.
- Use `gh pr diff <id>` if you want to skim before scaffolding; otherwise let `surface scaffold` fetch it.

## Step 3a — Scaffold

```bash
"${CLAUDE_PLUGIN_ROOT}/skills/review/scripts/annai.sh" surface scaffold \
  --pr <n> --repo <path-or-slug> --out <session-dir>/surface.json
```

`--repo` accepts either a GitHub `OWNER/REPO` slug **or** a local clone path (the slug is resolved via `gh repo view` inside that directory). The local path goes into `surface.repo.path` so the daemon can find the working tree.

Fetches PR metadata via `gh pr view`, parses every file's hunks from `gh pr diff`, and writes a schema-valid skeleton with `subject: { kind: 'pr', ... }`, one `unsorted` supporting group containing every changed file, and empty `tldr` / `reviewPrompts` / `diagrams` / per-diff `annotations` / `suggestions`. Each diff gets a stable id like `diff-src-foo-ts` you'll reference in later commands.

## Step 5 — Finish-line message

When you tell the user the surface URL, end with:

> Draft comments inline / per-file / at the PR level, then hit Approve or Comment when you're ready, or Dismiss session if you want to bail. I'll push the review to GitHub once you submit.

## Step 7 — Submit the review

On `review-submitted`:

```bash
"${CLAUDE_PLUGIN_ROOT}/skills/review/scripts/annai.sh" submit \
  --session "<session-id>"
```

`submit` fetches the result via IPC, queries the PR's node id + head commit OID via `gh api graphql`, runs `addPullRequestReview` (line + range threads + PR body), runs `addPullRequestReviewThread` once per file-level draft (`subjectType: FILE`), then `submitPullRequestReview` with the matching event. Output is a single JSON line:

```json
{"sessionId":"…","reviewUrl":"https://github.com/…/pull/…#pullrequestreview-…","state":"APPROVED","decision":"approve","commentCount":4}
```

Report the URL to the user.

