Before You Refactor
A pre-refactor checklist that catches untested behavior before you 'clean up' code.
Testad · Fungerar
Vad den gör
A rigid pre-refactor checklist: read the existing code twice, find and run the tests that already cover it, state a one-sentence goal, and add a characterization test for any behavior the current suite doesn't pin down before changing the code's shape. Triggers on refactors, restructures, cross-file renames, or reviewing a restructuring PR; explicitly does not trigger on one-line bug fixes, new files, or formatting-only changes.
Testrapport
Its checklist caught a real regression a naive refactor introduced: an archived record silently 'claiming' its dedup id so a later active duplicate got dropped — the naive rewrite passed all 5 existing tests anyway and only broke on a case none of them covered; the skill's step to add a characterization test for untested behavior caught it before the edit landed.
Testad: 2026-07-16 · Claude Code 2.x (agent harness)
Installation
git clone https://github.com/oribarilan/97 mkdir -p ~/.claude/skills cp -r 97/skills/before-you-refactor ~/.claude/skills/before-you-refactor
Kommandon och exempelprompter
/before-you-refactorA pre-refactor checklist that catches untested behavior before you 'clean up' code.
Skills triggas av vanliga förfrågningar — inga kommandon att memorera. Efter installationen aktiverar prompter som dessa skillen (på engelska):
before I restructure this module, what tests actually cover it?I'm about to rename these files across the codebase, what's the risk?add a characterization test before I clean up this function's shape