|
| 1 | +Quickstart: |
| 2 | + |
| 3 | +```bash |
| 4 | +npx skills add mattpocock/skills --skill=code-review |
| 5 | +``` |
| 6 | + |
| 7 | +```bash |
| 8 | +npx skills update code-review |
| 9 | +``` |
| 10 | + |
| 11 | +[Source](https://github.com/mattpocock/skills/tree/main/skills/engineering/code-review) |
| 12 | + |
| 13 | +## What it does |
| 14 | + |
| 15 | +`code-review` reviews the diff between `HEAD` and a fixed point you supply — a commit, branch, tag, or merge-base — along two separate axes: **Standards** (does the code follow this repo's documented conventions?) and **Spec** (does it implement what the originating issue or PRD asked for?). It runs each axis as its own parallel sub-agent and reports them side by side. It never merges or re-ranks the two sets of findings — keeping them separate is the whole point, because a change can pass one axis and fail the other, and a single blended verdict lets one mask the other. |
| 16 | + |
| 17 | +## When to reach for it |
| 18 | + |
| 19 | +Type `/code-review`, or the agent reaches for it automatically when you ask to review a branch, a PR, work-in-progress changes, or anything "since X". |
| 20 | + |
| 21 | +Reach for this when there is a diff to judge against a known-good point and you want the two questions — *is it built right?* and *is it the right thing?* — answered independently. It runs at the end of the build loop; for actually writing the code test-first, use [tdd](https://aihero.dev/skills-tdd), and for building a whole spec into code use [implement](https://aihero.dev/skills-implement), which runs its own `/code-review` pass before committing. |
| 22 | + |
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +The **Spec** axis needs somewhere to find the originating spec — an issue reference in the commit messages, a path you pass in, or a PRD under `docs/`/`specs/`. That issue-tracker wiring comes from [setup-matt-pocock-skills](https://aihero.dev/skills-setup-matt-pocock-skills); without a spec the Spec axis simply skips and says so. The **Standards** axis needs nothing set up — it always carries a built-in Fowler smell baseline even in a repo that documents no conventions. |
| 26 | + |
| 27 | +## Two axes, never merged |
| 28 | + |
| 29 | +The defining idea is the **two axes**. **Standards** asks whether the diff conforms to how this repo writes code — its `CODING_STANDARDS.md` or `CONTRIBUTING.md`, plus a fixed baseline of ~12 Fowler code smells (Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, …). Two rules keep the baseline safe: a documented repo standard always overrides it, and every smell is a judgement call, never a hard violation. **Spec** asks the orthogonal question — does the code do what the issue or PRD actually asked, without missing requirements or smuggling in scope creep? |
| 30 | + |
| 31 | +They run as parallel sub-agents so neither pollutes the other's context, and the final report presents them under separate `## Standards` and `## Spec` headings with a per-axis summary. There is deliberately no single winner across axes. |
| 32 | + |
| 33 | +## It's working if |
| 34 | + |
| 35 | +- It pins and confirms the fixed point first (`git rev-parse`), failing fast on a bad ref or empty diff rather than inside the sub-agents. |
| 36 | +- Standards and Spec findings arrive in two distinct blocks, each citing its source — a repo standard or baseline smell for one, a quoted spec line for the other. |
| 37 | +- When no spec can be found, the Spec axis reports "no spec available" instead of inventing requirements. |
| 38 | + |
| 39 | +## Where it fits |
| 40 | + |
| 41 | +`code-review` is the review step at the tail of the main build chain: |
| 42 | + |
| 43 | +```txt |
| 44 | +grill-with-docs → to-prd → to-issues → implement → code-review |
| 45 | +``` |
| 46 | + |
| 47 | +Its closest neighbour is [implement](https://aihero.dev/skills-implement), which drives the build and calls this as its own review pass before committing; upstream, the spec it checks against is produced by [to-prd](https://aihero.dev/skills-to-prd) and [to-issues](https://aihero.dev/skills-to-issues). When you're unsure which skill or flow fits, [ask-matt](https://aihero.dev/skills-ask-matt) routes you. |
0 commit comments