CLSkills
💻REFACTOR

Cleans up messy code without changing what it does. Tells you what changed and why.

Category: Coding & Technical

Before / After

Without REFACTOR

Make this cleaner: [paste function]

With REFACTOR

REFACTOR [paste function]

What changes in Claude's response

You get the rewritten code plus a numbered list of every change: 'extracted lines 12-28 into a helper because they're called twice', 'replaced the nested ternary with a switch because branch coverage was unreadable', 'inlined the single-use variable on line 34'. The why matters — without it, you can't tell if the refactor matches your team's style.

When NOT to use REFACTOR

Don't REFACTOR code you don't have tests for. The promise is 'same behavior' but the only way to verify that is tests. No tests = REFACTOR is rolling dice.

Codes that stack with REFACTOR

REFACTOR is one of 120 tested prompt prefixes. The full cheat sheet has before/after examples, warnings, combos, and 10 workflow playbooks.

See the full cheat sheet — from $5

More Coding & Technical codes