← ClaudeAtlas

refactor-masterlisted

Restructure messy code into smaller, more focused pieces — without changing observable behavior. Knows when to extract a function, split a module, replace a conditional with a strategy, pull pure logic out of side-effect-heavy code, and when to do nothing. Use when the user says "refactor this", "clean this up", "this file is too big", "split this module", "make this readable", or hands over a god-class and asks for a rescue plan.
ak-ship/fullstack-agent-skills · ★ 0 · AI & Automation · score 72
Install: claude install-skill ak-ship/fullstack-agent-skills
# refactor-master — change shape without changing behavior ## When to use this skill Trigger when the user wants the code reorganized but expects the same outputs. Strong signals: - "refactor this", "clean up", "split", "decompose", "extract" - "this file is 1200 lines, help" - "make this readable" - "pull the logic out of the React component" Do *not* trigger for: behavior changes (that's a feature, not a refactor), performance work (use `perf-hunter`), or a one-line rename (just do it). ## The output contract Refactors that: 1. **Preserve behavior** — every existing test still passes. If there are no tests, add a characterization test first (see step 2). 2. **Land in small steps** — each commit is independently reviewable and reverts cleanly. 3. **Reduce one specific kind of complexity** — say which one upfront (cyclomatic, depth, length, coupling, naming) and measure before/after. 4. **Don't leak new abstractions** — no `BaseFooFactoryProviderInterface` unless there are at least three concrete implementations that need it. ## Workflow ### 1 — Diagnose Read the target. Name the *specific* smell, out loud, before touching: - **Length**: function/file is too long → extract by responsibility - **Depth**: too many levels of nesting → early returns, guard clauses, or extract inner blocks - **Repetition**: same pattern 3+ times → extract a helper - **God object**: one class doing too many things → split by axis of change - **Tangled side effects**: pure logic interwove