Skip to content
AI & Agents
Skill

/code-review

Review changed code for naming, stale references, unnecessary complexity, and comment quality. Use after completing implementation work, before committing, or when the user asks to review or audit code.

From plugin
skills
1.5k38 skills

Claude Code

$ npx -y skills add dzhng/skills --skill code-review --agent claude-code

SKILL.md

code-review.SKILL.md
name: code-review
description: Review changed code for naming, stale references, unnecessary complexity, and comment quality. Use after completing implementation work, before committing, or when the user asks to review or audit code.
allowed-tools: Read Grep Glob Bash

Code Review

Review the diff or specified files against these principles.

1. Names must reflect current reality

  • Variable and function names should describe what they ARE, not what they used to be.
  • If the underlying mechanism changed (e.g. FUSE → NFS), all related names must update.
  • Ask: would a new reader be confused by this name?

2. No stale references

  • After refactoring, grep for references to the old approach — dead detection logic, abandoned feature flags, comments mentioning removed code.
  • If something was tried and reverted, remove ALL traces. The codebase should look like the current approach was always the plan.

3. Simplify detection and guard logic

  • A gate like "can this feature run" should check the ONE thing that actually matters.
  • Don't chain fallback detections (binary exists OR source exists OR toolchain exists) when one check covers it.

4. Comments document WHY, not WHAT HAPPENED

  • **Keep:** non-obvious technical discoveries, platform quirks, "if you remove this, X breaks because Y."
  • Good: `// com.apple.provenance causes SIGKILL when spawned as child process`
  • Good: `// umount while server is alive panics the macOS NFS client`
  • Good: `// NFS client uses cookie verifier to decide if cached readdir is valid`
  • **Remove:** narrative of what was tried, what was abandoned, what was renamed.
  • Bad: `// We changed this from cp to cat to work around the provenance issue`
  • Bad: `// Wrapper added because FUSE-T was zero-padding (see commit abc123)`
  • Bad: `// Previously this was called fuseAvailable but we renamed it`
  • **Remove:** comments that just restate what the code does without adding reasoning.
  • Often no comment is needed at all.

5. Separate install-time from runtime

  • Install scripts set up prerequisites (toolchains, system deps).
  • Runtime commands handle compilation, caching, binary management.
  • Don't mix these. If the install script is compiling binaries that the runtime also compiles, one of them is wrong.

6. No intermediary artifacts

  • After iterating through multiple approaches, audit for logic that only existed as a stepping stone.
  • If a workaround was added for approach A and you switched to approach B, remove the workaround even if it's harmless.
  • The code should read as if written from scratch by someone who already knew the right answer.

7. Tighten guarantees after changes

  • When a change makes something guaranteed (e.g. a variable is now always set, a file is always created, a function always returns), audit downstream code that still guards against the old "maybe" state.
  • Redundant null checks, fallback defaults, and `if (x)` guards on values that can no longer be null are misleading — they imply a possibility that doesn't exist.
  • Prefer `const` over `let` when reassignment is no longer needed.
  • **Never suppress a signal — fix the root cause.** `_` prefix on unused params, `// @ts-ignore`, `eslint-disable`, `as any` — these all hide real issues. If a parameter is unused, DELETE it and cascade the removal to every caller. If a type doesn't match, fix the type. Run the checker, fix every error, repeat. Mechanical changes across many files is exactly what an agent excels at — there is no "too many callers."

8. When changes are tangled, start clean

  • If a file has been through 3+ rounds of conflicting edits, `git restore` it and re-apply only what's needed.
  • Don't try to surgically fix a mess — starting clean is faster and less error-prone.

9. Tests must verify actual values, not just collection sizes

  • When testing deduplication, normalization, or idempotent operations, assert on the **stored value**, not just `toHaveLength(1)`.
  • Length alone doesn't prove the logic worked — a broken normalizer could silently drop one input, or store two different normalized forms that happen to match.
  • Pattern: add value in format A, re-add in format B, then assert both that the count is 1 AND that the stored value equals the expected normalized form.
  • Bad: `expect(data.phones).toHaveLength(1)` — passes even if normalization is broken
  • Good: `expect(data.phones).toHaveLength(1); expect(data.phones[0]).toBe('+12125551234')` — proves normalization recognized both formats

10. No thin wrappers or re-export-only modules

  • If a module only forwards another package's functions or types, delete it and import the original package directly.
  • Do not preserve local compatibility shims for scaffold code or unshipped branch work. Replace the scaffold outright.
  • No barrel files: never write an `index.ts` that only re-exports other modules. Import from the module that defines the name.
  • Prefer using the upstream API name directly over inventing local aliases like `discoverAll()` for `loadSkills()`.

11. Extract only around real ownership boundaries

  • Do not split files just to reduce line count. A new file should own a coherent responsibility that a reader can name.
  • Extract modules when they concentrate related policy, state transitions, resource handling, or domain-specific behavior.
  • Avoid moving one-off helper functions into a new file if the caller still needs to understand all the details to use them.
  • A good split usually reduces import pressure in the original file because dependencies move with the responsibility they serve.
  • If extraction increases total indirection without clarifying ownership, keep the code local.

12. Decouple tests from implementation — drive the system end-to-end

The most valuable test suite is the one most decoupled from the implementation it covers. Decoupled to the point where you exercise the backend by driving the frontend, and exercise a module by going through the same entry point

Read more
@dzhng
Ships withskills

AI skills for growing software farms. My personal library of domain-agnostic agent skills, reused across every project. Small, composable, and hackable — works with any harness that supports skills: Claude Code, Codex, opencode, Cursor, duet, and 70+ others.

Stars on GitHub

Momentum

stars in total
1.5k
Star history of dzhng/skills on GitHub, a chart by star-history.com

Other skills on skills.

audit-agents

audit-agents

Audit or rewrite AGENTS.md so it holds only lasting principles. Run it only when the user asks for it by name; never invoke it on…

@dzhng@dzhngInstall Skill
eval-skills

eval-skills

Eval and improve a skill against golden cases — run the target skill blind in a fresh, context-free subagent on each example…

@dzhng@dzhngInstall Skill
write-skills

write-skills

Create or revise agent skills. Use when adding a new skill file, renaming a skill, simplifying an existing skill, improving…

@dzhng@dzhngInstall Skill
cinematic-shot

cinematic-shot

Shoot software UI like a film. A sequence of hero shots, each a steep, oblique, extreme close-up of the interface floating in…

@dzhng@dzhngInstall Skill
isometric-motion

isometric-motion

Build animations and interactive elements (explainers, figures, hero visuals, step-through walkthroughs) in the crafted isometric…

@dzhng@dzhngInstall Skill
launch-video

launch-video

Make a showreel-grade motion-graphics launch video, with music, that introduces a CLI, library, or product from its repo. Use…

@dzhng@dzhngInstall Skill

More skills from other plugins.

1password

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

openclaw3w393k
@openclaw@openclawInstall Skill

Questions about code-review.

Which coding agents can use code-review?
code-review installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.