Home / Skills / JuliusBrussee/caveman

safe-refactor

Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.

skillLicense: Apache-2.0 Source: JuliusBrussee/caveman

Install

Copy this folder into your Claude Code project (needs Node.js):

npx degit JuliusBrussee/caveman/skills/safe-refactor .claude/skills/safe-refactor

Or install it for every project:

npx degit JuliusBrussee/caveman/skills/safe-refactor ~/.claude/skills/safe-refactor

File content

Made by its original authors and shared under Apache-2.0. We show it unchanged, with credit and a link to the source. Source ↗

---
name: safe-refactor
description: Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.
---

# 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.