Multi-File Refactoring
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.
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
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 Optimization
One-click improvement with structure analysis and pattern suggestions.
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
$ npm i -g @promptingbox/mcpUse 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.