Code Quality

Refactoring

Improving code design through systematic refactoring

Improve existing code design using Martin Fowler's systematic refactoring catalog. This skill helps your AI agent identify code smells, apply named refactoring patterns, and transform messy code into clean, well-structured designs — safely and incrementally.

Refactoring by Martin Fowler

Refactoring

by Martin Fowler

npx skills add wondelai/skills/refactoring-patterns

What your agent learns

Code Smells

Recognize symptoms like Long Method, Feature Envy, Data Clumps, and Shotgun Surgery that indicate deeper design problems.

Extract Method/Class

Pull out coherent pieces of logic into their own methods or classes to improve readability and reuse.

Replace Conditional with Polymorphism

Eliminate complex switch/if chains by using object-oriented polymorphism and strategy patterns.

Move Method/Field

Relocate behavior to the class that holds the data it operates on — keep behavior and data together.

Small, Safe Steps

Refactor in tiny increments with tests running between each step — never break working code.

Martin Fowler

Chief Scientist at Thoughtworks, author of multiple canonical SE books

Martin Fowler is the Chief Scientist at Thoughtworks and one of the most influential voices in software design. He has authored or co-authored multiple canonical software engineering books and is known for popularizing refactoring, continuous integration, and domain-specific languages.

View Book →

Try these with the skill installed

Identify code smells in this module and suggest specific refactorings using refactoring-patterns skill

Code review

Refactor this switch statement using Replace Conditional with Polymorphism using refactoring-patterns skill

Refactoring

Break this god class into smaller, focused classes using refactoring-patterns skill

Design improvement

Plan a safe, incremental refactoring sequence for this legacy code using refactoring-patterns skill

Legacy code

Install Refactoring

Free, open-source, and ready in 30 seconds.

npx skills add wondelai/skills/refactoring-patterns

MIT Licensed · Works with Claude Code, Cursor, Claude Cowork & OpenClaw · No account needed