
safe-refactor
Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.
- Installs
- 107.6K
- Last 24h
- +1.1K
- Trending rank
- #307
- Security
- Pass
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/juliusbrussee/caveman --skill safe-refactor- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads safe-refactor automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
Security audits
Independent scans of the skill's instructions and bundled files.
SKILL.md
The instructions your agent reads when the skill is triggered.
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.
FAQ
What does the safe-refactor skill do?
Restructure code while preserving behavior. Use for extraction, consolidation, ownership moves, or cleanup where verification must bracket structural edits.
How do I install safe-refactor?
Run npx skills add https://github.com/juliusbrussee/caveman --skill safe-refactor in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/safe-refactor/ (personal) or .claude/skills/safe-refactor/ (project).
Which AI agents can use safe-refactor?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is safe-refactor safe to install?
Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk passed. As with any skill, read the SKILL.md and bundled scripts before installing.
Who maintains safe-refactor?
It is published by juliusbrussee in juliusbrussee/caveman. It has 107,589 recorded installs.
More from juliusbrussee/caveman
caveman
juliusbrussee/caveman
Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".
caveman-commit
juliusbrussee/caveman
Write a Conventional Commits message compressed to intent only. Use for "write a commit", "commit message", /commit or /caveman-commit.
caveman-review
juliusbrussee/caveman
Compressed code review - one line per finding with location, problem and fix. Use for /caveman-review, "review this PR", or "review the diff".
caveman-compress
juliusbrussee/caveman
Compress a memory file such as CLAUDE.md or a todo list into caveman format to save input tokens, keeping a readable backup. Sends the file's text to the configured model provider. Trigger: /caveman-compress.
caveman-help
juliusbrussee/caveman
Quick-reference card for the three caveman skills and their commands. Trigger: /caveman-help or "caveman help".
cavecrew
juliusbrussee/caveman
When to delegate to cavecrew-investigator (locate code), cavecrew-builder (1-2 file edit) or cavecrew-reviewer (diff review) instead of working inline or using Explore. Their output is compressed, so main context lasts longer.
Popular code quality & workflow skills
grill-me
mattpocock/skills
A relentless interview to sharpen a plan or design.
improve-codebase-architecture
mattpocock/skills
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
handoff
mattpocock/skills
Compact the current conversation into a handoff document for another agent to pick up.
domain-modeling
mattpocock/skills
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.
codebase-design
mattpocock/skills
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
diagnosing-bugs
mattpocock/skills
Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.