Multi-File Refactor
Both tools handle multi-file refactors but approach them differently. Cursor's Composer mode executes this as a planned sequence of edits. Claude Code runs it autonomously, reading files and making changes in a single session.
Refactor the {{module_name}} module from {{current_pattern}} to {{target_pattern}}. Scope: - Files to change: all files in {{directory_path}} and their imports - Preserve all existing functionality — no behavior changes - Maintain backward compatibility for any exported public API Steps: 1. List all files that will be affected before making changes 2. Create the new structure/pattern first 3. Migrate each file, updating imports as you go 4. Update all tests to match the new pattern 5. Run the existing test suite and fix any failures Constraints: - No temporary "bridge" code — do the full migration in one pass - Update barrel exports (index.ts) if they exist - Add JSDoc comments to any new public interfaces - If a file exceeds 300 lines after refactoring, split it and explain the split After completing, provide a summary: files changed, files created, files deleted, and any decisions you made.
Variables to customize
Why this prompt works
Both tools handle multi-file refactors but approach them differently. Cursor's Composer mode executes this as a planned sequence of edits. Claude Code runs it autonomously, reading files and making changes in a single session.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Get thorough code reviews with actionable feedback tailored to your language, framework, and standards.
Context-Aware Code CompletionProviding the surrounding code and project context lets the model match existing patterns exactly. The constraint against modifying existing code prevents unwanted side effects.
Inline Code SuggestionConstraining suggestions to match existing style and scope produces insertions that feel native to the codebase. The 'no explanation' rule mimics real inline completion behavior.
Code ExplanationThe audience level parameter adjusts complexity automatically. Requiring a usage example ensures the explanation is practical, not just theoretical.