Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Refactoring Safely?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/karthikrshet-refactoring-safely)
---
name: refactoring-safely
description: "Refactor without changing behaviour: characterisation tests, small steps, and mechanical transformations."
tags: [core, quality]
---
# Refactoring Safely
## When to use
- Code is hard to change
- Before adding a feature to messy code
## Procedure
1. Add characterisation tests around current behaviour
2. Make one mechanical change at a time (rename, extract, inline, move)
3. Run tests after each
4. Commit often
5. Stop when the next feature becomes easy
## Checklist
- [ ] Behaviour unchanged (tests green throughout)
- [ ] No feature changes mixed in
## Anti-patterns
- Big-bang rewrites
- Refactoring without tests