Skip to content
Skillpedia
General coding40k · #5338

refactor-plan

Creates a detailed plan before making large code changes. This ensures changes are made safely and in an organized manner.

What it does

This agent creates a detailed plan before making changes to multiple code files. It analyzes the existing code, identifies affected files, and suggests a safe sequence of changes.

When to use it

  • ✓When you want to plan a major code change.
  • ✓Before touching multiple files at once.
  • ✓To ensure code changes are made safely and organized.

Example of what to ask your AI

“I want to refactor the login system. Create a plan for it.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/github/awesome-copilot/blob/main/skills/refactor-plan/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/refactor-plan/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

It first understands how the code works, then plans changes in safe steps (types, implementation, tests, cleanup), and includes steps to verify and undo if something goes wrong.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add github/awesome-copilot --skill refactor-plan

Or download just the file:

curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/refactor-plan/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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?"

FAQ

What is 'refactoring'?

Refactoring is reorganizing existing code without changing its external behavior, to make it easier to understand and maintain.

Why plan before changing code?

Planning helps prevent errors, ensures all parts of the code are considered, and makes the change process safer and more predictable.

What happens after the plan is shown?

The agent waits for your confirmation to start applying changes, beginning with the first phase of the plan.

Details

Original description by the author

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.

repo: github/awesome-copilot

Popularity

GitHub stars
40k
Ranking position
#5338
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills