review-branch
Skill2 starsChanged 2 months agoMITView on GitHub
Performs a focused code review of all commits on the current git branch since it diverged from the remote default branch (origin/main or origin/master). Handles detached HEAD state. Output is critique-only: a prioritized list of concrete flaws with actionable improvement hints. Use when user wants to review a branch, do a code review, check a PR, or invokes /review-branch.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- philipobenito/elelemtheir own version, first seen Oct 28, 2026
- fboulnois/skillstheir own version, first seen Oct 15, 2026
- membrane/api-gatewaytheir own version, first seen Oct 8, 2026
- videojs/video.jstheir own version, first seen Oct 8, 2026
- cristian-robert/claude-code-harnesstheir own version, first seen Sep 15, 2026
- solarmist/claude-skillstheir own version, first seen Aug 14, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- videojs/video.js★ 40ksame name
- membrane/api-gateway★ 658same name
- philipobenito/elelem★ 3same name
- alehlopeh/claude-skills★ 2same name
- cristian-robert/claude-code-harness★ 2same name
- fboulnois/skills★ 1same name
- solarmist/claude-skills★ 1same name
- toantran292/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- explain-branchSkill
- explain-diffSkill
- review-mrSkill
- rework-mrSkill
- self-reviewSkill
- split-handoffSkill
- visualizeSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 7 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Run the bundled script to resolve the review scope (handles detached HEAD transparently).
- Very specific: line 23
If the caller already knows an authoritative base (e.g.
- Distinctive: line 29
If the script errors (not a git repo, no remote), report the error and stop.
- Distinctive: line 33
Run these in parallel:
- Distinctive: line 51
Look for convention documents in the repo root and docs.
- Distinctive: line 65
Read changed source files in full when context around the diff matters.
- Very specific: line 81
File paths and identifiers: always wrap in backticks —
src/foo.ts:42 , functionName. - Distinctive: line 116
Always show the offending code, not just a prose description.
- Distinctive: line 117
Add a How this bites scenario only when the failure mode isn't obvious from the code alone — e.g.
- Distinctive: line 118
Always end with a Fix — concrete replacement code, not just advice in prose.
- Very specific: line 120
If you run a command to verify a claim, show it in a fenced block (
bash for the command, orconsole if you're showing a $ command line … - Very specific: line 122
If there are zero findings, output exactly: No issues found.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
review-branch
Workflow
Step 1 — Gather the branch range
Run the bundled script to resolve the review scope (handles detached HEAD transparently). The
script refuses to guess silently — for a plain, standalone review like this one, say so
explicitly with REVIEW_BRANCH_STANDALONE=1:
REVIEW_BRANCH_STANDALONE=1 bash ~/.claude/skills/review-branch/scripts/branch-range.shSource the output variables: MAIN_REF, BASE, HEAD_SHA, COMMIT_COUNT, BRANCH_NAME.
If the caller already knows an authoritative base (e.g. review-mr, seeding from a specific
GitLab MR), it sets REVIEW_BRANCH_BASE instead — that value is then used verbatim instead of
the local git merge-base HEAD origin/main guess. Only relevant when invoking review-branch
from another skill; a plain /review-branch run always uses REVIEW_BRANCH_STANDALONE=1 as
shown above, never REVIEW_BRANCH_BASE.
If the script errors (not a git repo, no remote), report the error and stop.
Step 2 — Collect raw material
Run these in parallel:
# Commit log (context only)
git log --oneline "$BASE"..HEAD
# Full diff of the entire branch
git diff "$BASE"..HEAD
# List of changed files
git diff --name-only "$BASE"..HEAD
# Test-related files changed
git diff --name-only "$BASE"..HEAD | grep -iE '(test|spec)' || trueStep 3 — Load project conventions
Look for convention documents in the repo root and docs. Read any that exist:
# Resolve symlinks so duplicates (e.g. CLAUDE.md → AGENTS.md) are read only once
for f in CLAUDE.md AGENTS.md README.md CONTEXT.md; do [ -f "$f" ] && realpath "$f"; done \
| sort -u \
| xargs ls 2>/dev/null
find docs/ -type f -name '*.md' 2>/dev/null | head -20Extract rules, conventions, and constraints that apply to code in this repo. These become additional criteria for the review — treat violations as 🟠 HIGH severity.
Step 4 — Analyze
Read changed source files in full when context around the diff matters. Also read existing test files for the touched modules — not just the diff — to judge test coverage honestly.
Apply the review criteria below plus any project-specific rules found in Step 3. Take notes internally. Do not output anything yet.
Step 5 — Output
Emit only a flat, prioritized list of findings. No preamble. No praise. No summary of what the code does. Use Markdown throughout — it renders in the terminal.
Severity levels (use exactly one icon per finding):
- 🔴
CRITICAL— correctness bug, security issue, data loss risk - 🟠
HIGH— design flaw, missing test coverage for non-trivial logic, violates a project convention - 🟡
MEDIUM— poor clarity, unnecessary complexity, fragile pattern - 🔵
LOW— minor style, naming, or redundancy issue
Sort by severity descending, then by file path.
File paths and identifiers: always wrap in backticks — `src/foo.ts:42`, `functionName`. Never write a bare path or symbol.
Trivial findings (LOW, and simple MEDIUM style nits) — keep it to one line:
🔵 **`src/utils/format.ts:12`** — Redundant `String()` cast, `value` is already a string.Non-trivial findings (CRITICAL/HIGH, and any MEDIUM worth explaining) — use this structure:
🔴 **`src/api/session.ts:88`** — `token` is read before the null check, so an expired session throws instead of redirecting to login.
```ts
// src/api/session.ts:85-92
function getUser(req) {
const token = req.session.token.value; // <-- crashes here if session is null
if (!req.session) return redirectToLogin();
return decode(token);
}
```
**How this bites:** a logged-out user hits any route calling `getUser()` — e.g. `middleware/auth.ts:14` — and gets a 500 instead of a login redirect.
**Fix:** check `req.session` before touching `.token`:
```ts
function getUser(req) {
if (!req.session) return redirectToLogin();
return decode(req.session.token.value);
}
```Rules for the non-trivial structure:
- Always show the offending code, not just a prose description. Include enough surrounding lines (or the calling site, in a second snippet) for the flaw to be self-evident.
- Add a How this bites scenario only when the failure mode isn't obvious from the code alone — e.g. concurrency, a specific input shape, an interaction between two call sites. Skip it when the snippet already speaks for itself.
- Always end with a Fix — concrete replacement code, not just advice in prose. Keep it as small as the actual fix; don't pad with unrelated cleanup.
- Use the real language for code fences (
ts,py,go, ...), and a// path:linescomment on the first line when the snippet is longer than a couple of lines. When the file is a template layered on a well-known format — a Helm/Go.tpl, Jinja, EJS — fence it as the underlying format (yaml,html, ...), not the template engine's own name: the engine's tag is rarely a real highlighter language, and the underlying format still covers most of the snippet's lines. - If you run a command to verify a claim, show it in a fenced block (
```bashfor the command, or```consoleif you're showing a$ commandline together with its output) — a bare$ commandline outside a fence renders as flat, unhighlighted text.
If there are zero findings, output exactly: No issues found.
Review criteria
Correctness & robustness
- Off-by-one errors, unhandled edge cases, incorrect assumptions about input ranges
- Missing null/undefined/empty checks at system boundaries (user input, external API responses)
- Race conditions, unhandled async errors, missing await
- Error paths that silently swallow exceptions
Tests
- Non-trivial logic (branches, transformations, error handling) without any test
- Tests that only assert the happy path for logic with meaningful edge cases
- Trivial tests (testing a getter, a type assertion, a constant) — flag as redundant
- Tests that duplicate production logic rather than asserting outcomes
Code quality
- Functions doing more than one thing; could be decomposed without ceremony
- Abstractions introduced before they are needed (YAGNI violations)
- Duplication that could share a single well-named helper
- Overuse of comments explaining what instead of why; or comments that are just noise
Project conventions
Derived from Step 3 — flag any violation of rules found in CLAUDE.md, AGENTS.md, README.md, CONTEXT.md, or docs/**. If no convention documents exist, skip this category.
Simplicity & clarity
- Variable or function names that require a comment to understand
- Deeply nested conditionals that could be flattened with early returns
- Unnecessary state; derived values stored instead of computed
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

