# Refactoring Checklist

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

- Skill: `tomevault-io/refactoring-checklist` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/refactoring-checklist`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/refactoring-checklist/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/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

---
> Source: [iamjcabalejo/payoys-cursor-sub-agents](https://github.com/iamjcabalejo/payoys-cursor-sub-agents) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-04 -->

