What problem does it solve?
This skill guides developers in identifying and eliminating code duplication (DRY - Don't Repeat Yourself), leading to cleaner, more maintainable, and less error-prone software.
Core Features & Use Cases
- Duplication Detection: Helps identify code smells like numbered variables, parallel function names, and near-identical logic.
- Refactoring Techniques: Provides a catalog of techniques such as Extract Function, Parameterize, Polymorphism, and Strategy Pattern.
- Strategic Guidance: Advises on when to refactor (Rule of Three) and, crucially, when not to abstract (coincidental similarity, premature abstraction).
- Use Case: When you notice similar blocks of code appearing multiple times in your project, use this skill to systematically apply refactoring techniques to consolidate logic and improve code structure.
Quick Start
To refactor duplicate logic, identify the repeated code, analyze its coupling, then apply a technique like 'Extract Function' to create a reusable abstraction.