code-review
Review changes since a fixed point along Standards and Spec axes with parallel sub-agents. Invoke only when the user asks to review a branch, PR, work in progress, or changes since a commit, branch, tag, or merge-base.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- code-review
- description
- Review changes since a fixed point along Standards and Spec axes with parallel sub-agents. Invoke only when the user asks to review a branch, PR, work in progress, or changes since a commit, branch, tag, or merge-base.
03 SKILL.md 正文
Code Review
Review the diff between HEAD and a fixed point the user supplies, along
exactly two axes:
- Standards: does the code conform to this repository's documented coding standards?
- Spec: does the code implement the originating issue or specification?
Run both axes as parallel sub-agents, then aggregate their findings.
1. Pin the fixed point
- Use the fixed point named by the user: a commit SHA, branch name, tag,
main,HEAD~5, or another git revision. - If the user names no fixed point, ask for one and stop.
- Run
git rev-parse <fixed-point>. If it fails, report the failure and stop. - Capture
git diff <fixed-point>...HEAD(three-dot) andgit log <fixed-point>..HEAD --oneline. - If the diff is empty, report
empty diffand stop.
2. Identify the spec source
Use the first source that yields a specification:
- Issue references in the commit messages (
#123,Closes #45,!67, and similar), fetched through the repository's documented tracker workflow. - A path passed in
$ARGUMENTS. - A file under
docs/,specs/, or.scratch/whose name matches the branch name or feature. - Ask the user where the specification is.
- If the user says there is none, mark the Spec axis
skipped, reasonno spec available.
3. Identify the standards sources
- Collect every repository file that documents how code is written, such as
CODING_STANDARDS.mdorCONTRIBUTING.md. - Add the smell baseline in section 4 to the Standards axis.
Apply the smell baseline with these limits:
- The repository overrides. A documented repository standard wins; where it endorses a baseline smell, suppress that smell.
- Advisory only. Every smell is a labelled heuristic (
possible Feature Envy), never a hard violation. Skip anything tooling already enforces.
4. Smell baseline
Each smell names what it is and how to fix. Match it against the diff:
- Mysterious Name: a function, variable, or type whose name does not reveal what it does or holds. Fix: rename it; if no honest name exists, the design is unclear.
- Duplicated Code: the same logic shape appears in more than one hunk or file. Fix: extract the shared shape and call it from both.
- Feature Envy: a method reaches into another object's data more than its own. Fix: move the method onto the data it envies.
- Data Clumps: the same few fields or parameters keep travelling together. Fix: bundle them into one type and pass that.
- Primitive Obsession: a primitive or string stands in for a domain concept. Fix: give the concept its own type.
- Repeated Switches: the same
switchorifcascade on the same type recurs across the change. Fix: replace with polymorphism or one shared map. - Shotgun Surgery: one logical change forces scattered edits across many files. Fix: gather what changes together into one module.
- Divergent Change: one file or module is edited for several unrelated reasons. Fix: split so each module changes for one reason.
- Speculative Generality: abstraction, parameters, or hooks added for needs the specification does not have. Fix: delete it and inline until a real need exists.
- Message Chains: long
a.b().c().d()navigation the caller must not depend on. Fix: hide the walk behind one method on the first object. - Middle Man: a class or function that only delegates onward. Fix: remove it and call the target directly.
- Refused Bequest: a subclass or implementer ignores or overrides most of what it inherits. Fix: replace the inheritance with composition.
5. Spawn both sub-agents in parallel
Start each reviewer with a fresh context
(inherit_context: false, no resume). Issue both calls together in the
foreground (run_in_background: false), then aggregate their returned reports.
Include the following in the Standards sub-agent prompt:
- The diff command and the commit list.
- Every standards source path from step 3.
- The full smell baseline from section 4.
- This brief: "Report, per file or hunk, (a) every place the diff violates a documented standard: cite the standard by file and rule; and (b) any baseline smell you find: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repository standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
Include the following in the Spec sub-agent prompt:
- The diff command and the commit list.
- The path or contents of the specification.
- This brief: "Report: (a) requirements the specification asked for that are missing or partial; (b) behaviour in the diff that the specification did not ask for; (c) requirements that look implemented but whose implementation looks wrong. Quote the specification line for each finding. Under 400 words."
If the spec source is absent, spawn only the Standards sub-agent.
6. Aggregate
- Print the Standards report under
## Standards. - Print the Spec report under
## Spec. - Do not merge or re-rank findings; the two axes stay separate.
- End with one line: total findings per axis and the highest-severity finding within each axis.
- Do not select a single finding across axes.
Exclusions
- Apply no fixes; this skill reports only.
Why two axes
A change can pass one axis and fail the other:
- Code that follows every standard but implements the wrong thing: Standards pass, Spec fail.
- Code that does exactly what the issue asked but breaks the repository's conventions: Spec pass, Standards fail.
Reporting them separately stops one axis from masking the other.
04 同仓库更多 Skills
writing-for-agents
Reference for writing documents an agent consumes: skills, AGENTS.md or CLAUDE.md, and docs reached by a pointer. Invoke when creating or editing a skill or an agent instruction file, or when a document's pointer wording, load, or structure is in question. Do not invoke merely because the user mentions writing-for-agents, names a skill, or writes 'skill <word>'.
wizard
Generate an interactive bash wizard for steps only a human can perform. Invoke when the user asks for a script or wizard for manual setup: infrastructure provisioning, credentials or CI secrets, a third-party dashboard, or a one-off migration or cutover. Do not invoke for steps the agent can perform, or merely because the user mentions wizard, names a skill, or writes 'skill <word>'.
wait-what
Stop and re-pitch the last message in plain, simplified language.
to-tickets
Split an agreed specification into reviewable vertical-slice issues with explicit blockers, then publish them after confirmation.
to-spec
Turn the current conversation into a specification and publish it after confirmation.
to-pr
Create a pull request from the current branch.