safe-refactor

Installation
SKILL.md

Safe Refactor

Refactoring = changing structure without changing behavior. The whole skill is about proving behavior didn't change.

1. Baseline

  • Run the tests that cover the target code; record the result. Also run type check and lint (tsc --noEmit, eslint; mypy/pyright, ruff).
  • If coverage of the target is weak, write characterization tests first: tests that pin current behavior (including weird behavior) for the main inputs. Commit or stash-point here so you can roll back.
  • If tests are failing before you start, tell the user — don't refactor on a red baseline.

2. Plan

Write a short plan listing each transformation and the risk. Show it to the user if the refactor touches more than ~3 files or changes a public API.

Find all usages before renaming/moving anything:

grep -rn "functionName" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.py" .

Watch for dynamic usages grep might miss: string-based lookups, getattr, re-exports in index.ts/__init__.py, templates, config files.

Installs
1
First Seen
Today