Skip to content
Skillpedia
General coding310k Β· #101

code-review

What it does

It compares the changes since a chosen point in your code history against two questions: does the code follow your coding rules, and does it match what was asked. It is for developers reviewing work before merging.

When to use it

  • βœ“When you want to review a branch, pull request, or work in progress before merging.
  • βœ“When you need to know whether the code matches the original issue or spec.
  • βœ“When you want to confirm the changes follow your repo's documented standards.

Skill link

https://github.com/mattpocock/skills/blob/main/skills/engineering/code-review/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/mattpocock/skills/blob/main/skills/engineering/code-review/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œReview the changes on my branch since main against our coding standards and the original ticket.”

5 new skills a week. 1 minute to read.

How it works

The agent picks a starting point in the code history, then runs two separate reviews at the same time, one for standards and one for the spec. It then reports both results together.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Two-axis review of the diff between HEAD and a fixed point the user supplies:

  • Standards: does the code conform to this repo's documented coding standards?
  • Spec: does the code faithfully implement the originating issue / spec?

Both axes run as parallel sub-agents so they don't pollute each other's context, then this skill aggregates their findings. Start every sub-agent with a fresh context window.

The issue tracker should have been provided to you. If not, tell the user to run /setup-matt-pocock-skills.

Process

1. Pin the fixed point

Whatever the user said is the fixed point (a commit SHA, branch name, tag, main, HEAD~5, etc.). If they didn't specify one, ask for it.

Capture the diff command once: git diff <fixed-point>...HEAD (three-dot, so the comparison is against the merge-base). Also note the list of commits via git log <fixed-point>..HEAD --oneline.

Before going further, confirm the fixed point resolves (git rev-parse <fixed-point>) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.

2. Identify the spec source

Look for the originating spec, in this order:

  1. Issue references in the commit messages (#123, Closes #45, GitLab !67, etc.), fetched via the workflow in the tracker doc.
  2. A path the user passed as an argument.
  3. A spec file under docs/, specs/, or .scratch/ matching the branch name or feature.
  4. If nothing is found, ask the user where the spec is. If they say there isn't one, the Spec sub-agent will skip and report "no spec available".

3. Identify the standards sources

Search the repo for every file that documents how code should be written. When CODING_STANDARDS.md or CONTRIBUTING.md exists, it must be on the list.

On top of whatever the repo documents, the Standards axis always carries the smell baseline below: a fixed set of Fowler code smells (Refactoring, ch.3) that applies even when a repo documents nothing. Two rules bind it:

  • The repo overrides. A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
  • Always a judgement call. Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation. Like any standard here, skip anything tooling already enforces.

Each smell reads what it is β†’ how to fix; match it against the diff:

  • Mysterious Name: a function, variable, or type whose name doesn't reveal what it does or holds. β†’ rename it; if no honest name comes, the design's murky.
  • Duplicated Code: the same logic shape appears in more than one hunk or file in the change. β†’ extract the shared shape, call it from both.
  • Feature Envy: a method that reaches into another object's data more than its own. β†’ move the method onto the data it envies.
  • Data Clumps: the same few fields or params keep travelling together (a type wanting to be born). β†’ bundle them into one type, pass that.
  • Primitive Obsession: a primitive or string standing in for a domain concept that deserves its own type. β†’ give the concept its own small type.
  • Repeated Switches: the same switch/if-cascade on the same type recurs across the change. β†’ replace with polymorphism, or one map both sites share.
  • Shotgun Surgery: one logical change forces scattered edits across many files in the diff. β†’ gather what changes together into one module.
  • Divergent Change: one file or module is edited for several unrelated reasons. β†’ split so each module changes for one reason.
  • Speculative Generality: abstraction, parameters, or hooks added for needs the spec doesn't have. β†’ delete it; inline back until a real need shows.
  • Message Chains: long a.b().c().d() navigation the caller shouldn't depend on. β†’ hide the walk behind one method on the first object.
  • Middle Man: a class or function that mostly just delegates onward. β†’ cut it, call the real target direct.
  • Refused Bequest: a subclass or implementer that ignores or overrides most of what it inherits. β†’ drop the inheritance, use composition.

4. Spawn both sub-agents in parallel

Issue both sub-agent calls together, in the foreground, and aggregate the reports they return.

Standards sub-agent prompt should include:

  • The full diff command and commit list.
  • The list of standards-source files you found in step 3, plus the smell baseline from step 3 pasted in full (the sub-agent has no other access
FAQ

What do I need to give the agent before it starts?

A fixed point to compare against, such as a commit, branch, or tag. If you do not give one, the agent asks for it.

Where does it find the spec?

It looks at issue numbers in commit messages, a path you give it, or spec files in folders such as docs or specs.

Does the review run in one long pass?

No. The two checks run in separate sub-agents so they do not affect each other's thinking.

Details

Original description by the author

Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\".

repo: mattpocock/skills

Popularity

GitHub stars
310k
Ranking position
#101
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills