# Refactor Safely

> Refactor code without behavior changes using small mechanical steps and verification.

- Skill: `s-hiraoku/refactor-safely` (Agent Skill)
- Install (CLI): `npx skillmds@latest add s-hiraoku/refactor-safely`
- Raw SKILL.md: https://api.skillmd.com/api/skills/s-hiraoku/refactor-safely/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: s-hiraoku (https://skillmd.com/u/s-hiraoku)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/s-hiraoku/refactor-safely

---


# Refactor Safely

Use this workflow when improving structure without changing behavior.

## Workflow

1. Identify the current behavior and public interfaces.
2. Avoid broad rewrites unless they are explicitly justified.
3. Make small mechanical changes.
4. Preserve public APIs, data formats, and user-visible behavior.
5. Run tests after meaningful steps.
6. Update docs only if structure, commands, or contributor guidance changes.

## Final Report

Clearly state that behavior should be unchanged. Include changed files, verification run, and any areas that need extra review.

