Skip to content
Back to skills

Review Pr

ASecurity

First-pass PR review by fresh subagents, at the depth the change's risk tier calls for (a security reviewer only on high tier); each reviewer's report rendered and posted as a comment-only review, with your verification as a note.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 27, 2026
ai-agentspythongitapibackendsecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned November 27, 2026

npx -y skills add rpvsilva/dotagents --skill review-pr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Review Pr?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Review Pr
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/rpvsilva-review-pr/badge)](https://www.skillsdirectory.com/skills/rpvsilva-review-pr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: review-pr
description: First-pass PR review by fresh subagents, at the depth the change's risk tier calls for (a security reviewer only on high tier); each reviewer's report rendered and posted as a comment-only review, with your verification as a note.
disable-model-invocation: true
---

Give a PR its first review before a human looks: a fresh reviewer finds problems and saves its output (an object in the [Protocol](../_shared/conventions.md#protocol)), you **verify** each finding, and a script posts the output rendered, with your verdicts in a note under it. The review is always comment-only: approval belongs to a human.

Input: the PR number. Optional: `--dry-run` to show the findings without posting; `--mode <mode>`, the review's depth (default `ticket`); `--base <ref>`, what the change is reviewed against (default `origin/<the PR's base branch>`; for `re-review`, the head last reviewed); `--run <run>`, a `build-epic` run folder, whose `decisions.md`, `ci:` line and `map.md` Checks the reviewers read; `--decisions <path>`, the run's decisions file (a `build-epic` run's `decisions.md`: which of the repo's leave-for-human rules the human waived, and their verbatim decisions), when it is not `<run>/decisions.md` or there is no `--run`; and the files a mode needs, below.

**Modes**, each the reviewer's input `mode` (for `security`, its `scope: pr`), rendered by `review_prompt.py` (step 3); the brief says what each asks:

| Mode | Reviews | Reviewer | Needs |
|---|---|---|---|
| `task` | one task PR, against its base; with no PR, a task's own commits before they merge (build-epic's high-tier tasks, reviewed here, never remotely) | PR | `--task <file>` optional; required with no `--pr` |
| `ticket` | the whole PR, once and in depth | PR | `--task <file>` optional (the ticket file) |
| `re-review` | only the diff since the head last reviewed (`--base`), checking a numbered list of earlier findings | PR | `--findings <file>` |
| `security` | the PR for security, beside a `ticket` review of a high-tier change | security | `--task <file>` optional (the ticket file) |

## Steps

1. **Learn the rules** ([how](../_shared/conventions.md#learn-the-rules); notes file `.agents/review-pr-notes.md`). Done when you know which files hold the repo's rules and which identity to post as.

2. **Check out the PR head** in its own git worktree: `git fetch origin pull/<n>/head && git worktree add --detach <path> FETCH_HEAD`. Done when the worktree's HEAD matches `gh pr view <n> --json headRefOid`.

3. **Start the reviewers**, each a subagent with a fresh context, in parallel. Each writes its output to `<run>/reviews/`, `<run>` the `--run` folder. Without `--run`, make a scratch one for the outputs and the posting log: `python3 -I ../build-epic/scripts/init_run.py <new empty folder> <repo>` (`OK run initialised ...`); pass it to the scripts below as `<run>`, but never as `--run` to `review_prompt.py`, since it holds no `decisions.md` or `map.md`.
   - **Tier the change**, in `ticket` mode: `python3 -I scripts/tier.py --git <worktree> $(git -C <worktree> merge-base <base> HEAD)`, `<base>` the `--base` ref. Its first line is the **risk tier**, `low` or `high`; the lines under it are the signals that decided it. (`tier.py --trim <diff file>` cuts a diff to its changed files and added lines: that is how the fixtures under `scripts/fixtures/` were made from the gh-35 PRs.)
   - **Render each prompt**: `python3 -I scripts/review_prompt.py <mode> --pr <n> --worktree <worktree> --head <head sha> --base <ref> [--run <run>] [--decisions <path>] [--task <file>] [--findings <file>] --output <run>/reviews/<n>-<sha7>.json`, with the options its mode needs (Modes above; `re-review` refuses to run without `--findings`). `--base` is the `--base` ref above. Write what it prints to a file and give it, as printed, as the reviewer's whole message: the line naming its agent and brief, then its input object of file pointers (the brief has the reviewer find the repo's rule files itself), with no opinion or summary of the PR, so the reviewer's read is not anchored on yours. `--output` names the reviewer's output file, `<sha7>` the head's first 7 characters, and the security reviewer's ends `-security.json`: the one file the reviewer may write. Never write or add to a prompt yourself.
   - **PR reviewer**, always, in the mode given (the `pr-reviewer` agent if your harness defines one, otherwise a general-purpose subagent told to follow [reviewer-brief.md](reviewer-brief.md)).
   - **Security reviewer**, only in `ticket` mode, and only when the tier is `high`: the `security` mode's prompt (`--base` as for the PR reviewer), to the security reviewer agent if your harness defines one, otherwise a general-purpose subagent told to follow [security-brief.md](../security-audit/security-brief.md). A `low` tier gets none, whatever the files are; a `task` or `re-review` run never gets one, since its ticket's deep review decides.

   - **Remotely**: a reviewer runs on the remote backend when [Remote subagents](../remote-subagents/SKILL.md) lets its agent run there (its declaration, `remote-agent ready`, no `--local`) and the PR's author is the human or the run's identity (a `build-epic` run's ticket PRs); otherwise it runs here as above, and nothing below changes. The remote sandbox holds a token and reaches the network, and the reviewer runs the PR's tests there, so a PR by anyone else (its `conftest.py`, say) could send the token out: review it here, reading the whole diff before running anything. Render its prompt as above, but with `--remote <dir>` in place of `--output`, and one `--allow-author <login>` for the human's login (`gh api user --jq .login`) and one for the identity you post as (step 1), as `gh pr view <n> --json author` spells them (an App's as `app/<its slug>`), `<dir>` a new empty folder (`<run>/reviews/<n>-<sha7>-remote/`, `-security-remote/` for the security reviewer). It writes the diff and the PR facts into `<dir>`, lists the files to attach in `<dir>/attach.txt` (those, the decisions file, `map.md`, `spec.md`, the task or ticket file and the findings), and prints a prompt whose input says `remote: true`, names only `~/work` and `~/attached/<name>`, and names no `output`: the reviewer's final message is its output object. When it exits 1 (its stderr says why: `author` for a PR by anyone else, `pr-view`, `diff` or a missing input), run that reviewer here instead. Start it with `~/.agents/bin/remote-agent --name review-<n>-<sha7> --agent <the word in <dir>/agent.txt> --attach <each line of attach.txt>... @<prompt file> <worktree>` (`security-<n>-<sha7>` for the security reviewer); `--agent` makes it run on the model the same reviewer runs on here, and without it the sandbox's default model runs, as that skill's steps say. When it ends, copy the run's `report_path` from `remote-agent result <name>` (its saved final message), unchanged, to the output file `--output` would have named (`<run>/reviews/<n>-<sha7>.json`, `-security.json` for the security reviewer): that copy is the output of steps 4 and 5. A reviewer changes nothing, so it exits 3; on exit 0 it left changes in the worktree: never commit them, step 6 discards them. Any other exit, or an empty report, falls back to a local reviewer.

   Start each reviewer with a description (the short label your harness shows and saves, where it has one) beginning with its role, as [build-epic](../build-epic/SKILL.md#subagents) lists them, so telemetry files its cost by role: `review: PR <n>` (`task`), `ticket-review: PR <n>`, `re-review: PR <n>` and `security: PR <n>`. Without `--run` or `--decisions`, the prompts name no decisions file, and the briefs apply every rule as written. If your harness has no subagents, follow each prompt and its brief yourself in turn, before reading anything else about the PR. Done when every reviewer started has returned and its output file exists.

4. **Check and verify.** Check each output: `python3 -I ../_shared/protocol/check.py <role> output <file> --message -`, `<role>` `reviewer` (`security` for a `-security.json` file), the reviewer's final message on stdin; for a remote reviewer, whose final message is the output itself, leave out `--message`. On `FAIL <role> brief-violation <problems>`, act as the [Protocol](../_shared/conventions.md#protocol) says. On `OK <role> blocked`, tell the human its `why`; that reviewer's output is not posted. Then read each output's `findings` (a `re-review`'s `earlier` too). For each finding, open the code at its `path` and `line` and confirm its `scenario` really happens: trace the inputs, or run the code or a test. Mark what does not hold **dropped**, and what you could not settle **plausible**; never edit an output. Done when every output passes its check and every finding is **confirmed**, **plausible** or **dropped**.

5. **Post** each output as its own review, as the identity from step 1: `python3 -I ../build-epic/scripts/post_review.py <run> <n> <output-file> [--base <ref>] [--note <text>]`, `--base` the base the reviewer's diff started from (for a `re-review`, the head it reviewed before). It posts one `COMMENT` review on the head commit (never an approval) whose body is a one-line header (the PR and head reviewed, from the file's name `<PR>-<sha7>`; the PR posted on, when it differs; the diff read, only with `--base`; and the run's `test_command:` from `decisions.md`), the output rendered by [render.py](../_shared/protocol/render.py), then the note. The note is your verification from step 4: each dropped finding with its `path:line` and why it does not hold, and each plausible one; with every finding confirmed, leave it out. There are no inline comments: the rendered findings cite `path:line`. The posted body is saved beside the output as `<output-stem>.posted.md`. It prints `OK PR<n> review <url>`, or `FAIL PR<n> <reason> (log: ...)`:
   - `empty-review`: the output file is missing or blank. Continue the reviewer once (or start a new one), asking it to write its output there.
   - `bad-report`: the file is not UTF-8. Ask the reviewer to write it again in UTF-8.
   - `brief-violation <problems>`: the file is not a valid output of its role, and nothing posts. Act as on step 4's.
   - `post-denied <output-file>`: GitHub refused the review. Do not retry: the findings stay in that file, and your report names its path. The same when your harness denies running `post_review.py`.
   - `pr-view` or `post`: the log says why; run it again once.

   With `--dry-run`, show each output rendered (`python3 -I ../_shared/protocol/render.py <role> <file>`) and its note instead of posting. Done when each review URL exists, or the rendered outputs are shown.

6. **Clean up**: `git worktree remove <path>` (`--force` when a remote reviewer left changes in it).

## Report

Each review URL (or, with `--dry-run`, the output paths) and the confirmed and plausible findings, most severe first, one line each. When posting was denied, the output path from the `post-denied` line.

Files in this skill

  • SKILL.md10.8 KB
  • needs.json256 B
  • reviewer-brief.md9 KB
  • scripts/fixtures/gh35/achievements.diff6 KB
  • scripts/fixtures/gh35/archive.diff22.4 KB
  • scripts/fixtures/gh35/board.diff7.6 KB
  • scripts/fixtures/gh35/import.diff35.3 KB
  • scripts/fixtures/gh35/next.diff6.9 KB
  • scripts/fixtures/gh35/stats.diff14.4 KB
  • scripts/fixtures/gh35/sync.diff10.9 KB
  • scripts/fixtures/gh35/templates.diff22.9 KB
  • scripts/fixtures/gh35/trash.diff22 KB
  • scripts/fixtures/review_prompt/re-review.txt360 B
  • scripts/fixtures/review_prompt/security.txt391 B
  • scripts/fixtures/review_prompt/task.txt386 B
  • scripts/fixtures/review_prompt/ticket.txt380 B
  • scripts/review_prompt.py12.4 KB
  • scripts/test_review_prompt.py24.1 KB
  • scripts/test_tier.py18.1 KB
  • scripts/tier.py15 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.