rescue-refactorlisted
Install: claude install-skill vivekbhange-hub/legacy-rescue-skill
# rescue-refactor
Refactoring legacy code fails when steps are big: three changes at once, a red test, an
afternoon of debugging, and nobody can tell which change broke what. This skill does the
opposite. Each step is one named refactoring (extract function, rename, move, inline,
introduce parameter) small enough to review in a minute and revert in a second. Tests run
before and after every step. Behaviour does not change; if it must, that is a separate,
explicit commit outside this loop.
## Inputs
- `$ARGUMENTS`: the target and the goal.
- `rescue/characterization.md`: which tests pin the target. If the target is not listed and
has no meaningful existing tests, stop and run `rescue-characterize` first.
- The test command from `rescue/map.md` or CI config. Prefer the fastest command that runs
the pinning tests (a single file or tag), and the full suite at the end of the session.
## Output
- A series of small commits on a branch, one refactoring each.
- `rescue/refactor-log.md`: one line per step with result.
## Before the loop
1. **Branch.** If on the default branch, create `rescue/refactor-<target>`. Confirm the working
tree is clean (`git status --short`); if not, ask the user to commit or stash.
2. **Baseline.** Run the pinning tests and record the result and duration. Red baseline: stop.
3. **Plan the route.** Write a numbered list of 3 to 10 named steps from the current code to
the goal, e.g. "1. Extract `applyDiscounts` from `total` (lines 40-88). 2. Mo