Refactor Plan

VerifiedSafe

Create a concrete plan before starting a multi-file refactor. Always investigate first, output the plan, and wait for confirmation before making code changes.

Sby Skills Guide Bot
DevelopmentIntermediate
7/24/2026
Claude CodeCursorWindsurfCopilotCodex
#refactoring#planning#codebase-analysis#risk-management#multi-file

Recommended for

Automated summary

This skill produces a detailed, sequenced plan before starting a multi-file refactor, after investigating the repository, then stops to request confirmation.

Strengths

  • Enforces a codebase investigation phase (implementation, tests, config, docs) before any modification
  • Sequences changes from contracts and types to implementations, callers, tests, then cleanup
  • Includes per-phase verification steps, a rollback plan, and an explicit risk list
  • Structured markdown output with an affected-files table and dependency tracking

Limitations

  • Makes no code changes itself: it is a planner, not an executor
  • Plan quality depends entirely on how thoroughly the repository is actually explored
  • The fixed four-phase template may fit poorly for unusual or very small refactors
When to use it

Use when a refactor spans multiple files and needs a safe, reviewed, reversible sequence before any edits are made.

When not to use it

Avoid it for a single-file fix or when immediate code output is required without a confirmation checkpoint.

Security analysis

Safe
Quality score86/100

This is a pure planning/instruction skill with no declared tools and no executable content. It explicitly instructs the agent not to edit files while planning, to investigate first, and to stop and request confirmation before implementing. There is no network access, shell usage, credential handling, obfuscation, or destructive action anywhere in the document.

No concerns found

How this analysis is made

Examples

Plan a cross-module refactor
I want to split the payments module into a separate service. Please investigate the codebase and give me a refactor plan with the affected files, execution phases, and rollback steps before changing anything.
Sequence a type migration
Plan the migration of our order DTOs from the legacy classes to the new TypeScript interfaces across the whole repo — don't edit files yet, just produce the plan and wait for my confirmation.
Scope a safe cleanup
We have a lot of deprecated helpers duplicated in several folders. Explore the repo, identify dependencies and hidden coupling, and propose a phased refactor plan with verification after each phase.

name: githubcopilot-refactor-plan description: 'Create a concrete plan before starting a multi-file refactor. Use when the user asks to plan, sequence, scope, or safely execute a refactor across multiple files; always investigate first, output the plan, and wait for confirmation before making code changes.'

Refactor Plan

Create a detailed plan before making any code changes.

Instructions

  1. Do not edit files while preparing the plan.
  2. Search the codebase to understand the current state. Read enough implementation, tests, configuration, and docs to make the plan specific to the repository.
  3. Identify affected files, ownership boundaries, dependencies, and likely hidden coupling.
  4. Plan changes in a safe sequence. Prefer contracts and types first, then implementations, then callers, then tests, then cleanup.
  5. Include verification steps between phases and a final validation command.
  6. Include rollback or recovery steps for the riskiest phases.
  7. Output the complete plan using the format below.
  8. Stop after the plan and ask for confirmation before implementing. If the user already asked you to implement, still produce the plan first and wait for confirmation unless they explicitly said to continue without review after the plan.

If the request is too ambiguous to plan safely, ask concise clarifying questions instead of editing files.

Output Format

## Refactor Plan: [title]

### Current State
[Brief description of how things work now]

### Target State
[Brief description of how things will work after]

### Affected Files
| File | Change Type | Dependencies |
|------|-------------|--------------|
| path | modify/create/delete | blocks X, blocked by Y |

### Execution Plan

#### Phase 1: Types and Interfaces
- [ ] Step 1.1: [action] in `file.ts`
- [ ] Verify: [how to check it worked]

#### Phase 2: Implementation
- [ ] Step 2.1: [action] in `file.ts`
- [ ] Verify: [how to check]

#### Phase 3: Tests
- [ ] Step 3.1: Update tests in `file.test.ts`
- [ ] Verify: Run `npm test`

#### Phase 4: Cleanup
- [ ] Remove deprecated code
- [ ] Update documentation

### Rollback Plan
If something fails:
1. [Step to undo]
2. [Step to undo]

### Risks
- [Potential issue and mitigation]

After the plan, ask: "Shall I proceed with Phase 1?"

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/refactor-plan-mryiqht8/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/refactor-plan-mryiqht8' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/refactor-plan-mryiqht8/download' --output '.skill-downloads/refactor-plan-mryiqht8/SKILL.md.part' && mv '.skill-downloads/refactor-plan-mryiqht8/SKILL.md.part' '.skill-downloads/refactor-plan-mryiqht8/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/refactor-plan-mryiqht8/SKILL.md' && test -s '.skill-downloads/refactor-plan-mryiqht8/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/githubcopilot-refactor-plan' && cp -R '.skill-downloads/refactor-plan-mryiqht8' '.claude/skills/githubcopilot-refactor-plan'

Cursor
test -f '.skill-downloads/refactor-plan-mryiqht8/SKILL.md' && test -s '.skill-downloads/refactor-plan-mryiqht8/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/githubcopilot-refactor-plan' && cp -R '.skill-downloads/refactor-plan-mryiqht8' '.cursor/skills/githubcopilot-refactor-plan'

Codex
test -f '.skill-downloads/refactor-plan-mryiqht8/SKILL.md' && test -s '.skill-downloads/refactor-plan-mryiqht8/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/githubcopilot-refactor-plan' && cp -R '.skill-downloads/refactor-plan-mryiqht8' '.agents/skills/githubcopilot-refactor-plan'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/refactor-plan-mryiqht8'

openskills read 'refactor-plan-mryiqht8'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/refactor-plan-mryiqht8/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills