Safe Refactor skill for Claude
Restructure code while preserving behavior.
When Claude uses it
Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.
Safe Refactor SKILL.md
The full skill file from JuliusBrussee/caveman (Apache-2.0).
Safe 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.
How to install Safe Refactor
Claude Code
Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):
npx degit JuliusBrussee/caveman/skills/safe-refactor#main ~/.claude/skills/safe-refactorCodex
npx degit JuliusBrussee/caveman/skills/safe-refactor#main ~/.codex/skills/safe-refactorClaude.ai and Claude Desktop
Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.
Frequently asked questions
+What does the Safe Refactor skill do?
Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.
+How do I install Safe Refactor in Claude Code?
Copy the skill folder into ~/.claude/skills/safe-refactor, for example with "npx degit JuliusBrussee/caveman/skills/safe-refactor#main ~/.claude/skills/safe-refactor". Claude Code loads it automatically and uses it when a task matches.
+Does Safe Refactor work with ChatGPT or Codex?
Yes. Safe Refactor uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/safe-refactor. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.
+Is Safe Refactor free?
Safe Refactor is published on GitHub by JuliusBrussee under the Apache-2.0 license, which allows free use.