refactoring-best-practices
Installation
SKILL.md
Refactoring best practices
Use when improving existing code without changing behavior. Focus on small safe transformations, code smells, and test-backed cleanup.
Goal
- Refactor to make the code easier to understand, change, and extend without adding new functionality.
- Treat refactoring as a systematic, low-risk process rather than a rewrite.
Start with smell detection
- Look for common smells: long method, large class, duplicate code, long parameter list, data clumps, switch-heavy logic, shotgun surgery, feature envy, and message chains.
- Treat smells as signals, not laws. The smell points to a possible design problem; confirm it before changing code.
- Choose the smell that most directly blocks safe changes or comprehension right now.