refactor
Restructure code without changing its behaviour.
Files1
View on GitHubSKILL.mdskills/refactor/SKILL.md
GitHubWhen to use
The user wants code cleaner / simpler / restructured, with the same observable behaviour.
How
- Read the file and its tests first.
- Make one focused change at a time with
edit_file(exact, unique old_string). - Preserve behaviour — outputs must not change. Keep names and style consistent.
- Suggest running the tests after each change.
Avoid
- Behaviour changes smuggled into a "refactor".
- Rewriting unrelated code.
- Big-bang rewrites instead of small, safe steps.
Done well
The code reads better, the tests still pass, and you can state in one line why each change is behaviour-preserving.