Skip to content
Development
Command

/review

Review PRs against the conventions learned from each repo — 1 post per PR, findings tagged by severity, code left untouched.

From plugin
open-pr
426 skills6 commands
Install
> /plugin marketplace add TOMOSIA-VIETNAM/open-pr
> /plugin install open-pr@open-pr

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/review

Context preview

What this command does when you run it.

Review PRs against the conventions learned from each repo — 1 post per PR, findings tagged by severity, code left untouched.

Command definition

review.md
argument-hint: "<PR URL> [other PR URL...] [content]"
description: Review PRs against the conventions learned from each repo — 1 post per PR, findings tagged by severity, code left untouched.

> **CRITICAL:** `Read` `"${CLAUDE_PLUGIN_ROOT}"/core/guardrails.md` and `core/cli.md` FIRST — shared > rules + the `<op>` runtime, not repeated here. `<op>` ≡ `sh "${CLAUDE_PLUGIN_ROOT}"/bin/open-pr.sh`, > exactly as THIS line spells it — no env var exists in the shell. On top of those: > - Read-only on the reviewed repo; the only write is Step 9's 1 review (+ 1 more on a submodule PR > when Step 1 detects a bump). FORBIDDEN: close/merge/reopen, create/delete/switch a branch, push, > edit code → mention it in the review instead. > - The worktree may surface the REVIEWED repo's own `.claude/skills/` — its dev workflow, not a > review tool. FORBIDDEN: invoking it, even when listed as available.

Step 0 — Target

`<op> target <url>` → `vendor/owner/repo/pull_number/host`; exit 4 or no URL → print:

❌ Error: No PR URL provided.
Usage: /open-pr:review <PR URL>
Example (GitHub): /open-pr:review https://github.com/org/repo/pull/123
Example (GitLab): /open-pr:review https://gitlab.com/org/repo/-/merge_requests/123

`Read` `"${CLAUDE_PLUGIN_ROOT}"/core/pr-target.md` — vendor reconciliation, `<repo>`, free-form-text rule, empty-"PR info" stop. A language instruction in `ARGUMENTS`/chat overrides `.shared.output_language`, this run only.

**≥2 valid PR URLs** && the intent isn't already clear from `ARGUMENTS`/chat → ask "Found N PRs — review all N or just the first?", WAIT (extras may be reference-only). Confirmed multi-PR → run Step 0 → Step 9 to COMPLETION per URL, SEQUENTIALLY, each with its own worktree/memory/post. FORBIDDEN: parallel, subagent. `[content]` applies to every PR. All done → 1 chat summary, 1 line per PR, shaped by Step 9's reporting rule; nothing further posted.

Context

`<op> settings --repo <repo>` → this run's resolved config (`core/repo-settings.md` names what each field means). `<vendor>` MUST be reconciled (`core/pr-target.md` §2) BEFORE the next call. Then ONE call fetches everything — `<op> context` with `--max-patch-bytes` = `big_file_threshold_kb` × 1024; its `## <label>` sections are what later Steps name. Any path "Diff size per file" lists that "Diff" lacks is an omitted file → carry to Step 7 as **"Oversized paths"**. "CI checks" stays unfiltered — Step 7 and `setup/bootstrap.md` q6 each read the raw list.

**Filesystem:** `<op> locate-repo` → `<repo_dir>`; exit 5 → ask with a CHOICE in plain language — name the N directories found and why each might be it — STOP if unresolved. FORBIDDEN: `cd`. Everything this command writes — `notebooks/review/<repo>/`, the worktree, `.gitignore` — is relative to pwd: 1 workspace ⇒ 1 `notebooks/review/` for every repo reviewed from it. Before writing under `notebooks/review/` → state pwd + `<repo>` in chat. No `notebooks/review/` line in `.gitignore` at pwd → add exactly that line.

Step 1 — Ephemeral worktree

`<op> checkout` with `--head-sha` = "Head SHA", `--base` = `baseRefName`, `--repo-dir <repo_dir>` → `worktree=<path>`; PR code on disk, main tree untouched, gated to the commit the "Diff" was read at. `Read`/`Grep` at `<worktree>/<path>`. Exit 2 ⇒ STOP, print both SHAs + `<worktree>` and that `/open-pr:clean` removes it. Exit 3 ⇒ STOP with its stderr. FORBIDDEN: retrying past the script's own retry, or comparing against a freshly fetched SHA — that hides the stale diff.

Then try `Read`ing `<worktree>/.gitmodules` — every run, never cached. Exists && "Diff" carries `Subproject commit` → `Read` `"${CLAUDE_PLUGIN_ROOT}"/cases/submodule-review.md`.

Step 2 — Detect stack

`<op> stacks --repo-dir <repo_dir> <every "Files" path>` → keep the `(file, stacks)` mapping for Steps 4-7; judge `.md` lines per `core/cli.md`.

Step 3 — Setup / doctor

From the Context `settings` call: resolve `chat_language` per `core/repo-settings.md`; `doctor_due` is already computed. `<vendor>` is already reconciled, never re-asked. Persisting it:

  • about to bootstrap → q1's pre-marked default, `setup/bootstrap.md` writes it
  • bootstrapped, field predates this schema → read-time value only. FORBIDDEN: writing it back

(`/open-pr:upgrade` owns that backfill); a confirmed mismatch was already persisted at §2

Branch:

  • no file || no `.review` || `.review.bootstrapped` != `true` → `Read`

`"${CLAUDE_PLUGIN_ROOT}"/setup/bootstrap.md`, then `setup/doctor.md`

  • `bootstrapped: true` && `doctor_due` → `setup/doctor.md` only, FORBIDDEN: re-asking bootstrap
  • `bootstrapped: true`, `doctor_due` false → skip both

Setup stable ⇒ don't touch `notebooks/review/` outside Step 4 (new template), Step 6 (lesson), or a due doctor.

Step 4 — Local template per stack

Each Step 2 stack absent from `.review.templates_copied` → `Read` `"${CLAUDE_PLUGIN_ROOT}"/setup/template.md`, follow it. Present → use `notebooks/review/<repo>/templates/<stack>.md`. Runs every time: a new stack can appear post-bootstrap.

Step 5 — Load the criteria

`Read` `"${CLAUDE_PLUGIN_ROOT}"/core/review-criteria.md`; load every layer it names for Step 2's stacks.

Step 6 — Re-review

"Old comments" non-empty → `Read` `"${CLAUDE_PLUGIN_ROOT}"/cases/re-review.md`; it also gates whether Step 8/9 post at all. Empty (brand-new PR) → skip to Step 7.

Step 7 — Review

**Large-diff guard, before anything else here:** count("Files") > `many_files_threshold` || "Oversized paths" (Context) non-empty || any "Diff size per file" entry > `big_file_threshold_kb` KB or `UNKNOWN` → `Read` `"${CLAUDE_PLUGIN_ROOT}"/cases/large-diff-guards.md`, follow it (it may STOP the command). Neither → proceed.

**Overview items** — never counted toward N, never entered into `comments[]`:

  • title/body vague on business context → note it atop the Step 8 overview, suggest the dev add detail.

FORBIDDEN: writing it for them.

  • `headRefName` carries a ticket code but the title lacks a matchin
Read more
Ships withopen-pr

AI code review that lands on the PR, not in your terminal — GitHub, GitLab, Bitbucket. Learns each repo's conventions: 1 review, 1 fix commit, replies in thread. Claude Code · Cursor · Codex · Gemini CLI · Antigravity.

Get the whole plugin
Stats
44
Stars
17
Forks
Active
Maintenance
Python
Language
MIT
License
5h ago
Last commit
2mo ago
Created

Repo: TOMOSIA-VIETNAM/open-pr

Other commands on open-pr.