Skills DirectoryCurated open-source Skills from GitHub

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-refactor
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

  1. Phase 01Set boundary and proof

    Define which behavior must be preserved and establish verification before editing; keep feature changes out of the refactor.

  2. Phase 02Move one boundary at a time

    Move one ownership boundary at a time, keeping every intermediate state buildable and testable.

  3. Phase 03Preserve interfaces

    Keep public interfaces, failure behavior, ordering and compatibility unless scoped, and avoid dependency or config growth without a correctness need.

  4. 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)

CapabilityNeededDetails
File writesRequiredEdits code structure within the refactor scope.
Command executionLimitedRuns the build and test commands used as proof that behavior is unchanged.
Network outboundNot requiredThe skill does not call for network access.

SKILL.md frontmatter (YAML)

SKILL.md frontmatter (YAML)commit 82864c8
---
name: safe-refactor
description: Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.
---

Related skills

A rule scan cannot catch every risk. Read this skill's SKILL.md and check its permissions before installing.