Review all changes in the current branch compared to main/master. Covers correctness, security, performance, maintainability, and testing. Language-agnostic: detects languages in the diff and applies relevant standards. Use after completing work or before merging.
Shared Knowledge: This skill builds on brain/knowledge/code-review.md, brain/knowledge/coding-general.md, brain/knowledge/writing-style.md, and brain/knowledge/machine-privacy.md. Apply the first two when evaluating changes; writing-style applies both to prose in the diff (Step 4) and to the review write-up itself. All git inspection goes through the git-ops MCP per brain/knowledge/git-readonly-operations.md; never shell git. Stack detection and layer rules come from brain/knowledge/github-pr-stacks.md: a branch that is part of a PR stack is reviewed layer by layer, never as one flat diff.
Purpose
Review the work done in the current branch by comparing it against the base branch (main/master). Produce actionable, prioritized feedback covering all changed files regardless of language.
When to Use This Skill
After completing implementation work, before handing off
Before creating a pull request
When asked to review current changes
As a quality gate before merging
Do Not Use This Skill When
There are no changes to review (no diff)
The user wants a full codebase audit (not scoped to branch changes)
The task is writing code, not reviewing it
Review Process
Step 1: Scope the Review
Stack check first. Run gh stack view --json per brain/knowledge/github-pr-stacks.md.
Exit 0 means the current branch is part of a PR stack: scope per layer as described below.
Exit 2, or gh/the stack extension missing, means no stack: continue with the single-branch
steps. Any other outcome follows the detection table in that file.
Identify the base branch (main or master) via git_branch_list
git_log with ref: "<base>..HEAD" to understand the commit narrative
git_diff for the change set: pass fromRef: "<oldest-sha-from-step-2>^" (the fork point as a
revision expression) and toRef: "HEAD", with statOnly: true first to see all changed files. If
the branch contains merges from the base (fork point ambiguous), use fromRef: "<base>" instead and
disclose in the review that base drift may appear in the diff.
Identify which languages/frameworks are present in the diff
Retrieve prior reviews.vault_list with project: "code-reviews" (pass it explicitly) and scan
for earlier reviews of this repo or these files; vault_get close matches so recurring issues and prior
verdicts inform this pass. Treat them as dated precedent, not current truth; re-verify against the diff.
See brain/knowledge/vault-operations.md §"Artifact archives (pinned vault projects)".
When the branch is part of a stack, items 2-4 above are replaced by per-layer scoping: enumerate
the layers from the gh stack view --json output, and for each unmerged layer take git_diff with
fromRef: "<branch-below>...<layer-branch>" (three-dot; the bottom layer diffs against the trunk)
and git_log with ref: "<branch-below>..<layer-branch>". Step 2 (language detection) through
Step 5 (feedback) then run once per layer, bottom-up, since upper layers depend on lower ones.
Findings and the assessment verdict are per layer (each layer is its own PR and merges on its own);
a finding about code a lower layer introduced belongs to that lower layer. Item 6 (prior reviews)
still runs once for the whole stack. Never run any gh stack command other than view, and never
create or restructure a stack (github-pr-stacks.md ⛔ Hard Rules).
Step 2: Detect Language Context
Based on file extensions in the diff, apply the corresponding skill's standards:
Extensions
Apply Standards From
.ts, .tsx, .js, .jsx
reactjs, nextjs, or angular (based on imports)
.cs
csharp
.py
python
.rs
rust / rust-general
.gd
godot
.cpp, .h (with UE macros)
unreal-engine
.sql
postgres / azure-sql-server
.sh, .bash
linux-shell-scripting
.ps1, .psm1
windows-powershell-scripting
Mixed / other
coding-general.md only
Step 3: Review Each File
For every changed file, evaluate it across the review dimensions defined in brain/knowledge/code-review.md §2 (Correctness, Security, Performance, Maintainability, Testing), applying the language-specific standards routed in Step 2. Run each file against the concrete checklist in brain/knowledge/review-heuristics.md, and check the lessons vault (vault_list with project: "lessons", topic tags from the diff) for any prior gotcha the change might reproduce.
Step 4: Check Cross-Cutting Concerns
No unrelated changes mixed in (minimal diff principle)
No dead code introduced without justification
No secrets, credentials, or PII in the diff
Consistent style with the rest of the codebase
Dependencies added are justified and pinned
Hard Rules hold on every added/modified line: the language-agnostic ⛔ block in
brain/knowledge/coding-general.md (no re-implemented logic without an acknowledged reason, no
deprecated/obsolete APIs) plus the routed language skill's. Open that skill and walk its ⛔ Hard Rules
block item by item against the changed lines rather than gesturing at it. These override repo
conventions: "the codebase already does it" is not a pass. Each violation is at minimum an Important
finding. The scope boundary cuts both ways: pre-existing violations in untouched code are a Note at
most, never a demand to refactor; and conversely, a diff that DID refactor untouched code to satisfy a
Hard Rule is itself a scope-creep finding.
No duplicated logic. The diff doesn't re-implement something the repo already has: search
for the distinctive tokens of each new helper, mapper, or validator (git_grep or the native
search tools, never shell grep) per
brain/knowledge/review-heuristics.md §Maintainability. An unacknowledged near-duplicate is at
minimum Important.
No change-narration comments. Every comment the diff adds or edits describes the current
code, not the edit: nothing referencing the fix, the request, the old behavior, or the task that
produced it. Concrete tells in brain/knowledge/review-heuristics.md §Prose;
coding-general.md ⛔ Hard Rule 3. At minimum Important on touched lines.
No deprecated APIs. No added call is deprecated or obsolete in the version the project
pins, and build/linter output shows no new deprecation warnings from the diff. See
brain/knowledge/review-heuristics.md §Correctness.
No unprompted version bump. A version field changes in the diff (manifest version,
<Version> in a csproj, a VERSION file, __version__) only when the task was a release the user
asked for. On a project with no release yet (no release tag, registry publication, or live
deployment) the version never moves; the first release ships from the initial value.
coding-general.md ⛔ Hard Rule 5. At minimum Important.
Prose passes writing-style.md. Check every added/modified comment, docstring, doc file, and
markdown block in the diff against the hard bans; the Prose section of
brain/knowledge/review-heuristics.md has the concrete greps. A hard-ban violation on a touched line
is at minimum an Important finding; on untouched lines it's a Note, never a refactor demand.
No machine-identifying details (blocking). Run the machine-privacy.md self-check over the
diff. Any absolute local path, OS username, or hostname on an added/modified line is a Critical
finding, and the overall outcome cannot be APPROVED while one exists. On unchanged context lines it's
Important: report it, don't deadlock the branch on it. Judge hits against the file's "Not a violation"
carve-outs (OS-fixed paths, assessed-target details) before flagging.
No deliberate change reverted or weakened to pass a test. If the diff loosened a validation,
reintroduced a useless default, or rolled back an intentional tightening so an existing test passes,
that is a Critical finding: the stale test should change, not the production code. Also flag a
validation relaxation that spilled onto fields the change did not target. See
brain/knowledge/review-heuristics.md §Correctness.
Step 5: Produce Feedback
Consolidate the findings from Steps 3 and 4: de-duplicate overlapping ones, classify each per the
Severity Classification section below, and verify every file:line anchor actually points at the code
the finding quotes. Then emit the review using the Output Format below; the format block is the single
source of truth for the shape, so don't restate structure here.
Step 6: Archive the Review
Once the review is complete, archive it: vault_save with project: "code-reviews" passed explicitly, the
full review as the body. Name, summary (carry the overall assessment), and tags follow
brain/knowledge/vault-operations.md §"Artifact archives (pinned vault projects)".
Output Format
# Branch Review
## Summary
[1-2 sentence overview of what the branch does]
**Files changed**: [count]
**Languages**: [detected languages]
**Overall assessment**: APPROVED | CHANGES REQUESTED | CONCERNS
---
## Strengths
- [What was done well]
## Critical Issues (Must Fix)
1. **[Category]** `file:line`: [Issue description and why it matters]
- **Fix**: [Specific suggestion]
## Important Issues (Should Fix)
1. **[Category]** `file:line`: [Issue description]
- **Fix**: [Suggestion]
## Suggestions (Nice to Have)
1. `file:line`: [Improvement idea]
## Testing Assessment
- [ ] New code paths have test coverage
- [ ] Tests verify meaningful behavior
- [ ] Error paths are tested
## Notes
[Any observations about dead code spotted, architectural concerns for future, etc.]
For a stacked branch, open with a stack summary (the layers bottom-up, each with its branch, PR,
and verdict), then produce one full review block per layer in that order, titled with the layer's
branch and PR.
Severity Classification
Classify findings by severity and map to the overall outcome (Approved / Changes Requested / Rejected) per brain/knowledge/code-review.md §3 (Review Outcomes) and §4 (Feedback Structure): Critical (must fix before merge), Important (should fix), Suggestion (optional).
Review Principles
Review the diff, not the whole file: Focus on what changed. Don't flag pre-existing issues unless they're security-critical.
One concern per finding: Keep feedback atomic and addressable.
Provide fixes, not just problems: Show what "better" looks like.
Respect existing patterns: Don't suggest rewrites that contradict the project's conventions, except where a language skill marks a rule as a Hard Rule; those beat project conventions and must be flagged.
Acknowledge good work: Call out well-crafted solutions.
Context matters: A quick fix has different standards than a new feature.
1---2name: branch-review3description: Review all changes in the current branch compared to main/master. Covers correctness, security, performance, maintainability, and testing. Language-agnostic: detects languages in the diff and applies relevant standards. Use after completing work or before merging.4---56# Branch Review78> **Shared Knowledge**: This skill builds on `brain/knowledge/code-review.md`, `brain/knowledge/coding-general.md`, `brain/knowledge/writing-style.md`, and `brain/knowledge/machine-privacy.md`. Apply the first two when evaluating changes; writing-style applies both to prose in the diff (Step 4) and to the review write-up itself. All git inspection goes through the `git-ops` MCP per `brain/knowledge/git-readonly-operations.md`; never shell git. Stack detection and layer rules come from `brain/knowledge/github-pr-stacks.md`: a branch that is part of a PR stack is reviewed layer by layer, never as one flat diff.910## Purpose1112Review the work done in the current branch by comparing it against the base branch (main/master). Produce actionable, prioritized feedback covering all changed files regardless of language.1314## When to Use This Skill1516- After completing implementation work, before handing off17- Before creating a pull request18- When asked to review current changes19- As a quality gate before merging2021## Do Not Use This Skill When2223- There are no changes to review (no diff)24- The user wants a full codebase audit (not scoped to branch changes)25- The task is writing code, not reviewing it2627---2829## Review Process3031### Step 1: Scope the Review32331. **Stack check first.** Run `gh stack view --json` per `brain/knowledge/github-pr-stacks.md`.34 Exit 0 means the current branch is part of a PR stack: scope per layer as described below.35 Exit 2, or `gh`/the stack extension missing, means no stack: continue with the single-branch36 steps. Any other outcome follows the detection table in that file.372. Identify the base branch (`main` or `master`) via `git_branch_list`383. `git_log` with `ref: "<base>..HEAD"` to understand the commit narrative394. `git_diff` for the change set: pass `fromRef: "<oldest-sha-from-step-2>^"` (the fork point as a40 revision expression) and `toRef: "HEAD"`, with `statOnly: true` first to see all changed files. If41 the branch contains merges from the base (fork point ambiguous), use `fromRef: "<base>"` instead and42 disclose in the review that base drift may appear in the diff.435. Identify which languages/frameworks are present in the diff446. **Retrieve prior reviews.** `vault_list` with `project: "code-reviews"` (pass it explicitly) and scan45 for earlier reviews of this repo or these files; `vault_get` close matches so recurring issues and prior46 verdicts inform this pass. Treat them as dated precedent, not current truth; re-verify against the diff.47 See `brain/knowledge/vault-operations.md` §"Artifact archives (pinned vault projects)".4849**When the branch is part of a stack**, items 2-4 above are replaced by per-layer scoping: enumerate50the layers from the `gh stack view --json` output, and for each unmerged layer take `git_diff` with51`fromRef: "<branch-below>...<layer-branch>"` (three-dot; the bottom layer diffs against the trunk)52and `git_log` with `ref: "<branch-below>..<layer-branch>"`. Step 2 (language detection) through53Step 5 (feedback) then run once per layer, bottom-up, since upper layers depend on lower ones.54Findings and the assessment verdict are per layer (each layer is its own PR and merges on its own);55a finding about code a lower layer introduced belongs to that lower layer. Item 6 (prior reviews)56still runs once for the whole stack. Never run any `gh stack` command other than `view`, and never57create or restructure a stack (`github-pr-stacks.md` ⛔ Hard Rules).5859### Step 2: Detect Language Context6061Based on file extensions in the diff, apply the corresponding skill's standards:6263| Extensions | Apply Standards From |64|------------|---------------------|65| `.ts`, `.tsx`, `.js`, `.jsx` | reactjs, nextjs, or angular (based on imports) |66| `.cs` | csharp |67| `.py` | python |68| `.rs` | rust / rust-general |69| `.gd` | godot |70| `.cpp`, `.h` (with UE macros) | unreal-engine |71| `.sql` | postgres / azure-sql-server |72| `.sh`, `.bash` | linux-shell-scripting |73| `.ps1`, `.psm1` | windows-powershell-scripting |74| Mixed / other | coding-general.md only |7576### Step 3: Review Each File7778For every changed file, evaluate it across the review dimensions defined in `brain/knowledge/code-review.md` §2 (Correctness, Security, Performance, Maintainability, Testing), applying the language-specific standards routed in Step 2. Run each file against the concrete checklist in `brain/knowledge/review-heuristics.md`, and check the lessons vault (`vault_list` with `project: "lessons"`, topic tags from the diff) for any prior gotcha the change might reproduce.7980### Step 4: Check Cross-Cutting Concerns8182- [ ] No unrelated changes mixed in (minimal diff principle)83- [ ] No dead code introduced without justification84- [ ] No secrets, credentials, or PII in the diff85- [ ] Consistent style with the rest of the codebase86- [ ] Dependencies added are justified and pinned87- [ ] **Hard Rules hold on every added/modified line: the language-agnostic ⛔ block in88 `brain/knowledge/coding-general.md` (no re-implemented logic without an acknowledged reason, no89 deprecated/obsolete APIs) plus the routed language skill's. Open that skill and walk its ⛔ Hard Rules90 block item by item against the changed lines rather than gesturing at it.** These override repo91 conventions: "the codebase already does it" is not a pass. Each violation is at minimum an Important92 finding. The scope boundary cuts both ways: pre-existing violations in untouched code are a Note at93 most, never a demand to refactor; and conversely, a diff that DID refactor untouched code to satisfy a94 Hard Rule is itself a scope-creep finding.95- [ ] **No duplicated logic.** The diff doesn't re-implement something the repo already has: search96 for the distinctive tokens of each new helper, mapper, or validator (`git_grep` or the native97 search tools, never shell grep) per98 `brain/knowledge/review-heuristics.md` §Maintainability. An unacknowledged near-duplicate is at99 minimum Important.100- [ ] **No change-narration comments.** Every comment the diff adds or edits describes the current101 code, not the edit: nothing referencing the fix, the request, the old behavior, or the task that102 produced it. Concrete tells in `brain/knowledge/review-heuristics.md` §Prose;103 `coding-general.md` ⛔ Hard Rule 3. At minimum Important on touched lines.104- [ ] **No deprecated APIs.** No added call is deprecated or obsolete in the version the project105 pins, and build/linter output shows no new deprecation warnings from the diff. See106 `brain/knowledge/review-heuristics.md` §Correctness.107- [ ] **No unprompted version bump.** A version field changes in the diff (manifest `version`,108 `<Version>` in a csproj, a VERSION file, `__version__`) only when the task was a release the user109 asked for. On a project with no release yet (no release tag, registry publication, or live110 deployment) the version never moves; the first release ships from the initial value.111 `coding-general.md` ⛔ Hard Rule 5. At minimum Important.112- [ ] **Prose passes `writing-style.md`.** Check every added/modified comment, docstring, doc file, and113 markdown block in the diff against the hard bans; the Prose section of114 `brain/knowledge/review-heuristics.md` has the concrete greps. A hard-ban violation on a touched line115 is at minimum an Important finding; on untouched lines it's a Note, never a refactor demand.116- [ ] **No machine-identifying details (blocking).** Run the `machine-privacy.md` self-check over the117 diff. Any absolute local path, OS username, or hostname on an added/modified line is a Critical118 finding, and the overall outcome cannot be APPROVED while one exists. On unchanged context lines it's119 Important: report it, don't deadlock the branch on it. Judge hits against the file's "Not a violation"120 carve-outs (OS-fixed paths, assessed-target details) before flagging.121- [ ] **No deliberate change reverted or weakened to pass a test.** If the diff loosened a validation,122 reintroduced a useless default, or rolled back an intentional tightening so an existing test passes,123 that is a Critical finding: the stale test should change, not the production code. Also flag a124 validation relaxation that spilled onto fields the change did not target. See125 `brain/knowledge/review-heuristics.md` §Correctness.126127### Step 5: Produce Feedback128129Consolidate the findings from Steps 3 and 4: de-duplicate overlapping ones, classify each per the130Severity Classification section below, and verify every `file:line` anchor actually points at the code131the finding quotes. Then emit the review using the Output Format below; the format block is the single132source of truth for the shape, so don't restate structure here.133134### Step 6: Archive the Review135136Once the review is complete, archive it: `vault_save` with `project: "code-reviews"` passed explicitly, the137full review as the body. Name, summary (carry the overall assessment), and tags follow138`brain/knowledge/vault-operations.md` §"Artifact archives (pinned vault projects)".139140---141142## Output Format143144```markdown145# Branch Review146147## Summary148[1-2 sentence overview of what the branch does]149150**Files changed**: [count]151**Languages**: [detected languages]152**Overall assessment**: APPROVED | CHANGES REQUESTED | CONCERNS153154---155156## Strengths157- [What was done well]158159## Critical Issues (Must Fix)1601. **[Category]** `file:line`: [Issue description and why it matters]161 - **Fix**: [Specific suggestion]162163## Important Issues (Should Fix)1641. **[Category]** `file:line`: [Issue description]165 - **Fix**: [Suggestion]166167## Suggestions (Nice to Have)1681. `file:line`: [Improvement idea]169170## Testing Assessment171- [ ] New code paths have test coverage172- [ ] Tests verify meaningful behavior173- [ ] Error paths are tested174175## Notes176[Any observations about dead code spotted, architectural concerns for future, etc.]177```178179For a stacked branch, open with a stack summary (the layers bottom-up, each with its branch, PR,180and verdict), then produce one full review block per layer in that order, titled with the layer's181branch and PR.182183---184185## Severity Classification186187Classify findings by severity and map to the overall outcome (Approved / Changes Requested / Rejected) per `brain/knowledge/code-review.md` §3 (Review Outcomes) and §4 (Feedback Structure): Critical (must fix before merge), Important (should fix), Suggestion (optional).188189---190191## Review Principles192193- **Review the diff, not the whole file**: Focus on what changed. Don't flag pre-existing issues unless they're security-critical.194- **One concern per finding**: Keep feedback atomic and addressable.195- **Provide fixes, not just problems**: Show what "better" looks like.196- **Respect existing patterns**: Don't suggest rewrites that contradict the project's conventions, except where a language skill marks a rule as a Hard Rule; those beat project conventions and must be flagged.197- **Acknowledge good work**: Call out well-crafted solutions.198- **Context matters**: A quick fix has different standards than a new feature.
Run npx skillmds@latest add brenordv/branch-review in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Review all changes in the current branch compared to main/master. Covers correctness, security, performance, maintainability, and testing. Language-agnostic: detects languages in the diff and applies relevant standards. Use after completing work or before merging. It is listed under Security on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
brenordv (@brenordv) published this skill. Their other Agent Skills are listed on their SkillMD profile.