MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Refactor-Plan

Refactor-Plan是一款code方向的AI技能,核心价值是Create a concrete plan before starting a multi-file refactor,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

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

Last verified on: 2026-05-30
mkdir -p ./skills/refactor-plan && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/refactor-plan/SKILL.md -o ./skills/refactor-plan/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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


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

🎯 Best For

  • Tech leads planning refactors
  • Developers modernizing legacy code
  • Claude users
  • GitHub Copilot users
  • Software engineers

💡 Use Cases

  • Migrating from class components to hooks
  • Breaking apart monolithic functions
  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Refactor-Plan to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Does this handle breaking changes?

Refactoring skills identify breaking changes but always run your test suite after applying suggestions.

Is Refactor-Plan compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Refactor-Plan?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Refactor-Plan?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/refactor-plan/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Refactoring without tests

Never refactor critical paths without a comprehensive test suite to catch regressions.

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills