Git-Aware Refactor

Developer Toolsgithub-copilot-vs-cursorwhat_to_refactorcurrent_approachtarget_approach

Copilot integrates with GitHub's PR workflow, so atomic commits matter. Cursor's Composer can execute multi-step plans. The 'app works at every commit' constraint prevents the common AI refactoring mistake of breaking intermediate states.

Prompt
I need to refactor {{what_to_refactor}} but want to keep a clean git history.

Current implementation: {{current_approach}}
Target implementation: {{target_approach}}
Files affected: {{affected_files}}

Break this into atomic, reviewable commits:

**Commit 1 — Preparation** (no behavior change):
- Add any new types/interfaces needed
- Create new files with empty stubs
- Add feature flags if needed for gradual rollout

**Commit 2 — Implementation** (behind feature flag if applicable):
- Implement the new approach
- Old code remains functional throughout

**Commit 3 — Migration**:
- Switch call sites from old to new
- Update tests to use new approach
- Each test should pass at every commit

**Commit 4 — Cleanup**:
- Remove old implementation
- Remove feature flag
- Update documentation/comments

For each commit, provide:
- Commit message following conventional commits (feat:, refactor:, chore:)
- List of files changed
- The actual code changes

The key constraint: the app should work correctly at every commit. No "break things now, fix later" commits.

Variables to customize

{{what_to_refactor}}{{current_approach}}{{target_approach}}{{affected_files}}

Why this prompt works

Copilot integrates with GitHub's PR workflow, so atomic commits matter. Cursor's Composer can execute multi-step plans. The 'app works at every commit' constraint prevents the common AI refactoring mistake of breaking intermediate states.

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.