safe-refactorcommit 82864c8SKILL.md · Refactoring
Safe Refactor
Restructures code while preserving behavior, bracketing structural edits with the same verification before and after.
npx skills add JuliusBrussee/caveman --skill safe-refactorCommand selected. Copy it manually.
- Permissions
- read-repo
- write-files
- shell
- network
- Compatible with
- Claude Code, Codex, Gemini CLI
- GitHub
- 116.6k
- Source
- Community · Julius Brussee
- Status
- Scan passed
- License
- Apache-2.0
- Category
- Refactoring
Core rule
Define the behavior-preservation boundary and establish verification before any structural edit.
Execution Phases
Phase 01Set boundary and proof
Define which behavior must be preserved and establish verification before editing; keep feature changes out of the refactor.
Phase 02Move one boundary at a time
Move one ownership boundary at a time, keeping every intermediate state buildable and testable.
Phase 03Preserve interfaces
Keep public interfaces, failure behavior, ordering and compatibility unless scoped, and avoid dependency or config growth without a correctness need.
Phase 04Re-run the same proof
Run the same proof after the change and stop when behavior matches and the requested structure is reached.
Permissions (summarised from SKILL.md)
| Capability | Needed | Details |
|---|---|---|
| File writes | Required | Edits code structure within the refactor scope. |
| Command execution | Limited | Runs the build and test commands used as proof that behavior is unchanged. |
| Network outbound | Not required | The skill does not call for network access. |
SKILL.md frontmatter (YAML)
---
name: safe-refactor
description: Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.
---