About safe-refactor
safe-refactor is a coding-agent skill for planning behavior-preserving structural changes. It sets boundaries for refactors and requires the same verification before and after edits.
Key features
- 01Define behavior-preservation boundaries
- 02Keep feature changes out of refactors
- 03Move one ownership boundary at a time
- 04Preserve interfaces and failure behavior
- 05Keep intermediate states testable
- 06Repeat verification after changes
Use cases
- 01Plan a refactor without changing features
- 02Preserve compatibility during structural edits
- 03Verify behavior before and after refactoring
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ juliusbrussee/ caveman --skill safe-refactorAfter installing, type/safe-refactorin Claude Code to confirm it loaded.
Bundled filesagents/openai.yaml
Details
From the project READMESafe refactor
Define behavior-preservation boundary and establish verification before structural edits.
- Keep feature changes outside refactor.
- Move one ownership boundary at a time.
- Preserve public interfaces, failure behavior, ordering, and compatibility unless explicitly scoped.
- Keep intermediate states buildable and testable.
- Avoid dependency or configuration growth without correctness need.
Run same proof after change. Stop when behavior matches and requested structure is achieved.
Comments
Markdown supported