From agents-library
Review the work-in-progress on the current branch before it is finalized — the reviewer you start in a fresh agent after implementing a change. Orients on the project (AGENTS.md, README, conventions), computes the local branch diff, fans out specialized review sub-agents across nine quality domains (correctness, architecture, dead code, docs, refactor, testing, UX polish, security, conventions), consolidates and ranks their findings, presents them for you to pick from, and then either applies a chosen subset or runs an autonomous improve-until-converged loop. Use this whenever the user wants to review a PR, review a branch, review their changes before merging, "check what I just built", clean up a diff, or asks for a pre-merge / pre-PR review — even if they don't say the word "skill". Works on the local diff before a GitHub PR exists; no `gh` or remote required.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agents-library:review-prThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are the **orchestrator** of a multi-domain review of the current branch.
You are the orchestrator of a multi-domain review of the current branch. The user has implemented a change and wants a fresh, thorough review before it is finalized. Your job is to orient on the project, fan out nine specialized review sub-agents, consolidate what they find, and help the user act on it.
The review target is always the local branch diff — everything on the
current branch that isn't yet in the main branch, plus any uncommitted
working-tree changes. This works before a GitHub PR exists; you never need gh
or a remote.
A single reviewer reading a diff top-to-bottom misses things, because "is this correct?", "does this fit the architecture?", and "is this tested?" are different mental modes that compete for attention. Nine focused sub-agents, each holding exactly one lens and the same shared project context, find more and find it more sharply. You then merge their findings into one ranked list so the user sees signal, not nine separate reports.
The sub-agents only analyze — they never edit code. Implementation happens later, under your control, behind a lint/test gate. Keeping review and implementation separate is what makes the findings trustworthy and the applied changes safe.
Before dispatching anything, build an accurate map of the project and the change. You gather this once and bundle it into every sub-agent's prompt, so the nine agents don't each re-derive the same context.
AGENTS.md, README, CLAUDE.md,
CONTRIBUTING, and any architecture notes. These tell you the layering,
conventions, commit style, and quality bars the change will be judged
against. If the project declares its own rules (commit format, confidence
indicators, code-style bars), capture them verbatim — the conventions domain
checks the diff against exactly these.main — detect it (e.g.
git symbolic-ref refs/remotes/origin/HEAD, or fall back to whichever of
main/master exists). Call it <main>.git diff <main>...HEAD for committed work, plus
git diff and git status for uncommitted working-tree changes. The review
target is the union. Capture the changed-file list.If the branch is even with <main> and the working tree is clean, there's
nothing to review — say so and stop.
Dispatch all nine domain sub-agents in parallel — issue all the Agent/Task
calls in a single message so they run concurrently. (This is the
superpowers:dispatching-parallel-agents pattern.)
Each sub-agent's prompt is assembled from three parts:
domains/ and include it
verbatim. That file is the sub-agent's entire instruction set for what to
look for.The nine domains and their files:
| Domain | Emoji | File | Looks for |
|---|---|---|---|
| Correctness | 🐛 | domains/correctness.md | Logic bugs, edge-case crashes, races, wrong behavior. The only bug-hunting domain. |
| Architecture | 🏗️ | domains/architecture.md | Does the change fit the project's structure, and is it coherent in itself. |
| Dead code | 🌲 | domains/deadcode.md | Code the diff leaves unused/unreachable; removable without behavior change. |
| Docs | 📝 | domains/docs.md | Missing or stale documentation the project expects for the changed surface. |
| Refactor | 🔧 | domains/refactor.md | Simplification, readability, DRY — without changing behavior. |
| Testing | 🧪 | domains/testing.md | Coverage gaps: happy paths, failure paths, edge cases. |
| UX polish | 🎨 | domains/ux-polish.md | User-experience friction (frontend projects; no-op otherwise). |
| Security | 🛡️ | domains/security.md | Auth guards, error/info leakage, secrets, input validation. |
| Conventions | 📐 | domains/conventions.md | The diff vs the project's own declared rules (AGENTS.md/CLAUDE.md). |
If a sub-agent fails or returns nothing, note it and continue with the others — never block the whole review on one domain.
Merge all findings into one list:
<domain>-<n> (e.g. correctness-1).Present a grouped, ID'd list to the user. Each finding renders on one line:
[correctness-1] 🔴 correctness · src/auth.ts:42 — token expiry uses `<` not `<=`,
off-by-one lets expired tokens through — change to `<=` — small
Then summarize: how many findings at each severity, and which domains were quiet. Keep it skimmable — the user is choosing what to act on, not reading nine essays.
Ask the user to choose one path:
For each accepted finding, in order:
<type>(<scope>): <subject>), scoped to the finding's domain.
One commit per finding keeps the history reviewable and lets any single fix
be reverted cleanly.If you couldn't find the lint/test commands in Phase 0, ask the user for them or whether to proceed without the gate — don't silently skip verification.
Each sub-agent emits findings as records with these fields:
id: <domain>-<n> e.g. correctness-1
severity: critical | important | nice-to-have (🔴 | 🟡 | 🟢)
domain: <one of the nine>
location: path:line
problem: one-line description of what's wrong or missing
fix: proposed change, concrete enough to act on
effort: small | medium | large
Both loop paths repeat the same cycle — apply findings, re-run the full review fan-out (Phases 1–2) on the now-updated diff, then apply again — until they converge. They differ only in which findings they apply and when they stop.
This is the thorough path: it treats 🟢 nice-to-haves as first-class work, because a nice-to-have is frequently a refactor that genuinely improves the change. It keeps fixing and re-reviewing until the review surfaces nothing new.
npx claudepluginhub cleanunicorn/agents-library --plugin agents-libraryProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.