Refactoring Patterns Skill
Installation
SKILL.md
Refactoring Patterns Skill
Safe transformations — same behavior, better structure.
Golden Rule
Tests pass before AND after.
When to Refactor
| Trigger | Action |
|---|---|
| Feature is hard to add | Refactor first |
| Same bug twice | Refactor to prevent |
| "I don't understand" | Refactor for clarity |
When NOT to Refactor
- No tests + time pressure
- Code won't change
- Right before release
- Should rewrite instead
Core Moves
| Move | When |
|---|---|
| Extract Function | Does too many things |
| Inline Function | Body clear as name |
| Extract Variable | Complex expression |
| Rename | Name doesn't reveal intent |
| Move Function | Uses other class's data |
Code Smells → Fix
| Smell | Refactoring |
|---|---|
| Long function | Extract Function |
| Long param list | Parameter Object |
| Duplicate code | Extract Function |
| Feature envy | Move Function |
| Large class | Extract Class |
Refactor vs Rewrite
| Refactor | Rewrite |
|---|---|
| Core logic sound | Design is wrong |
| Tests exist | Untestable |
| <30% changes | >70% changes |
Safe Workflow
Commit → Test → Small change → Test → Commit → Repeat
Synapses
See synapses.json for connections.
Related skills
More from fabioc-aloha/windowswidget
prompt engineering skill
Craft effective prompts that get the best results from language models.
3text-to-speech
Alex's voice synthesis capability for reading documents aloud
1socratic questioning skill
Help users discover answers, don't just deliver them.
1academic research skill
Patterns for thesis writing, dissertations, research papers, literature reviews, and scholarly work.
1work-life balance skill
Detect burnout signals and proactively support sustainable productivity.
1grant writing skill
Translate research vision into funded reality.
1