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.
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.
Try these with the skill installed
Identify code smells in this module and suggest specific refactorings using refactoring-patterns skill
Code reviewRefactor this switch statement using Replace Conditional with Polymorphism using refactoring-patterns skill
RefactoringBreak this god class into smaller, focused classes using refactoring-patterns skill
Design improvementPlan a safe, incremental refactoring sequence for this legacy code using refactoring-patterns skill
Legacy codeInstall 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