Skip to content
Back to skills

Review Branch

BSecurity

Reviews every change on the current git branch against its base and writes a findings report. Use when the user says "review my branch", "what did I change" or "check this before I push". Not for a pushed GitHub PR (use github-review-pr).

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 6, 2026
ai-agentsgobashgitapisecurityperformance

Works with

  • api

Security analysis

B75/100
  • criticalSends environment variables or credentials to an external URL

Pro shows the line behind each finding and how to fix it

Scanned December 2, 2026

npx -y skills add DoctorMozg/claude-pipelines --skill review-branch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Review Branch?

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

Security grade badge for Review Branch
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/doctormozg-review-branch/badge)](https://www.skillsdirectory.com/skills/doctormozg-review-branch)

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-branch
description: 'Reviews every change on the current git branch against its base and writes a findings report. Use when the user says "review my branch", "what did I change" or "check this before I push". Not for a pushed GitHub PR (use github-review-pr).'
argument-hint: '[base-branch (default: main)]'
allowed-tools: Agent, Bash(git rev-parse *), Bash(git branch --show-current *), Bash(git diff *), Bash(mkdir *), Bash(date *), Read, Write, Glob, Grep, AskUserQuestion
---

# Review Current Branch

## Overview

Launch the `branch-reviewer` agent to perform a comprehensive review of all changes on the current git branch against a base branch (default `main`). Produces a report under `.mz/reviews/`.

The agent runs a two-wave analysis: Wave A is a 6-lens parallel fan-out (bugs, security, architecture, performance, maintainability, over-engineering) with full repo context; Wave B is a 3-researcher blinded adversarial pass (production reliability, security adversary, ops/SRE) dispatched as its own wave of typed `pipeline-blind-reviewer` agents with only the raw diff. Wave B is always-on — there is no opt-out — and surfaces "Blind Spots" that Wave A missed because of confirmation bias. Wave B's blinded prompts are shared with `audit depth:deep` via `<PLUGIN_ROOT>/shared/blinded_lenses.md` (single source of truth, no duplication).

## When to Use

Reviewing every change on the current git branch against a base branch and writing a findings report.

### When NOT to use

- You want to review a GitHub PR — use `github-review-pr` instead.
- The current branch is `main` or `master` — nothing to diff.
- The user wants a scoped review of a single file — read and review it directly.

## Arguments

- `$ARGUMENTS[0]` (optional) — Base branch to diff against. Defaults to `main`.
- `unit:<path>` — worker mode, set by mz-orchestrate for a final review unit. The token is never a base branch: the base comes from the brief, as Worker Mode below says.

## Worker Mode

With a `unit:<path>` token, `<PLUGIN_ROOT>/shared/worker-mode.md` overrides every question in this skill, and these steps replace the parts of Core Process they name:

- **Brief.** Read it; its `kind` is `review` and `owns` is empty. Write nothing outside `.mz/` and edit no code. Its `## Spec` goes into the branch-reviewer prompt as a `Unit spec:` block. When the spec has a `Coder notes: <path>` line, also pass `coder_notes: <path>` in the dispatch.
- **Setup.** Follow worker-mode.md, "Setup": `task_name` is `<YYYY_MM_DD>_review_branch_<id-slug>`, and `state.md` gets `worker_unit` and `unattended: worker`.
- **Base.** The base is the branch the spec names after `Base branch:`. Check it with `git rev-parse --verify <base>`. A spec that names none, or a base that doesn't resolve, is a blocker; never fall back to `main`.
- **Step 1.** Replace the main/master check with `git diff --quiet <base>...HEAD`. Exit 0 means nothing to review: set `Status: complete`, `Phase: nothing_to_review`, and end `STATUS: DONE` with that note.
- **Step 2.** Dispatch branch-reviewer and pass the Unit spec, including any final review scope fields. It runs both waves as usual, reusing validated coverage only in the specified final review resume mode. Reading the diff yourself skips the review the merge relies on.
- **Errors.** Every AskUserQuestion escalation under Error Handling is a blocker: record it in `state.md`, set `Status: blocked` and end `STATUS: BLOCKED`.
- **Final message.** After the Step 3 summary, add `## Report` with the report's absolute path, even if required reviewers are missing. Add `## Findings`, one line per finding: `<severity> <file>:<line> — <one-line fix>`. `Critical:` maps to `critical`, `Optional:` to `major` and `Nit:` to `minor`; `FYI:` and low-confidence lines stay in the report only. Then `## Verify` (not run: the worker runs it) and the status line. Findings never change the status. Missing required coverage remains `STATUS: BLOCKED`. Preserve a reviewer's `final_review_scope: full required` in the blocked reason.

## Constants

- **PROJECT_ROOT**: resolved once in setup with `echo "${MZ_MEMORY_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"`; expand `<PROJECT_ROOT>` to it in every command and agent prompt.
- **PLUGIN_ROOT**: `${CLAUDE_PLUGIN_ROOT}`. Skill and phase files write `<PLUGIN_ROOT>/...` because files opened with Read get no variable substitution; expand it to this absolute path before reading a file, running a command, or passing a path to an agent.

## Core Process

### Phase 0: Setup

1. Resolve `PROJECT_ROOT` with the command in Constants, before any `cd` or worktree switch, and use it for every `.mz/` path below.
1. `task_name` = `<YYYY_MM_DD>_review_branch_<slug>` where `<YYYY_MM_DD>` is today's date (underscores) and `<slug>` is the current branch name (snake_case, max 20 chars); on same-day collision append `_v2`, `_v3`.
1. Create `<PROJECT_ROOT>/.mz/task/<task_name>/`.
1. Write `<PROJECT_ROOT>/.mz/task/<task_name>/state.md` with `schema_version: 2`, `Status: running`, `Phase: 0`, `Started: <ISO timestamp>`, `BaseBranch: <base>`, `Branch: <current>`.
1. Emit a visible setup block: `task_name`, base branch, current branch, report dir.

### 1. Validate branch state

Verify the current branch is not `main` or `master`:

```bash
git branch --show-current
```

If on main/master, inform the user there is nothing to review and set `state.md` to `Status: complete` with `Phase: nothing_to_review`.

### 2. Launch the branch-reviewer agent

Read `<PLUGIN_ROOT>/shared/review-isolation.md` before requesting the isolated child reviews. The branch-reviewer keeps its consolidation context; its required independent reviewers need qualified, fresh explicit-input contexts.

Dispatch `Agent(branch-reviewer)` with the following prompt and wait for its report:

```
Review the current branch against <base-branch>.
code_root: <output of `git rev-parse --show-toplevel`>
artifact_root: <PROJECT_ROOT>
base_branch: <base-branch>
task_name: <task_name>
Analyze all changes file-by-file for bugs, architecture issues, codebase consistency, missing functionality, and test coverage.
Run the always-on blind audit (Wave B) per Phase 3.6: dispatch the 3 blinded adversarial researchers and the design questioner as their own wave after Phase 3.5 returns, reading the prompts from <PLUGIN_ROOT>/shared/blinded_lenses.md and <PLUGIN_ROOT>/shared/question_review.md; then answer and grade the questions per Phase 3.6.5 and cross-reference per Phase 3.7. The Blind Spots section is mandatory whenever wave_b_completed >= 1, and the Design Questions section always is.
Use researcher agents for domain research if the implementation topic is complex.
Save the report to <PROJECT_ROOT>/.mz/reviews/ using the naming convention: <YYYY_MM_DD>_review_branch_<branch_name><_vN>.md (append _v2, _v3 etc. if a report with the same base name already exists).
```

Update `state.md` to `Phase: 2` before dispatch. When the agent returns, check that the report file exists and is not empty. Inspect its required-review isolation and completion results before setting `Phase: 3`: unavailable isolation or a missing mandatory review means `Status: blocked`, no `VERDICT: PASS`, and a user summary of the incomplete checks after all independent work finishes. Otherwise set `Status: complete`. Preserve the report and its valid findings in either case.

### 3. Report to user

Once the agent completes:

- Show the path to the generated report file
- Print a brief summary of the verdict and key findings (critical bugs, missing tests, etc.)
- If the agent found critical issues, highlight them explicitly

## Red Flags

- You reviewed diff output without checking out or reading the branch's actual file contents.
- You skipped running (or at least reading) the tests that the branch changed.
- The report references files or symbols that do not exist on the branch.

## Verification

Output the report path (`.mz/reviews/<YYYY_MM_DD>_review_branch_<branch><_vN>.md`), confirm the file exists, and print the verdict line plus the top critical findings.

## Error Handling

- **Empty / invalid base-branch argument** → escalate via AskUserQuestion; never guess.
- **Missing tooling** (`git`, `gh`) → detect before dispatch; if absent, escalate via AskUserQuestion with the exact missing command.
- An agent returns nothing usable (report file missing or empty) → `<PLUGIN_ROOT>/shared/retry-policy.md`: re-dispatch once with a clarified prompt, and don't retry API errors or usage limits.
- Never guess — on any ambiguity (unknown base branch, detached HEAD, no diff) escalate via AskUserQuestion rather than proceed silently.

## State Management

State persists to `.mz/task/<task_name>/state.md` under the project root, `${MZ_MEMORY_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}`, resolved once at the start of the run. Schema is **v2**: line 1 is `schema_version: 2`; line 2 is `Status:` with one of `pending`, `running`, `blocked`, `complete`, `aborted_by_user` or `failed`, lowercase and unquoted; then `Phase` and `Started`. This skill runs setup, one dispatch and its report in a single turn with no approval gate, so it leaves out `phase_complete` and `what_remains`. Under a heading that reads exactly `## Lessons`, add one line whenever a review finding is accepted and fixed or a step fails, in the form `- (review|failure) WHEN <situation> → <what to do> — WHY <cause>`, concrete and under about 40 words; mz-memory harvests lessons whatever the `Status`. On reading an older file, put `schema_version: 2` on line 1 and `Status` on line 2, add no other keys, and log the upgrade. Leave a file with a higher `schema_version` untouched: ask whether to Restart (archive it), start New (`_v2`) or Abort, and stop if nobody can answer.

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.