principle-refactoringlisted
Install: claude install-skill lugassawan/swe-workbench
# Refactoring Discipline
Structural change without behavior change. For the GoF pattern catalog, see `principle-design-patterns`. For naming and function-length aesthetics, see `principle-clean-code`.
## The discipline
Four non-negotiable rules:
- **Every step preserves behavior.** Tests must pass before and after each step.
- **No feature changes during refactoring.** Find a bug? Note it — fix it in a separate commit.
- **Small steps.** Each step is independently reviewable and revertable.
- **Green between steps.** Run tests after each move. If red, revert immediately.
## Smells → moves
| Smell | Triggering move(s) |
|---|---|
| Long Method | Extract Function, Decompose Conditional, Replace Temp with Query — *Quality stage (`workflow-development`) gives the objective trigger via cyclomatic / cognitive complexity thresholds* |
| Large Class | Extract Class, Extract Interface, Move Function — *Quality stage (`workflow-development`) gives the objective trigger via file / class length* |
| Feature Envy | Move Function, Move Field |
| Data Clumps | Introduce Parameter Object, Extract Class |
| Primitive Obsession | Replace Primitive with Object, Introduce Parameter Object |
| Shotgun Surgery | Move Function, Move Field, Inline Function |
| Divergent Change | Extract Class (split responsibilities) |
| Speculative Generality | Inline Function, Collapse Hierarchy, Remove Middle Man |
## Fowler's catalog (key moves)
- **Extract Function** — when a block of code has a name th