---
name: code-smells
description: A 12-smell review vocabulary, named warning signs from Fowler's Refactoring, each with its fix. Use when reviewing code quality, judging a diff or pull request, or asked whether code is clean.
metadata:
  source: https://github.com/mattpocock/skills (code-review, the smell list)
  license: MIT
  pinned: "2026-11-28. Smell list adapted from mattpocock/skills code-review, after Fowler, Refactoring ch. 3. Wording is ours."
  adapted_by: "DevTribe Labs, MIT. https://github.com/DevDadTribe/toolbox"
---

# Code smells: 12 guide words for reviews

*The smell names come from Martin Fowler's book* Refactoring *(chapter 3). The idea of a short
list for agent reviews comes from the `code-review` skill in
[mattpocock/skills](https://github.com/mattpocock/skills). This text is our own.*

Name the smell in the finding, for example "possible Feature Envy at `<file:line>`", so every
agent and every model reports in the same words.

Three rules bind the list:

1. **The project overrides.** A written house standard (your `CLAUDE.md`, `AGENTS.md`, lint
   config or style guide) always wins. Where it endorses something this list would flag, do
   not report the smell. If the project marks a file as "small edits only", a smell there is a
   note, never a reason to restructure it.
2. **Always a judgment call.** A smell is a labelled heuristic, never a hard violation.
3. **Skip what tooling enforces** (linters, type checkers, formatters, pre-commit hooks).

Each smell: **what it is, then how to fix it**.

- **Mysterious Name**: a name that hides what it does or holds. Fix: rename it. If no honest name comes, the design is murky.
- **Duplicated Code**: the same logic shape in more than one place. Fix: extract the shared shape and call it from both.
- **Feature Envy**: a method that 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 that always travel together. Fix: bundle them into one type and pass that.
- **Primitive Obsession**: a raw string or number that stands in for a domain concept. Fix: give the concept its own small type.
- **Repeated Switches**: the same if/switch cascade on the same type in several places. Fix: one shared map, or polymorphism.
- **Shotgun Surgery**: one logical change forces scattered edits across many files. Fix: gather what changes together into one module.
- **Divergent Change**: one file edited for several unrelated reasons. Fix: split it so each module changes for one reason.
- **Speculative Generality**: abstraction, parameters or hooks for needs nobody has. Fix: delete it, and inline until a real need shows.
- **Message Chains**: long `a.b().c().d()` walks the caller should not know about. Fix: hide the walk behind one method on the first object.
- **Middle Man**: a layer that mostly passes calls on. Fix: cut it and call the real target directly.
- **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. Fix: drop the inheritance and compose instead.

---

*`code-smells` from [DevDad's Toolbox](https://github.com/DevDadTribe/toolbox). MIT. Adapted from mattpocock/skills.*
