Multi-File Refactoring

General Productivitywindsurf-promptswhat_to_refactorcurrent_patterndesired_pattern

Defines both the current and desired state, scopes the file changes, and includes a verification step. This prevents Cascade from partially refactoring and leaving the codebase in an inconsistent state.

Prompt
Refactor {{what_to_refactor}} across the codebase:\n\nCurrent state: {{current_pattern}}\nDesired state: {{desired_pattern}}\n\nScope:\n- Files to modify: {{file_pattern}} (e.g., src/components/**/*.tsx)\n- Files to NOT touch: {{excluded_files}}\n\nSteps:\n1. First, search for all usages of the current pattern and list them\n2. Create the new {{abstraction_type}} (interface/function/component) in {{target_file}}\n3. Update each file to use the new pattern\n4. Verify no broken imports or type errors remain\n\nConstraints:\n- Preserve all existing functionality — this is a pure refactor\n- Keep the same exports (no breaking changes for consumers)\n- Match existing code style (indentation, naming conventions)\n- Run the TypeScript compiler after changes to verify

Variables to customize

{{what_to_refactor}}{{current_pattern}}{{desired_pattern}}{{file_pattern}}{{excluded_files}}{{abstraction_type}}{{target_file}}

Why this prompt works

Defines both the current and desired state, scopes the file changes, and includes a verification step. This prevents Cascade from partially refactoring and leaving the codebase in an inconsistent state.

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.