Back to skills

Agent Skill

Safe Refactor

safe-refactor

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

JuliusbrusseeGeneralGoAiAnthropicCavemanClaudeClaude-codeLlmMemePrompt-engineeringSkillTokens

59K installs

juliusbrussee/caveman

by Juliusbrussee

Score

8.5

/ 10

Installs

59K

Repo Stars

106.6K

Last Updated

0d ago

Fresh

Quality Ratio

86%

Description

Verified

Language

Go

First Published

Aug 2026

Summary

The Safe Refactor agent skill guides an AI to restructure code changes while strictly preserving existing behavior and ensuring verification before and after structural edits. It is particularly useful for developers refactoring critical or complex codebases, where ensuring no regression is paramount during structural changes like extraction, consolidation, or ownership transfers. This is a skill with 12K installs, indicating a significant level of adoption within the registry. The agent skill explicitly instructs the AI to define behavior preservation boundaries, establish verification, and run the same proofs after changes to confirm behavior matches. It provides specific rules such as keeping feature changes separate, moving one ownership boundary at a time, and preserving public interfaces, failure behavior, ordering, and compatibility unless explicitly scoped. Furthermore, it emphasizes keeping intermediate states buildable and testable, and avoiding unnecessary dependency or configuration growth.

Skill Definition

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 Use

Use in O-mega

Claude Code

npx skills add juliusbrussee/caveman safe-refactor
Safe Refactor | Agent Skills | o-mega