code-critique

Installation
SKILL.md

Code Critique

Review whatever code you're pointed at. Report only violations. No praise, no restating what the code does. If asked to fix rather than review, apply the fixes.

Report every finding regardless of how expensive its fix is: a rename rippling through fifty call sites is still a finding — state it with its blast radius and let the human set the churn budget. Never trade a finding away against "minimal code" silently; goal 1 constrains the code you write, not the problems you report. A scoped request ("review the comments this branch adds") narrows what you fix, not what you may flag.

Each finding: location — problem — concrete fix — principle violated. For example:

src/auth.ts:42buildAuthContext(data) accepts arbitrary data and is only safe if verifySession() was called first (temporal coupling). Fix: merge into authContextFromToken(token) that verifies internally, and stop exporting AuthContext so that's the only way to get one. (misuse-resistance)

Judge against four goals:

  1. Minimal code. Flag anything not needed for the actual job: boilerplate, speculative generality, layers that only forward calls, dead configuration. Extra code is justified only when it serves goals 2–4. Raw counts of variables, helpers, or lines are not goals; a named local or domain operation can reduce cognitive load even when it adds a declaration.
  2. Essential complexity only. Essential complexity is inherent to the problem; accidental complexity comes from our tools and choices (Brooks). Flag the accidental kind. Structure, names, and types should minimize the cognitive load of whatever essential complexity remains.
  3. Misuse resistance. Interfaces must be easy to use correctly and hard to use incorrectly. Apply the misuse-resistance skill.
  4. Reviewability (local reasoning). Humans review diffs (GitHub PR UI) seeing only a few lines of context, and they verify code against what names and types claim — under time pressure, nobody opens distant definitions. Anything whose correctness can't be verified from the visible lines alone — misleading names, invisible preconditions, action at a distance, nesting whose governing conditions sit above the fold, comments whose referents live outside the file — will slip mistakes past human review.

Where the code touches their domains, also apply: naming, un-nesting, self-documenting-code, writing-comments, type-driven-design, abstraction-and-coupling, composition-over-inheritance, dependency-injection, state-and-pipelines, testing. When writing or amending code (not just reviewing), writing-comments and naming govern every comment and identifier you produce, type-driven-design governs every type and signature, and testing governs whether and how tests are added.

Installs
8
Repository
jyecusch/skills
First Seen
14 days ago
code-critique — jyecusch/skills