Browse · Refactoring

Code Craft

Refactoring

Martin Fowler

1st ed.

Bad code isn't a character flaw, it's what happens under deadline pressure. This is the disciplined, test-backed way to fix it one small step at a time — not a rewrite.

About the book

Martin Fowler's core loop is deceptively simple: verify tests pass, apply one small structural change, verify tests still pass. Refactoring never changes what code does, only how it's organized — which is exactly why big-bang rewrites fail, since they tangle structural change with behavioral change until nobody can tell what broke what. The book pairs a catalog of code smells (where to look) with named transformations like Extract Method and Decompose Conditional (what to do).

Best used for

  • —Extracting a method or decomposing a tangled conditional safely
  • —Diagnosing a code smell and picking the right named refactoring for it
  • —Restructuring code before adding a feature, without resorting to a rewrite

“Martin Fowlers 'Refactoring' is in my opinion the best book about this subject.”

— Damian, Goodreads

Install this skill

Pick your agent and run the command in your terminal. The skill installs globally, so it's available in every project.

mkdir -p ~/.claude/skills/refactoring-patterns && curl -fsSL "https://codeload.github.com/wondelai/skills/tar.gz/main" | tar -xz -C ~/.claude/skills/refactoring-patterns --strip-components=2 "skills-main/refactoring-patterns"

Once installed, your agent loads it automatically when relevant. In Claude Code you can also invoke it with /refactoring-patterns.

Skill by wondelai/skills, licensed MIT.