refactor-plan
Scannednpx machina-cli add skill github/awesome-copilot/refactor-plan --openclawFiles (1)
SKILL.md
1.4 KB
Refactor Plan
Create a detailed plan for this refactoring task.
Refactor Goal
{{refactor_description}}
Instructions
- Search the codebase to understand current state
- Identify all affected files and their dependencies
- Plan changes in a safe sequence (types first, then implementations, then tests)
- Include verification steps between changes
- Consider rollback if something fails
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]
Shall I proceed with Phase 1?
Source
git clone https://github.com/github/awesome-copilot/blob/main/plugins/context-engineering/skills/refactor-plan/SKILL.mdView on GitHub Overview
This skill helps you draft a detailed, phase-driven refactor plan that safely sequences changes, maps affected files, and defines verification and rollback steps. It emphasizes planning types first, then implementations, then tests, with clear checkpoints to minimize disruption.
How This Skill Works
Begin by surveying the current state and dependencies, then outline a Target State and the Affected Files. Create an Execution Plan organized into phases (Types, Implementation, Tests, Cleanup) with verification checkpoints and a rollback strategy.
When to Use It
- Starting a multi-file refactor with inter-file dependencies
- Migrating to a new API surface with phased changes
- Replacing legacy modules without breaking builds
- Coordinating type changes and tests with rollback risk
- Adding verification checkpoints between refactor phases
Quick Start
- Step 1: Search the codebase to understand the current state and dependencies
- Step 2: Draft the Refactor Plan including Current State, Target State, and Affected Files
- Step 3: Execute Phase 1 (Types and Interfaces) with verification and a rollback checkpoint
Best Practices
- Map the current state and all file dependencies before changing anything
- Plan changes in safe sequence: types first, then implementations, then tests
- Insert verification steps between each change to catch regressions early
- Define a clear rollback plan with concrete undo steps
- Update tests and documentation after completing each phase
Example Use Cases
- Refactoring a shared utility module to introduce TypeScript interfaces while updating consumers
- Incrementally migrating a REST client to a new API surface with adapters
- Phase-based rewrite of a service layer to improve separation of concerns
- Splitting large modules by extracting common types into a contracts layer and updating dependents
- Rolling out a breaking change with staged rollout and rollback checks
Frequently Asked Questions
Add this skill to your agents