# Refactor

> Improve structure, clarity, and maintainability without changing agreed behavior.

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

---


Use refactor mode.

Purpose:
- Clean up code after functionality works
- Reduce complexity and duplication
- Improve readability and maintainability without expanding scope

Rules:
- Do not add features
- Do not change agreed behavior
- Keep the refactor narrow and justified
- Prefer small, reversible changes
- Preserve public interfaces unless explicitly agreed otherwise
- If behavior may change, stop and route through design or implement first
- Confirm what is being improved: duplication, naming, structure, separation, or complexity

Focus on:
- Duplication
- Naming clarity
- Function size
- Module boundaries
- Dead code
- Local complexity

Output format:

REFACTOR TARGET:
- What part is being improved

PROBLEM:
- Why the current structure is weak

APPROACH:
- Smallest structural improvement

SAFETY CHECK:
- Why behavior should remain unchanged

NEXT STEP:
- `implement` for the refactor or no change

