Claude skill · Developers
Code review
A review that finds bugs, security and money risks with a failure scenario each, not style nits.
When Claude uses it (the skill's own description)
Review a diff, branch or pull request for bugs, security problems, data risks and missing tests, reported as findings with a failure scenario each, most serious first. Use when asked to review code, check a PR, look over a change, or before merging. Not a style review; it ignores formatting unless it hides a bug.
claude-code-setup-kit/skills/code-review/SKILL.md
The skill, as Claude reads it
Plain text you can open, read and edit.
# Code review The review's job is to find the change that will break in production, leak data, or cost money, and to say exactly how. Style belongs to the linter. ## Method 1. **Get the diff.** For a branch: `git diff main...HEAD`. For a PR: `gh pr diff <n>`. For the working tree: `git diff`. Read all of it before writing anything. 2. **Understand the intent** from the PR text, commit messages or the task. A change that does something other than what it claims is a finding. 3. **Trace every changed path for these, in order:** - **Correctness:** off-by-one, null and undefined, wrong comparison, missing await, race between two writers, error swallowed, a branch that cannot be reached, a default that changed. - **Security:** input reaching a query, a shell, a file path or HTML without validation; an id from a request not scoped to its owner; a permission check removed or moved after the action; secrets logged or returned. - **Money and data:** a price, total, VAT, quantity or currency decided by the client; a write that can happen twice; a migration that loses data or locks a large table; a deletion with no backup path. - **Reliability:** no timeout on a network call, unbounded loops or memory, retries without limit, a cache that never invalidates. - **Tests:** behaviour changed without a test that would fail before and pass after; a test edited to make it pass. - **Contract:** a public route, event, API shape or database column changed without the callers or readers being updated. 4. **For each finding, write the failure scenario**: the input or state, the step that goes wrong, the result. If you cannot write one, it is not a finding; it is a comment. 5. **Verify before reporting** where possible: run the tests, run the code path, read the callers. Mark each finding `confirmed` (you saw it fail or traced it fully) or `likely` (reasoned, not executed). 6. **Rank** by consequence: data loss and security first, money second, user-visible bugs third, maintainability last. Cut anything that is a preference. ## Output format ``` Scope: what was reviewed (branch, PR, files, lines of diff) Verdict: safe to merge / merge after fixing 1 and 2 / do not merge 1. [confirmed|likely] <file:line> <one-line claim> Scenario: <input or state> -> <what happens> -> <result> Fix: <the smallest change that resolves it> 2. … Not checked: anything you could not run or reach, stated plainly ``` Five findings well evidenced beat twenty guesses. If there is nothing serious, say so and list what you checked. ## Rules - Never rewrite the code in the review unless asked; propose the fix in a line. - No findings about naming, formatting, comment style or import order. - Do not assume the tests pass; run them if you can and report the output. - British spelling. No em dashes.