SkillHub GitHub

Skills juliusbrussee/caveman Caveman

safe-refactor

Use it when
you're restructuring code, by extracting, merging or moving it, and its behavior must stay exactly the same
It does
sets up a check of current behavior before editing, keeps feature changes out, and moves one piece of responsibility at a time
You get
restructured code that passes the same checks as before, with every intermediate step still building
Unlike migration
which moves data, schemas or APIs with a rollback plan, this changes only how the code is organized
Runs
on its own, whenever the agent sees a task that fits; it's a short list of rules, not a step-by-step guide

Skill 11 of 12 in the Caveman bundle · Before it: surgical-patch · After it: migration

TLDR

Before any structural edit, the agent defines which behavior must be preserved and how it will verify that. It keeps new features out of the refactor, moves responsibility from one part of the code to another one step at a time, and preserves public interfaces, error behavior, ordering and compatibility unless you've said otherwise. Every intermediate state must still build and pass tests, and it adds no dependency or configuration unless correctness needs it. At the end it runs the same verification again, and stops once behavior matches and the requested structure is in place.

Summarizes the skill at bad48a0.

npx skills add https://github.com/juliusbrussee/caveman --skill safe-refactor
Installs
61,972 on skills.sh, Sep 21, 2026
Repo stars
106,976 juliusbrussee/caveman
First seen
Aug 11, 2026 on skills.sh
Weekly installs
13.2K
week to Sep 21
Weekly values
Week toInstalls
Aug 30
Aug 100
Aug 176,282
Aug 248,912
Aug 319,036
Sep 711,177
Sep 1412,591
Sep 2113,200
Category

Test-first work, implementation from specs, git hygiene and scope control.

Everything for building software: planning, coding, debugging, design, frameworks, cloud, agents and skills.

Type

A multi-step process the agent follows: interview, debug, run a TDD loop, review.

Effect

Its own steps create or change files, git state or local tools.

Needs

Instructions only. Works in any agent that supports skills.

Publisher

Everyone else. Unverified vendor claims default to community.

Topics

SKILL.md

From juliusbrussee/caveman at bad48a0. Checked daily, last changed Oct 20, 2026.

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