Acceptance criteria and verification actions per phase
Rollback strategy (what to revert to if a phase fails)
Steps
Define goals and non-goals.
Inventory the scope:
files/modules involved
external callers
integration points
Map dependencies and constraints:
which modules import/own what
build/test constraints
naming/boundary conventions to preserve
Choose a refactor strategy:
extract modules
rename/restructure
introduce new abstractions
Sequence phases:
small, buildable increments
explicit checkpoints where the codebase is “green”
Define verification per phase:
commands to run
expected outcomes
manual smoke checks if needed
Define rollback points:
last known-green commit
what to revert if a phase fails
Verification
Goals and non-goals are explicit
Scope and dependencies are documented
Plan is phased with buildable increments and checkpoints
Verification actions per phase are concrete and reproducible
Risks are listed with mitigations
Rollback strategy is defined
Boundaries
MUST NOT produce a plan without acceptance criteria and verification
MUST NOT plan a large refactor as a single undifferentiated step
MUST include rollback points for risky phases
SHOULD keep the plan portable (avoid hard-coded paths unless required)
SHOULD separate structural refactors from behavior changes
Included assets
Templates: ./templates/phased-refactor-plan.md provides a phase structure.
Examples: ./examples/ includes a sample phased plan.
1---2name: plan-code-refactors3description: Plan Code Refactors4---56# Plan Code Refactors78## Purpose9Create a refactor plan that reduces risk and avoids breaking builds by sequencing changes, defining checkpoints, and clarifying success criteria.1011## When to use12Use this skill when:13- A module/component has grown unmanageable14- You need to reorganize folders or boundaries15- You want to standardize repeated patterns across the codebase16- You are preparing a large dependency or framework upgrade1718## Inputs19- The refactor motivation (what pain it addresses)20- Current structure and known pain points21- Constraints (time, risk tolerance, compatibility requirements)22- Verification tools (build, typecheck, tests, lint, e2e)2324## Outputs25- A phased refactor plan with explicit checkpoints26- A dependency map for the refactor scope27- A risk register with mitigations28- Acceptance criteria and verification actions per phase29- Rollback strategy (what to revert to if a phase fails)3031## Steps321. Define goals and non-goals.332. Inventory the scope:34 - files/modules involved35 - external callers36 - integration points373. Map dependencies and constraints:38 - which modules import/own what39 - build/test constraints40 - naming/boundary conventions to preserve414. Choose a refactor strategy:42 - extract modules43 - rename/restructure44 - introduce new abstractions455. Sequence phases:46 - small, buildable increments47 - explicit checkpoints where the codebase is “green”486. Define verification per phase:49 - commands to run50 - expected outcomes51 - manual smoke checks if needed527. Define rollback points:53 - last known-green commit54 - what to revert if a phase fails5556## Verification57- [ ] Goals and non-goals are explicit58- [ ] Scope and dependencies are documented59- [ ] Plan is phased with buildable increments and checkpoints60- [ ] Verification actions per phase are concrete and reproducible61- [ ] Risks are listed with mitigations62- [ ] Rollback strategy is defined6364## Boundaries65- MUST NOT produce a plan without acceptance criteria and verification66- MUST NOT plan a large refactor as a single undifferentiated step67- MUST include rollback points for risky phases68- SHOULD keep the plan portable (avoid hard-coded paths unless required)69- SHOULD separate structural refactors from behavior changes7071## Included assets72- Templates: `./templates/phased-refactor-plan.md` provides a phase structure.73- Examples: `./examples/` includes a sample phased plan.
Run npx skillmds@latest add willyu1007/plan-code-refactors in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Plan Code Refactors It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
willyu1007 (@willyu1007) published this skill. Their other Agent Skills are listed on their SkillMD profile.