Orchestrate a full PR review for a single PR, running assess-pr-risk, summarize-behavior-changes, and adversarial-pr-review in parallel with the analyze-test-coverage -> validate-pr -> verify-pr -> review-pr chain, plus the conditional surface reviews (review-cli-changes, review-sdk-changes, review-api-changes, review-db-changes) when the diff touches that surface, then building a guided HTML walkthrough for large PRs. Skips steps already completed for the current commit. Accepts a PR URL or ...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Review Pr Full?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tomzx-review-pr-full)
---
name: review-pr-full
description: Orchestrate a full PR review for a single PR, running assess-pr-risk, summarize-behavior-changes, and adversarial-pr-review in parallel with the analyze-test-coverage -> validate-pr -> verify-pr -> review-pr chain, plus the conditional surface reviews (review-cli-changes, review-sdk-changes, review-api-changes, review-db-changes) when the diff touches that surface, then building a guided HTML walkthrough for large PRs. Skips steps already completed for the current commit. Accepts a PR URL or a PR number with optional repository.
allowed-tools: Bash(uv run:*, gh:*, git:*, ~/.agents/scripts/review_requested_prs.py:*, ~/.agents/scripts/review-progress:*), Read, Grep, Task
argument-hint: "<pr-number> [repository] | <pr-url>"
---
# Review PR Full
Runs the complete review pipeline on a single PR: `/assess-pr-risk` (how risky is this change, how confident is that estimate?), `/summarize-behavior-changes` (what will behave differently after this merges?), and `/adversarial-pr-review` (which likely failure can I reproduce?) dispatched in parallel with the sequential chain `/analyze-test-coverage` (is the change well covered by tests?), then `/validate-pr` (are we building the right product?), then `/verify-pr` (does it conform to the acceptance criteria?), then `/review-pr` (is the code well-crafted?).
When the diff touches a CLI, SDK, API, or database surface, the matching conditional surface review (`/review-cli-changes`, `/review-sdk-changes`, `/review-api-changes`, `/review-db-changes`) is dispatched alongside them (see Conditional surface reviews).
Each step posts its own report (updating that step's existing comment when there is one, see step 4) and marks the commit it reviewed.
For a large PR, it then dispatches `/create-pr-walkthrough` to turn the diff and those reports into a guided HTML page (suggested reading order, annotated hunks, risks, findings) (see step 5), and commits it with the reports (see step 7).
When the run finishes, it commits this PR's report directory (reports plus any assets they reference, such as screenshots, casts, and the walkthrough page) in the user-global reviews store and pushes it (see step 7).
`/analyze-test-coverage` runs as the first chain step so the coverage determination is explicit, tracked, and available before anything else judges the change: it is cheap static analysis, its report is posted before the rest of the chain starts, and the later steps (`validate-pr`, `verify-pr`, `review-pr`) can read it as evidence.
`verify-pr` and `review-pr` also embed parts of the coverage analysis in their own reports; the standalone step guarantees the introduced-tests / change-coverage / uncovered-code determination exists for the current commit even when the chain halts early.
It never halts the pipeline: a `fail` verdict (uncovered changes found) is reported in the summary for the human reviewer, who decides what to do with it.
### Conditional surface reviews
Four surface reviews deep-dive one interface the diff touches: `/review-cli-changes` (commands, options, output, exit codes), `/review-sdk-changes` (public symbols, signatures, types, packaging), `/review-api-changes` (endpoints, fields, status codes, versioning), and `/review-db-changes` (migrations, locks, reversibility, backfills).
They are **conditional**: a surface review is stale only when the PR's changed files match that surface, so a PR that touches none of them dispatches none of them.
The staleness script decides applicability from the same file-path heuristics this skill documents (see step 4), so a run with a precomputed plan (`--steps`) and a run that computes its own plan select the same surface steps.
They are advisory in the same way as `/analyze-test-coverage`: each never gates a chain step and is never gated by one, so a surface `fail` is reported in the summary but never halts the pipeline and never changes the status.
A running surface review is dispatched concurrently with the parallel steps and the first chain step (surface reviews are static and cheap).
Each surface review stops on its own with "No <surface> change in the diff" when the diff does not actually touch its surface, so a heuristic false positive costs one cheap subagent and nothing more.
`/summarize-behavior-changes` produces the reviewer-facing answer to "what will behave differently once this merges?" It is self-contained (diff and codebase only), so it is dispatched in parallel with the first chain step, `assess-pr-risk`, and `adversarial-pr-review`, and it never gates anything: its marker verdict is always `informational`.
`/adversarial-pr-review` produces the adversarial answer to "which likely failure can I reproduce?" It ranks plausible breakage, then runs throwaway probes (outside the repository, time-boxed) to confirm or rule each one out, so its decisive findings reach `L3 - Executed` or `L4 - Reproduced` while the other static steps stop at `L2 - Ruled out`.
Its verdict (`breaks` / `unproven` / `holds`) is advisory and never halts the chain, but a `breaks` verdict is reproduced evidence and is reported prominently in the summary for the human reviewer.
The risk assessment, the behavior change summary, and the adversarial review are independent of the chain: each never halts the chain and is never halted by it, and each shares no evidence with the chain steps (the risk assessment is self-contained on the diff, codebase, and churn of the touched files; the behavior change summary on the diff and codebase; the adversarial review on the diff, codebase, PR description, and linked issue).
The risk assessment's verdict token (`fast-track` / `confirm` / `investigate` / `decide` / `block` / `hold`) is advisory for the human reviewer, and its report says what would raise its confidence.
Staleness checking is handled by the same deterministic Python script used by `review-requested-prs` (`~/.agents/scripts/review_requested_prs.py`).
It checks both GitHub PR comments and local report files at `~/.sdlc/<owner>/<repo>/pull-requests/<pr>/` for markers, so it works even when `should-post-to-github` has disabled posting.
Only stale steps are run, so re-running after a partial completion continues from the point it stopped.
When called by `review-requested-prs`, the staleness check and head-ref resolution have already been done.
The caller passes them as `--steps`, `--head-repo`, and `--head-branch`, and this skill skips its own GitHub queries and starts the checks immediately.
This keeps the parent orchestrator from becoming a bottleneck: one `review-pr-full` session owns each PR end to end.
## Prerequisites
- `uv` installed (for running the Python script)
- `gh` CLI authenticated (used by the script as a token fallback)
- `validate-pr`, `verify-pr`, `review-pr`, `analyze-test-coverage`, `assess-pr-risk`, `summarize-behavior-changes`, `adversarial-pr-review`, `create-pr-walkthrough`, and the four conditional surface reviews (`review-cli-changes`, `review-sdk-changes`, `review-api-changes`, `review-db-changes`) skills available
## Workflow
```
Resolve PR argument (URL or number + repo)
|
v
Precomputed plan given?
(--steps passed)
/ \
No Yes
| |
v v
Run script Use STALE_STEPS as-is
--dispatch (skip GitHub staleness check)
| |
+------+------+
|
v
Parse stale steps for this PR
|
v
Any stale steps?
/ \
No Yes
| |
v v
Report Create shared worktree
"up to | (use --head-repo/--head-branch when given,
date" | else resolve via gh pr view)
|
v
Dispatch stale steps:
assess-pr-risk, summarize-
behavior-changes, adversarial-pr-review,
and the applicable surface
reviews (cli/sdk/api/db)
concurrently with the chain:
analyze-test-coverage -> validate-pr
-> verify-pr -> review-pr
Check for blocking verdict after each chain step
|
v
Dispatch create-pr-walkthrough
(large PRs only)
|
v
Clean up worktree
|
v
Commit + push this PR's reports
and assets to the reviews store
|
v
Emit VERDICT line + summary
```
## Steps
### 1. Resolve the PR argument
Accept one of:
- A PR URL: `https://github.com/owner/repo/pull/42`
- A PR number with a repository: `42 owner/repo`
- A PR number alone: `42` (uses `$REPO` from the environment)
Optional precomputed arguments, normally supplied by `review-requested-prs`:
- `--steps a,b,c`: comma-separated list of the stale steps to run, already ordered and already trimmed of steps blocked by an earlier failed step.
When present, step 2 is skipped entirely.
- `--head-repo owner/repo`: the PR head repository (the fork for cross-repository PRs).
When present, step 3 uses it instead of calling `gh pr view`.
- `--head-branch name`: the PR head branch.
When present, step 3 uses it instead of calling `gh pr view`.
Treat a precomputed plan as authoritative: do not re-run discovery or the staleness script, and do not call GitHub for staleness or PR status.
It was computed against the same HEAD moments earlier.
If a PR URL is given, pass it directly to the script.
If a PR number and repo are given, construct the URL:
```bash
PR_URL="https://github.com/${REPO}/pull/${PR_NUMBER}"
```
If only a PR number is given and `$REPO` is not set, stop and ask for the repository.
### 2. Run the staleness script
**Skip this step when `--steps` was provided.** Set `STALE_STEPS` from the flag and continue to step 3.
Otherwise, run the script to determine which steps are stale for this PR:
```bash
~/.agents/scripts/review_requested_prs.py "$PR_URL" --dispatch
```
The `--dispatch` flag makes the script output one command per line for each stale step, in execution order:
```
/assess-pr-risk 42 acme/api
/summarize-behavior-changes 42 acme/api
/adversarial-pr-review 42 acme/api
/review-api-changes 42 acme/api
/review-db-changes 42 acme/api
/analyze-test-coverage 42 acme/api
/validate-pr 42 acme/api
/verify-pr 42 acme/api
/review-pr 42 acme/api
```
(The surface lines appear only when the changed files touch that surface: this example's diff changes an API route and a migration, so `review-api-changes` and `review-db-changes` are listed while the CLI and SDK reviews are not.)
If the script outputs nothing, all steps are up to date for the current commit.
Report "All review steps are up to date for PR #N in owner/repo" and stop.
This path does not rebuild the walkthrough page: if it is missing or stale, run `/create-pr-walkthrough {PR} {REPO}` directly.
Each line has the format:
```
/{skill} {PR_NUMBER} {REPO}
```
The steps are already in the correct execution order.
`assess-pr-risk`, `summarize-behavior-changes`, and `adversarial-pr-review` are listed first so they can be dispatched concurrently with the first stale chain step; the applicable surface reviews (`review-cli-changes`, `review-sdk-changes`, `review-api-changes`, `review-db-changes`) follow them, also dispatched concurrently and advisory; the chain steps follow in their sequential order (analyze-test-coverage before validate-pr before verify-pr before review-pr).
Set `STALE_STEPS` to the ordered list of step names.
### 3. Create the shared worktree
Before dispatching the first stale step, resolve where the PR's head lives.
The head may be on a fork rather than the base repository, so query the head repository up front instead of assuming `origin`:
```bash
gh pr view $PR_NUMBER --repo $REPO --json headRefName,headRepository --jq '"\(.headRepository.nameWithOwner) \(.headRefName)"'
```
Set `HEAD_REPO` from `headRepository.nameWithOwner`.
For same-repo PRs this is the base repository itself; for cross-repository PRs it is the fork, so `https://github.com/${HEAD_REPO}.git` is the correct fetch URL in both cases.
Set `HEAD_BRANCH` from `headRefName`.
**When `--head-repo` and `--head-branch` were provided, skip the `gh pr view` above and use those values directly** (`HEAD_REPO="${HEAD_REPO_ARG}"`, `HEAD_BRANCH="${HEAD_BRANCH_ARG}"`).
The caller already resolved them, so no GitHub call is needed.
Then create the worktree that all stale steps will reuse:
```bash
ISSUE_NUMBER=$(gh pr view $PR_NUMBER --repo $REPO --json closingIssuesReferences --jq '.closingIssuesReferences[0].number // empty')
WORKTREE_DIR=/tmp/sdlc/$REPO/${ISSUE_NUMBER:-pr-$PR_NUMBER}
mkdir -p /tmp/sdlc/$REPO
git fetch https://github.com/$HEAD_REPO.git $HEAD_BRANCH
git worktree add $WORKTREE_DIR FETCH_HEAD
```
When a precomputed plan was given, skip the `ISSUE_NUMBER` lookup (it is a naming convenience only) and use `WORKTREE_DIR=/tmp/sdlc/$REPO/pr-$PR_NUMBER`.
If the worktree already exists (e.g. from a previous run), skip creation and reuse it.
Capture the full SHA of the commit under review, which is the worktree HEAD (the fetched PR head), its short form, and the current session ID.
The full SHA is used by the walkthrough freshness check; the short SHA and session ID are used in the commit message in step 7, after the worktree has been removed:
```bash
HEAD_COMMIT=$(git -C "$WORKTREE_DIR" rev-parse HEAD)
HEAD_SHORT_SHA=$(git -C "$WORKTREE_DIR" rev-parse --short HEAD)
SESSION_ID="${OPENCODE_SESSION_ID:-}"
```
### 4. Dispatch stale review steps
Dispatch each skill in `STALE_STEPS` as a subagent task via the Task tool.
The subagent prompt MUST be the exact skill invocation command, not a paraphrased or self-authored description.
Do not let the orchestrator generate its own task description, pass the literal command string below as the subagent prompt.
Include the `WORKTREE_DIR` so the sub-skill reuses the shared worktree instead of creating its own.
When `PR_REVIEW_POST_MODE` is set to a non-default value, add one line to every prompt so the choice survives the dispatch (`Post in append mode: PR_REVIEW_POST_MODE=append`; see Posting mode below) and change nothing else.
Use the `general` subagent type for all steps.
**Parallel dispatch of the advisory steps.** When `STALE_STEPS` contains `assess-pr-risk`, `summarize-behavior-changes`, `adversarial-pr-review`, or any surface review (`review-cli-changes`, `review-sdk-changes`, `review-api-changes`, `review-db-changes`), dispatch each concurrently with the first stale chain step: put those Task calls in a single message so they run at the same time.
All of them are independent of the chain and never gate it; the three parallel steps share no evidence with it (the adversarial review also reads the PR description and linked issue), and the adversarial review runs scratch probes, so it is slower than the static steps but never blocks them.
The chain steps run sequentially (analyze-test-coverage, then validate-pr, then verify-pr, then review-pr), waiting for each subagent to finish before starting the next.
Do not parallelize chain steps, because each step may halt the pipeline.
If an advisory step (assess-pr-risk, summarize-behavior-changes, adversarial-pr-review, or a surface review) is stale but no chain step is (or the chain halts before finishing), it still runs and its report still applies on its own.
Each sub-skill reuses the shared worktree, runs its analysis, and posts a comment (or writes locally when posting is disabled) with the commit SHA marker.
While a step runs it also publishes an empty `<skill>.<sha>.in-progress` marker in the PR's report directory and removes it when it returns, so a UI can show that step as running (see `sdlc/references/shared.md`, In-progress marker). The orchestrator does not write or remove those markers itself, apart from clearing leftovers in step 6.
#### Posting mode (append or replace)
Every post goes through the shared **Posting a review report** recipe in `skills/sdlc/references/shared.md`: the sub-skill finds its own existing comment for that step (the authenticated user's top-level comment carrying that step's marker) and updates it, instead of adding a comment per reviewed commit.
The choice is read from the `PR_REVIEW_POST_MODE` environment variable:
| `PR_REVIEW_POST_MODE` | Effect on that step's existing comment |
|---|---|
| `replace` (default) | The body is swapped for the new report: one comment per step, always showing the latest reviewed commit, plus an index of the commits reviewed (most recent first), each linking to the review commit in the reviews repository that holds that run's reports (step 7 links the current run's entry after committing), and a link to the PR's directory there |
| `append` | The new report is added below the existing body: one comment per step holding every reviewed commit's report, oldest first, newest last (no index, since the earlier reports are already there) |
Set the variable before running; it is passed to each subagent through the prompt line above, so the machine running `review-pr-full` is the one whose setting applies.
In `replace` mode the index and the reviews-repository link come from the reviews store: it lists every commit the store recorded for this PR (its commit messages name the reviewed commits, and the commits themselves hold the reports), most recent first, each entry linking to its review commit, and the block ends with a link to that PR's directory in the reviews repository. The current run's entry is listed first with `(this review)` and no link, because its review commit does not exist yet when the step posts; step 7 below patches it to point at that commit once it has been made.
Prefer `replace` for the usual case (the comment reads as the current review and still points at the history; the per-run reports and the end-of-run commit are that history).
Prefer `append` when a comment should instead read as the timeline of reviews across commits.
When the variable is unset, `replace` is used, so re-runs stop duplicating comments either way.
#### assess-pr-risk
Dispatch a subagent with this exact prompt:
```
Run the assess-pr-risk skill: /assess-pr-risk {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
Never gate anything on its result and never halt because of it: a `block` or `hold` token is information for the human reviewer, not a pipeline failure.
Because it is self-contained, it never waits on the chain, and its report states what would raise its confidence.
#### summarize-behavior-changes
Dispatch concurrently with the first stale chain step (and with assess-pr-risk and adversarial-pr-review when they are stale).
Dispatch a subagent with this exact prompt:
```
Run the summarize-behavior-changes skill: /summarize-behavior-changes {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
Never gate anything on its result and never halt because of it: its marker verdict is always `informational`.
Because it is self-contained, it never waits on the chain, and its report is the reviewer-facing answer to what will behave differently after merge.
#### adversarial-pr-review
Dispatch concurrently with the first stale chain step (and with assess-pr-risk and summarize-behavior-changes when they are stale).
Dispatch a subagent with this exact prompt:
```
Run the adversarial-pr-review skill: /adversarial-pr-review {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
Never gate anything on its result and never halt because of it: a `breaks` verdict is reproduced evidence for the human reviewer, not a pipeline failure, and it does not cut the chain the way a failed `review-pr` does.
The adversarial review is slower than the static steps because it executes scratch probes, but it is self-contained (diff, codebase, PR description, linked issue), so it never waits on the chain and the chain never waits on it.
Report a `breaks` verdict prominently in the summary: it names a failure that was actually reproduced, and `promote-pr` treats it as a promotion blocker even though it never cuts this chain.
#### Conditional surface reviews
`review-cli-changes`, `review-sdk-changes`, `review-api-changes`, and `review-db-changes` are dispatched only when `STALE_STEPS` contains them.
The staleness script lists a surface step only when the PR's changed files touch that surface, using the same file-path heuristics mirrored here:
| Surface review | Listed when changed paths match |
|---|---|
| `review-cli-changes` | `cli/`, `cmd/`, `commands/`, `bin/`, `__main__.py` |
| `review-sdk-changes` | `sdk/`, `sdk-*/`, `client/`, `clients/`, `client.<ext>` |
| `review-api-changes` | `routes/`, `controllers/`, `handlers/`, `endpoints/`, `resolvers/`, `api/`, `openapi*`, `swagger*`, `*.proto`, `*.graphql`, `schema.{json,yaml}` |
| `review-db-changes` | `migrations/`, `alembic/`, `flyway/`, `db/migrate/`, `*.sql`, `schema.{sql,rb}` |
The heuristics are deliberately broad: when a surface review is dispatched on a diff that turns out not to touch its surface, it stops on its own with "No <surface> change in the diff", so a false positive costs one cheap subagent and nothing more.
A false negative is the only costly miss, which is why the patterns lean broad.
Dispatch a subagent with this exact prompt for each surface step in `STALE_STEPS`, concurrently with the other advisory steps:
```
Run the {skill} skill: /{skill} {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
Never gate anything on a surface review's result and never halt because of it: a `fail` (changes-requested) is reported in the summary for the human reviewer.
A surface review reads only the diff, the base revision, and the codebase, so it is self-contained and needs no other step's report.
#### analyze-test-coverage
Dispatch first among the chain steps (concurrently with assess-pr-risk, summarize-behavior-changes, and adversarial-pr-review when they are stale).
Dispatch a subagent with this exact prompt:
```
Run the analyze-test-coverage skill: /analyze-test-coverage {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
The coverage step is static analysis only (no build, no test execution) and never halts the pipeline: nothing is gated by its verdict.
A `fail` verdict means at least one behavior change or code path is uncovered; report it in the summary so the human reviewer can weigh it.
Its report is saved under `$PR_REVIEW_DIR` and carries the same commit marker as the other steps, so staleness tracking works identically, and because it is written before the rest of the chain runs, the later steps can read it as evidence.
#### validate-pr
Dispatch a subagent with this exact prompt:
```
Run the validate-pr skill: /validate-pr {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
If validate-pr returns a **Wrong thing** verdict, stop the chain.
Do not run verify-pr or review-pr, because verifying conformance to, or the craft of, the wrong target is wasted effort.
The coverage report (already posted) and the concurrent assess-pr-risk, summarize-behavior-changes, and adversarial-pr-review reports are unaffected and stand.
Record the failure in the summary.
#### verify-pr
Only dispatch if validate-pr passed (or was already up to date and is not stale).
Dispatch a subagent with this exact prompt:
```
Run the verify-pr skill: /verify-pr {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
If verify-pr fails (e.g. build failure, no linked issue), the sub-skill notes the failure and stops; it posts a comment for missing issues or criteria, but not for build failures (CI typically catches those).
Do not run review-pr.
Record the failure in the summary.
#### review-pr
Only dispatch if verify-pr passed (or was already up to date and is not stale).
Dispatch a subagent with this exact prompt:
```
Run the review-pr skill: /review-pr {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill reuses it and does not create or remove its own worktree.
```
### 5. Generate the walkthrough page for a large PR
After the chain finishes (or halts), decide whether this PR needs a guided walkthrough.
The page is for the human reviewer: it turns the diff and the reports into an overview, a suggested reading order, annotated hunks, and the risk and findings panels.
It never gates anything and never changes the pipeline status.
Use the PR's size from GitHub:
```bash
PR_REVIEW_DIR="$HOME/.sdlc/$REPO/pull-requests/$PR_NUMBER"
ADDITIONS=$(gh pr view $PR_NUMBER --repo $REPO --json additions --jq .additions)
DELETIONS=$(gh pr view $PR_NUMBER --repo $REPO --json deletions --jq .deletions)
CHANGED_FILES=$(gh pr view $PR_NUMBER --repo $REPO --json changedFiles --jq .changedFiles)
CHANGED_LINES=$((ADDITIONS + DELETIONS))
```
Build the page when `CHANGED_LINES >= 200` or `CHANGED_FILES >= 10`.
Apply judgment first: build it below the threshold when the change is hard to follow linearly (concurrency, a state machine, a security boundary, a protocol, a migration), and skip it above the threshold when the diff is mechanical (lockfile, generated code, mass rename, formatting only).
Record the decision and the reason in the summary.
If `$PR_REVIEW_DIR/pr-walkthrough.html` already exists and its embedded marker has `"sha":"$HEAD_COMMIT"`, the page matches the current head; skip regeneration.
Dispatch a subagent with this exact prompt.
Use the `general` subagent type.
```
Run the create-pr-walkthrough skill: /create-pr-walkthrough {PR} {REPO}
The worktree is already created at {WORKTREE_DIR}. Set WORKTREE_DIR to that path so the skill uses it for code context.
```
The GitHub counts above are a cheap pre-filter; the skill recomputes from the diff and its judgment is authoritative, so it may still skip a mechanical diff.
It writes `$PR_REVIEW_DIR/pr-walkthrough.html`, plus its intermediate `narrative.json` and `pr.diff` under `$PR_REVIEW_DIR/walkthrough/`.
If it fails or skips, note the outcome and continue; the review reports stand on their own.
### 6. Clean up the shared worktree
After all stale steps and the walkthrough complete (or the pipeline halts), remove the shared worktree:
```bash
git worktree remove $WORKTREE_DIR
```
Then clear any in-progress marker the run left behind, in case a subagent was killed before it could remove its own (see `sdlc/references/shared.md`, In-progress marker):
```bash
~/.agents/scripts/review-progress clear --repo "$REPO" --pr "$PR_NUMBER"
```
### 7. Commit and push the review reports
The per-run reports and findings state written by the steps above live in the user-global reviews store at `$HOME/.sdlc/$REPO/pull-requests/$PR_NUMBER/`, which is itself a git checkout of the automated-reviews repository (see `git -C "$HOME/.sdlc" remote -v`).
Commit exactly this PR's Markdown reports **and every asset they reference** and push, so the reports are durable and shareable across machines.
Include the short SHA of the reviewed commit (`$HEAD_SHORT_SHA`, captured in step 3) so the commit records which revision it covers, and the current session ID (`$SESSION_ID`, also from step 3) on a separate line so each commit traces back to the run that produced it:
```bash
REVIEWS_REPO="$HOME/.sdlc"
PR_REVIEW_DIR="$REPO/pull-requests/$PR_NUMBER"
if git -C "$REVIEWS_REPO" rev-parse --git-dir >/dev/null 2>&1; then
# Stage only this PR's reports and the assets they reference. Each file is
# added individually: `git add` fails entirely when any pathspec matches
# nothing, and most asset extensions are absent on a given run.
for ext in md html png jpg jpeg gif svg webp cast webm mp4; do
for f in "$PR_REVIEW_DIR"/*."$ext"; do
if [ -e "$f" ]; then
git -C "$REVIEWS_REPO" add -- "$f"
fi
done
done
if ! git -C "$REVIEWS_REPO" diff --cached --quiet; then
COMMIT_ARGS=(-m "review-pr-full: $REPO#$PR_NUMBER @ $HEAD_SHORT_SHA")
[ -n "$SESSION_ID" ] && COMMIT_ARGS+=(-m "session: $SESSION_ID")
git -C "$REVIEWS_REPO" commit "${COMMIT_ARGS[@]}"
if git -C "$REVIEWS_REPO" push; then
# The steps posted before this commit existed, so a replace-mode comment
# listed the reviewed commit first without a link (see Posting mode). Now
# that the review commit is pushed, point that entry at it. Best-effort:
# append-mode and non-posted comments simply do not match.
STORE_SHA="$(git -C "$REVIEWS_REPO" rev-parse --short HEAD)"
REVIEWS_URL="$(git -C "$REVIEWS_REPO" remote get-url origin 2>/dev/null \
| sed -E 's#^git@([^:]+):#https://\1/#; s#\.git$##')"
case "$REVIEWS_URL" in
http://*|https://*) ;;
*) REVIEWS_URL="" ;;
esac
if [ -n "$REVIEWS_URL" ]; then
ME="$(gh api user --jq .login)"
for STEP in assess-pr-risk summarize-behavior-changes adversarial-pr-review review-cli-changes review-sdk-changes review-api-changes review-db-changes analyze-test-coverage validate-pr verify-pr review-pr; do
CID="$(gh api --paginate "repos/$REPO/issues/$PR_NUMBER/comments" \
--jq ".[] | select(.user.login == \"$ME\") | select(.body | contains(\"\\\"step\\\":\\\"$STEP\\\"\")) | .id" \
| tail -n 1)"
[ -n "$CID" ] || continue
OLD="$(gh api "repos/$REPO/issues/comments/$CID" --jq .body)"
PLACEHOLDER="- \`$HEAD_SHORT_SHA\` (this review)"
case "$OLD" in *"$PLACEHOLDER"*) ;; *) continue ;; esac
NEWLINE="- [\`$HEAD_SHORT_SHA\`]($REVIEWS_URL/commit/$STORE_SHA)"
gh api -X PATCH "repos/$REPO/issues/comments/$CID" \
-f body="${OLD//"$PLACEHOLDER"/$NEWLINE}" >/dev/null
done
fi
else
echo "note: push failed for $REPO#$PR_NUMBER"
fi
fi
fi
```
The commit message is always `review-pr-full: {owner}/{repo}#{PR} @ {short_sha}`, followed by a `session: {session_id}` line when a session ID is available, so every run is identifiable by repository, PR, the commit it reviewed, and the run that produced it.
After a successful push, step 7 also makes the current entry in each step's reviewed-commits index clickable: the steps posted before the commit existed, so they listed `$HEAD_SHORT_SHA` as a plain hash with `(this review)`, and this patch replaces that line with a link to the new review commit (the one holding this run's reports).
It looks only for that exact placeholder in each step's own comment, so it is a no-op when posting was skipped, in `append` mode (there is no index), or for steps that did not post.
When the store is not a git checkout, has no `origin` remote, its `origin` is not an HTTP(S) GitHub URL, or the commit or push failed, the patch is skipped and that entry stays a plain hash.
Any assets the steps create (screenshots, images, asciinema casts, video clips, the walkthrough page) must live inside `$PR_REVIEW_DIR` and are committed in the same commit as the reports that reference them, so a report never links to a file that was not committed.
Only files inside the PR's directory are staged: the Markdown reports (`*.md`) plus the asset extensions in the staging loop (`.html`, `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`, `.webp`, `.cast`, `.webm`, `.mp4`).
Each file is added on its own, because `git add` fails as a whole when any pathspec matches nothing and most runs have no assets at all.
The walkthrough's intermediate `walkthrough/` directory (`narrative.json`, `pr.diff`) is deliberately left uncommitted.
Findings-state YAML files, `gh-pr-view` caches, in-progress markers (`<skill>.<sha>.in-progress`), and stray non-report files such as `.DS_Store` are deliberately left uncommitted.
If there is nothing staged (all steps up to date, or a re-run that changed nothing), skip the commit entirely.
If the store is not a git checkout, or the commit or push fails, note it and continue: this step is best-effort and never changes the pipeline verdict.
### 8. Report summary
After processing, output the summary table and finish with a single machine-readable verdict line, so a parent orchestrator (`review-requested-prs`) can aggregate results without parsing the table:
```
VERDICT <status> | PR #{PR} | {REPO} | steps={STALE_STEPS} | <short note>
```
`<status>` is one of:
| Status | Meaning |
|---|---|
| `completed` | Every stale step ran and passed (or there were none left to run after a partial pass); includes runs whose only stale step was assess-pr-risk, summarize-behavior-changes, adversarial-pr-review, analyze-test-coverage, or an applicable surface review |
| `up-to-date` | Nothing was stale; all steps already match the current HEAD |
| `stopped-validate` | validate-pr returned Wrong thing or Inconclusive; later chain steps not run (analyze-test-coverage already ran; assess-pr-risk, summarize-behavior-changes, and adversarial-pr-review unaffected) |
| `stopped-verify` | verify-pr failed (build failure, nonconforming, missing issue/criteria); review-pr not run |
| `stopped-review` | review-pr returned changes-requested or rejected |
| `error` | The pipeline could not run (worktree setup failed, script error) |
The risk assessment never changes the status: its verdict token is reported in the summary and the table, and routing on it is the human reviewer's call.
The same applies to analyze-test-coverage: it is the first chain step and nothing is gated on it, so even a coverage `fail` verdict leaves the status `completed`, with the outcome reported in the summary note and the table.
`summarize-behavior-changes` is always `informational` and likewise never changes the status.
`adversarial-pr-review` also never changes the status: a `breaks` verdict is reproduced evidence, so it goes in the summary note and the table, and the human reviewer decides whether it blocks the merge.
The surface reviews (`review-cli-changes`, `review-sdk-changes`, `review-api-changes`, `review-db-changes`) also never change the status: a `fail` (changes-requested) is reported in the summary and the table, and whether to act on it is the human reviewer's call.
The walkthrough page likewise never changes the status: it is a reading aid, so a run that builds it still reports `completed`, `stopped-validate`, or whatever the review chain produced.
Then show the table:
| Repository | PR | Steps run | Result |
|---|---|---|---|
| owner/repo | #42 | assess, behavior, adversarial review, coverage, validate, verify, review | Completed |
| owner/repo | #42 | assess, behavior, adversarial review, coverage, validate, verify, review, walkthrough | Completed (walkthrough page built) |
| owner/repo | #42 | verify, review | Completed (assess, behavior, adversarial review, coverage, validate up to date) |
| owner/repo | #42 | assess | Completed (chain up to date) |
| owner/repo | #42 | behavior | Completed (rest up to date; summary posted) |
| owner/repo | #42 | adversarial review | Completed (rest up to date; failure reproduced, see note) |
| owner/repo | #42 | api | Completed (rest up to date; api surface review requested changes) |
| owner/repo | #42 | coverage | Completed (rest up to date; gaps found, see note) |
| owner/repo | #42 | — | Skipped (all up to date) |
| owner/repo | #42 | assess, behavior, adversarial review, coverage, validate | Stopped at validate (wrong product) |
| owner/repo | #42 | assess, behavior, adversarial review, coverage, validate, verify | Stopped at verify (build failure) |
## Example Usage
**Scenario 1: Fresh PR, every applicable step needed**
```
/review-pr-full 42 acme/api
```
No prior markers found.
Dispatches assess-pr-risk, summarize-behavior-changes, adversarial-pr-review, and any applicable surface review concurrently with analyze-test-coverage, then validate-pr, verify-pr, and review-pr in sequence.
The diff touches a route and a migration, so review-api-changes and review-db-changes are dispatched too; review-cli-changes and review-sdk-changes are not applicable and are not dispatched.
The chain passes, and the adversarial review reproduces one boundary failure, which the summary reports as a note while the status stays `completed`.
**Scenario 2: PR URL**
```
/review-pr-full https://github.com/acme/api/pull/42
```
Same as Scenario 1 but using a PR URL.
**Scenario 3: Precomputed plan from review-requested-prs**
```
/review-pr-full 42 acme/api --steps validate-pr,verify-pr --head-repo acme/api --head-branch feature-x
```
The caller already ran the staleness check and resolved the head refs. The skill skips its own GitHub queries, creates the worktree from `acme/api@feature-x`, runs validate-pr then verify-pr, and stops before review-pr.
Ends with `VERDICT completed | PR #42 | acme/api | steps=validate-pr,verify-pr | ...`.
**Scenario 4: Partial completion, re-run**
```
/review-pr-full 42 acme/api
```
The validate-pr, verify-pr, analyze-test-coverage, assess-pr-risk, summarize-behavior-changes, and adversarial-pr-review markers match HEAD, but review-pr is stale.
Runs only `/review-pr 42 acme/api`.
Summary shows "Completed (assess, behavior, adversarial review, coverage, validate, verify up to date)".
**Scenario 5: All steps up to date**
```
/review-pr-full 42 acme/api
```
All markers match HEAD.
Script outputs nothing.
Reports "All review steps are up to date for PR #42 in acme/api".
**Scenario 6: validate-pr returns Wrong thing**
```
/review-pr-full 15 acme/api
```
validate-pr judges the PR to be the wrong product.
It posts its Wrong-thing verdict. verify-pr and review-pr are not run; the coverage report was already posted first and the concurrent assess-pr-risk, summarize-behavior-changes, and adversarial-pr-review completed, so those reports stand (useful context for the human deciding what to do with the PR).
Summary shows "Stopped at validate (wrong product)".
**Scenario 7: verify-pr build failure**
```
/review-pr-full 88 acme/api
```
validate-pr passes. verify-pr fails to build.
Notes the build failure and stops (CI would typically catch this). review-pr is not run.
Summary shows "Stopped at verify (build failure)".
**Scenario 8: PR number with $REPO from environment**
```
/review-pr-full 42
```
`$REPO` is set in the environment.
Uses it as the repository.
Runs the pipeline.
**Scenario 9: Only the risk assessment is stale**
```
/review-pr-full 55 acme/api
```
The chain markers match HEAD (the pipeline ran before assess-pr-risk existed), but the assess marker is old.
Dispatches only `/assess-pr-risk 55 acme/api`, which is self-contained and needs no chain reports.
Summary shows "Completed (chain up to date)".
**Scenario 10: Only the coverage step is stale**
```
/review-pr-full 77 acme/api
```
The assess and chain markers match HEAD, but the analyze-test-coverage marker is missing (the pipeline ran before the coverage step existed).
Dispatches only `/analyze-test-coverage 77 acme/api`.
It finds two uncovered behavior changes and posts its report with a `fail` verdict.
Summary shows "Completed" with a note that coverage found gaps; the human reviewer decides whether to request tests.
**Scenario 11: Only the behavior change summary is stale**
```
/review-pr-full 79 acme/api
```
The assess and chain markers match HEAD, but the summarize-behavior-changes marker is missing (the pipeline ran before the summary step existed).
Dispatches only `/summarize-behavior-changes 79 acme/api`.
It writes its report with the `informational` marker.
Summary shows "Completed (rest up to date; summary posted)".
**Scenario 12: Re-review after new commits, with append mode**
```
/review-pr-full 42 acme/api
```
`PR_REVIEW_POST_MODE=append` is set in the environment, so the append choice is passed to every dispatched step.
The PR gained commits since the last run, so all stale steps (including the adversarial review and any applicable surface review) re-run.
Each step finds its own existing comment (the one carrying that step's marker) and appends the new report below the old one, so one comment per step carries the review history for the PR, oldest review first, newest last.
With the default `replace` mode, each step would instead swap its comment body so the comment shows only the latest reviewed commit, and would end it with the list of commits reviewed (most recent first), each entry linking to the review commit in the reviews repository that holds that run's reports, plus a link to the PR's directory there, so the earlier feedback stays reachable.
Step 7 then commits and pushes the new reports and patches each comment so the current run's entry links to that commit too.
**Scenario 13: Only the database surface review is stale**
```
/review-pr-full 91 acme/api
```
The PR changes a migration, so the staleness script lists review-db-changes, and every other applicable step matches HEAD.
Dispatches only `/review-db-changes 91 acme/api`, which reports a blocking index creation as a 🔴 MUST.
Because the surface review is advisory, the status stays `completed` and the finding is reported in the summary note and the Surfaces column.
**Scenario 14: Only the adversarial review is stale**
```
/review-pr-full 93 acme/api
```
The assess, behavior, coverage, and chain markers all match HEAD, but the adversarial-pr-review marker is missing (the pipeline ran before the adversarial review existed).
Dispatches only `/adversarial-pr-review 93 acme/api`.
It reproduces an unhandled exception on an empty filter and reports `breaks`.
Because the adversarial review is advisory, the status stays `completed`, and the reproduced failure is reported in the summary note so the reviewer can act on it before approving.
**Scenario 15: Large PR gets a walkthrough page**
```
/review-pr-full 120 acme/api
```
The PR changes 24 files and 1,400 lines. After the review chain finishes, the walkthrough step dispatches `/create-pr-walkthrough 120 acme/api`, which writes `$PR_REVIEW_DIR/pr-walkthrough.html` and reports its path without opening it.
The HTML is committed with the reports.
Summary shows "Completed (walkthrough page built)"; the status is unchanged by the page.
## Script Reference
| Script | Description |
|---|---|
| `~/.agents/scripts/review_requested_prs.py` | Discovers PRs, checks marker staleness (GitHub comments + local `.sdlc` files), outputs dispatch commands. Run with `--dispatch` for per-step commands, `--dispatch-prs` for one self-contained `/review-pr-full` command per PR, `--json` for structured data, `--log-level debug` for timings. Pass a single PR URL to scope it to one PR. |
## Related Skills
| Skill | Relationship |
|---|---|
| `review-requested-prs` | Multi-PR counterpart: discovers all review-requested PRs and fans out one `review-pr-full` session per PR in parallel, passing a precomputed plan so no GitHub re-check is needed. Use that when reviewing your queue; use this skill for a single PR. |
| `promote-pr` | Consumer for your own draft PR: runs this skill, then promotes the draft to ready-for-review only when the gate steps pass. |
| `validate-pr` | Needs-alignment sub-skill (does the PR solve the right problem; are the acceptance criteria sound). Build-free early gate. |
| `verify-pr` | Conformance sub-skill (criteria-to-code traceability plus runtime proof that each criterion is met). Owns the build. |
| `review-pr` | Code-craft sub-skill (quality, architecture, security, tests, operational concerns). Delegates test coverage analysis to `/analyze-test-coverage` for its Coverage section. |
| `analyze-test-coverage` | Coverage sub-skill and first chain step (introduced tests, change coverage, uncovered code), so its report exists as evidence before validate/verify/review run. Static analysis only; never halts the pipeline. |
| `assess-pr-risk` | Risk and confidence assessment dispatched concurrently with the chain; advisory only, never halts the pipeline. |
| `summarize-behavior-changes` | Behavior change summary dispatched concurrently with the chain and with assess-pr-risk; self-contained (diff and codebase), advisory only (marker `informational`), never halts the pipeline. |
| `adversarial-pr-review` | Adversarial sub-skill dispatched concurrently with the chain and with assess-pr-risk and summarize-behavior-changes; enumerates likely failure scenarios, reproduces them with scratch probes (`L3 - Executed` / `L4 - Reproduced`), and reports `breaks` / `unproven` / `holds`. Advisory, never halts the pipeline. |
| `review-cli-changes` | Conditional surface review for a CLI change (compatibility, options, output, exit codes); dispatched only when the diff touches a CLI surface, advisory, never halts the pipeline. |
| `review-sdk-changes` | Conditional surface review for an SDK change (public symbols, signatures, types, packaging); dispatched only when the diff touches an SDK surface, advisory, never halts the pipeline. |
| `review-api-changes` | Conditional surface review for an API contract change (endpoints, fields, status codes, versioning); dispatched only when the diff touches an API surface, advisory, never halts the pipeline. |
| `review-db-changes` | Conditional surface review for a database change (migrations, locks, reversibility, backfills); dispatched only when the diff touches a database surface, advisory, never halts the pipeline. |
| `create-pr-walkthrough` | Builds the guided HTML walkthrough page for a large PR from the diff and the reports; dispatched after the chain, never gates anything, and its page is committed with the reports. |
| `quick-pr-review` | Lightweight counterpart: rapid auto-approve to unblock. Use this skill when you need deep review, not rapid unblocking. |