Refactor Plan

Refactor Plan

Makes the AI investigate a codebase and write a phased, verifiable plan for a multi-file refactor, then wait for confirmation before changing any code.

Skill files1 file
SKILL.md67 lines
1
---
2
name: refactor-plan
3
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.'
4
---
5
6
# Refactor Plan
7
8
Create a detailed plan before making any code changes.
9
10
## Instructions
11
12
1. Do not edit files while preparing the plan.
13
2. Search the codebase to understand the current state. Read enough implementation, tests, configuration, and docs to make the plan specific to the repository.
14
3. Identify affected files, ownership boundaries, dependencies, and likely hidden coupling.
15
4. Plan changes in a safe sequence. Prefer contracts and types first, then implementations, then callers, then tests, then cleanup.
16
5. Include verification steps between phases and a final validation command.
17
6. Include rollback or recovery steps for the riskiest phases.
18
7. Output the complete plan using the format below.
19
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.
20
21
If the request is too ambiguous to plan safely, ask concise clarifying questions instead of editing files.
22
23
## Output Format
24
25
```markdown
26
## Refactor Plan: [title]
27
28
### Current State
29
[Brief description of how things work now]
30
31
### Target State
32
[Brief description of how things will work after]
33
34
### Affected Files
35
| File | Change Type | Dependencies |
36
|------|-------------|--------------|
37
| path | modify/create/delete | blocks X, blocked by Y |
38
39
### Execution Plan
40
41
#### Phase 1: Types and Interfaces
42
- [ ] Step 1.1: [action] in `file.ts`
43
- [ ] Verify: [how to check it worked]
44
45
#### Phase 2: Implementation
46
- [ ] Step 2.1: [action] in `file.ts`
47
- [ ] Verify: [how to check]
48
49
#### Phase 3: Tests
50
- [ ] Step 3.1: Update tests in `file.test.ts`
51
- [ ] Verify: Run `npm test`
52
53
#### Phase 4: Cleanup
54
- [ ] Remove deprecated code
55
- [ ] Update documentation
56
57
### Rollback Plan
58
If something fails:
59
1. [Step to undo]
60
2. [Step to undo]
61
62
### Risks
63
- [Potential issue and mitigation]
64
```
65
66
After the plan, ask: "Shall I proceed with Phase 1?"
67

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…