refactoring-patterns
refactoring patterns
What it does
- 5-6: a few smells remain (a Long Method, some duplication) but structure is mostly sound.
- ≤3: pervasive smells — tangled conditionals, God classes, duplication everywhere — or no tests to refactor safely.
- Smells cluster into five families: Bloaters, Object-Orientation Abusers, Change Preventers, Dispensables, Couplers
- Long Method is the most common smell; Duplicate Code is the most expensive
- A method that needs a comment to explain what it does is a smell — extract and name the block instead
- Shotgun Surgery (one change, many classes) and Divergent Change (one class, many reasons to change) are opposite signals of misplaced responsibilities
- Primitive Obsession — raw strings/ints instead of small domain objects — spreads errors and duplication
Requirements & configuration
- A method that needs a comment to explain what it does is a smell — extract and name the block instead
- Change Value to Reference when you need identity semantics (one shared Customer, not copies)
- | Extracting too many tiny methods | Indirection without clarity when names are poor | Each name must remove the need to read the body |
Derived from the skill's own SKILL.md documentation · extracted 2026-07-23
refactoring-patterns FAQ
What does the refactoring-patterns skill do?
Apply named refactoring transformations to improve code structure without changing behavior. Use when the user mentions "refactor this", "code smells", "extract method", "replace conditional", "technical debt", "move method", "inline variable", "decompose conditional", or "clean up this messy code". Also trigger when cleaning up legacy code, preparing code for new features by restructuring, or identifying which transformation fits a specific code smell. Covers smell-driven refactoring, safe transformation sequences, and testing guards. For code-quality foundations, see clean-code. For managing complexity, see software-design-philosophy. 5-6: a few smells remain (a Long Method, some duplication) but structure is mostly sound. ≤3: pervasive smells — tangled conditionals, God classes, duplication everywhere — or no tests to refactor safely.
What does refactoring-patterns require?
A method that needs a comment to explain what it does is a smell — extract and name the block instead Change Value to Reference when you need identity semantics (one shared Customer, not copies) | Extracting too many tiny methods | Indirection without clarity when names are poor | Each name must remove the need to read the body |
How do I install refactoring-patterns?
Run: npx -y skills add https://github.com/wondelai/skills --skill refactoring-patterns --agent claude-code — the source lives at github.com/wondelai/skills.
Maintain refactoring-patterns?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[refactoring-patterns on getagentictools](https://getagentictools.com/skills/wondelai-skills-refactoring-patterns?ref=badge) npx agentictools info skills/wondelai-skills-refactoring-patterns The second line is the CLI lookup for this page — handy in READMEs and docs.