| name | safe-refactor |
| description | Refactor checklist with guardrails |
Safe Refactor
Refactor with minimal risk. Prefer small, reversible changes.
Guardrails
- Keep behavior identical unless explicitly asked to change it
- Avoid public API changes
- Update or add tests for any touched behavior
- Avoid broad rewrites—prefer small, focused edits
Process
- Identify the smallest unit to refactor
- Locate the exact file(s) and read them first (
read)
- Add or update tests (if missing)
- Make the change in small steps (
edit preferred over rewrite)
- Re‑run relevant tests or explain how to validate (
bash if available)
- Summarize what changed and why it’s safe
Output format
- Goal
- Plan (3–5 steps max)
- Safety checks (tests, edge cases)
- Changes summary