refactoring
Originally fromthebushidocollective/han
Installation
SKILL.md
Refactoring Guide Skill
Refactoring is the process of restructuring existing computer code—changing the factoring—without changing its external behavior.
Core Refactoring Patterns
1. Composing Methods
- Extract Method: If a method is too long or complex, turn a fragment of it into its own method.
- Inline Method: If a method body is as clear as its name, move the body into the callers and delete the method.
2. Moving Features Between Objects
- Move Method/Field: Relocate logic to the class where it most naturally belongs to reduce coupling.
3. Simplifying Expressions
- Decompose Conditional: Extract complex conditional logic into clearly named methods.
- Consolidate Conditional Expression: Merge multiple conditional checks that lead to the same result.