refactoring
Installation
SKILL.md
Refactoring Methodology
Systematic approach to auditing and improving code. Every change is evidence-based: count callers, show diffs, commit surgically.
Related Skills: See
post-implementation-reviewfor the full second-read ritual after implementation. Seecohesive-clean-breakswhen the refactor changes public shape, ownership, naming, or lifecycle boundaries. Seecontrol-flowfor linearizing conditionals and guard clauses. Seefactory-function-compositionfor the four-zone factory anatomy. Seemethod-shorthand-jsdocfor when to usethis.method()vs direct calls.
When to Apply This Skill
Use this methodology when you need to:
- Audit a module for code smells or unnecessary abstractions
- Inline single-use helper functions
- Eliminate raw/untyped access that bypasses a typed boundary
- Collapse duplicate switch/if branches that do the same thing
- Refactor function signatures (positional params → parameter objects)
- Derive types instead of duplicating fields