refactor-plan — GitHub Copilot skill: plan refactors
This skill investigates a codebase and writes a step-by-step multi-file refactor plan before edits begin. Use it when the proposed change needs review first.
npx skills add github/awesome-copilot --skill refactor-planWhat refactor-plan does
refactor-plan reads implementation code, tests, configuration, and documentation before it proposes changes. It describes the current and target states, then lists affected files, dependencies, ownership boundaries, and likely hidden coupling.
The plan follows phases for types and interfaces, implementation, callers, tests, and cleanup. It includes checks between phases, a final validation command, risks, and recovery steps for risky work. Files stay unchanged during planning.
After showing the plan, GitHub Copilot waits for confirmation before editing code. Install it when a multi-file refactor needs a reviewable route; for a small one-file edit, the extra planning step is likely unnecessary.
What it helps with
- plan a refactor across multiple files
- identify coupled modules and dependencies
- sequence interface and implementation changes
- add verification steps and rollback actions
- review the change plan before code edits
Example prompts for the agent
- Plan a refactor that moves logic from `file.ts` into separate modules.
- Inspect the project and list the tests affected by this refactor.
- Create a safe interface-change plan. Do not edit files until I confirm.
How to install refactor-plan
1Skills CLI (Vercel)
npx skills add github/awesome-copilot --skill refactor-plan2GitHub CLI
gh skill install github/awesome-copilot refactor-plan3Manually: put the files in place
.github/skills/refactor-plan/SKILL.md1Skills CLI (Vercel)
npx skills add github/awesome-copilot --skill refactor-plan -a claude-code2Manually: put the files in place
~/.claude/skills/refactor-plan/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/refactor-plan/
Manually: put the files in place
.agents/skills/refactor-plan/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/refactor-plan/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
Platform CLI
gemini skills install https://github.com/github/awesome-copilot --path skills/refactor-planManually: put the files in place
.devin/skills/refactor-plan/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set554
The whole set →Similar
Questions about refactor-plan
How do I install refactor-plan in GitHub Copilot?
Run npx skills add github/awesome-copilot --skill refactor-plan. You can also use gh skill install github/awesome-copilot refactor-plan.
What does refactor-plan do?
The skill investigates the repository and produces a structured plan for a multi-file refactor. It does not change code before confirmation.
What is included in a refactor-plan output?
Its output covers current and target states, affected files, execution phases, checks, risks, and rollback steps. It asks for confirmation before starting the first phase.
Source text
SKILL.md · MIT
--- name: 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 ```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?"
© github · MIT · github/awesome-copilot