Refactor Safely
Implement an authorized structural refactor in reversible, behavior-preserving, independently verified increments.
Use when: Implement an authorized behavior-preserving refactor in small verified increments. Use for a bounded file, module, or structural target, including the refactor portion of a mixed request; not for a pure feature, bug fix, open-ended cleanup, or read-only review.
Install only this skill
Section titled “Install only this skill”arcantry skills link refactor-safely --scope userThis links only refactor-safely to the standard user location, ~/.agents/skills. Use --scope repo for one repository, or add --compat claude when that optional alias is needed.
What it helps with
Section titled “What it helps with”- Protect behavior with a verified baseline before changing internal structure.
- Keep refactoring separate from features, bug fixes, formatting, and adjacent cleanup.
History
Section titled “History”- 2026-09-14 - Add focused code-quality workflows: Arcantry separates evidence-backed code assessment, maintainable structural design and authorized behavior-preserving refactoring into three focused public skills.
Examples
Section titled “Examples”Extract one responsibility
Section titled “Extract one responsibility”Prompt
Use the refactor-safely skill to move this parsing responsibility without changing the command’s behavior.
Expected outcome
The change lands in small tested increments and preserves every protected contract.
Separate a discovered defect
Section titled “Separate a discovered defect”Prompt
Use the refactor-safely skill when a characterization test exposes an existing product bug during the refactor.
Expected outcome
The defect is separated from the structural work instead of silently choosing new behavior.