# Refactoring Checklist

> Apply safe refactoring steps with behavior preservation. Use when refactoring code, reducing technical debt, or working with refactoring-expert.

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

---


# Refactoring Checklist

## Before Refactoring
- [ ] Tests exist and pass
- [ ] Scope is clear (one concern at a time)
- [ ] No behavior change intended

## Safe Refactoring Steps

### 1. Extract
- Extract method/function: small, focused changes
- Extract variable: improve readability
- Extract constant: magic numbers/strings

### 2. Rename
- Rename for clarity (IDE rename refactor)
- Update all references in one pass

### 3. Move
- Move function to appropriate module
- Move code closer to where it's used

### 4. Simplify
- Replace conditional with guard clauses
- Replace nested conditionals with early returns
- Remove dead code

### 5. Decompose
- Split large function into smaller ones
- Break up large classes

## Rules
- **One change per commit** when possible
- **Run tests after each step**
- **No new features** during refactor
- **Preserve behavior** — refactor is structural only

## Red Flags
- Changing behavior while refactoring
- Refactoring without tests
- Large, multi-file changes without incremental validation
- Mixing refactor with feature work

## Output
- Before/after complexity (if measurable)
- List of changes
- Confirmation that tests still pass

