Pre-merge diff review skill for Claude Code
A Claude Code skill that reviews your branch against its base for correctness bugs, unhandled errors, broken edge cases and missing tests, and reports findings by severity with file and line.
Skill in Engineering by AISkillHub Library
What it does
This skill teaches Claude Code a repeatable way to review the changes on your current branch before you open or merge a pull request. Instead of skimming the diff, it finds the merge base, reads the full files around each change, checks callers of anything whose signature or behavior changed, and then works through a fixed checklist.
**What it checks** - Logic errors: off-by-one, inverted conditions, wrong variable, missing `await`, unhandled promise or exception paths. - Edge cases: empty input, null or missing values, large inputs, concurrent calls, partial failures. - Contract changes: renamed fields, changed return types, removed parameters, and whether every caller was updated. - Resource handling: unclosed files, connections or listeners, missing timeouts. - Tests: whether new behavior has a test and whether changed behavior broke an existing assertion.
**Output** Findings are grouped as *Blocker*, *Should fix* and *Nit*. Each one has a `path:line` reference, a one-sentence explanation of the failure scenario, and a concrete fix. Anything Claude could not confirm by reading code is labelled "unverified" rather than stated as fact.
**What it will not do** It does not edit files unless you ask, it does not comment on formatting that a linter or formatter already enforces, and it does not run a security audit (use a dedicated security reviewer for that). It also will not pad the report: if the diff looks correct, it says so.
**Example** You: "review my changes before I push" Claude: finds base `origin/main`, reviews 6 changed files, and reports one blocker (`src/billing/invoice.ts:88`, `total` is computed before discounts are applied when `items` is empty) and two nits.
How to use it
1. Create the folder `.claude/skills/diff-review/` in your repository (or `~/.claude/skills/diff-review/` to use it in every project). 2. Save the file below as `SKILL.md` inside that folder. 3. Start Claude Code in the repository. The skill loads automatically when you ask for a review ("review my branch", "is this ready to merge?"), or you can call it directly with `/diff-review`. 4. If your default branch is not `main` or `master`, say which branch to compare against, for example `/diff-review develop`. 5. Commit the folder so the whole team gets the same review checklist.
Files
Save each file at the path shown, relative to your project root.