RP
Refactoring Plan
🔵 Stable🕐 updated 2026-06-30
🔷 SkillSpec L3
pm-craft
Plan a safe, incremental refactor of messy code without changing behavior. Use when code needs restructuring, is hard to change, has grown tangled, or you want to clean it up before adding a feature. Produces a sequenced plan of small behavior-preserving steps, the safety net (tests/characterization) to add first, and the target structure — refactoring as a series of green commits, not a risky big-bang rewrite.
What to give it
▸The code & the pain — what's being refactored and *why* (hard to change, duplicated, slow, untestable).
▸Test coverage — what tests exist around it (and the framework). If none, that's step zero.
▸The goal — the target structure or what you want to make easy next (e.g. "so I can add payment provider #2").
▸Constraints — what must not change (public API, behavior, performance), time budget.
✅ The bar it holds itself to
Every skill in this library self-verifies — these are this skill's own quality checks, straight from its definition.
✓A safety net (existing or characterization tests) is established before any change
✓Every step is behavior-preserving and independently committable
✓Steps are small and sequenced so the code is green throughout
✓Refactoring is kept separate from behavior/feature changes
✓The target structure is explicit and tied to what it makes easier next
⚠️ What it refuses to do
Do not refactor and add features in the same commit — separate them
Do not start without tests — add characterization tests first if coverage is thin
Do not plan a big-bang rewrite — sequence small, reversible steps
Do not change behavior and call it refactoring — behavior must stay identical
Do not skip running tests between steps — that's the whole safety mechanism
Install
npx pm-claude-skills add --agent claude # or codex · cursor · gemini · hermes
# or one-line MCP (every skill, any client):
claude mcp add pm-skills -- npx -y pm-claude-skills-mcp
Related skills
🔌 Embed this skill
Drop this on your blog, docs, or site — it renders a "Run this skill" card:
<div data-pm-skill="refactoring-plan"></div>
<script src="https://mohitagw15856.github.io/pm-claude-skills/embed.js" async></script>
💬 Discussion
Refactoring Plan is one of 625 open-source professional AI agent skills — all SkillSpec L3.
Try them all in the browser · ⭐ Star on GitHub · Browse the full catalog