Multi-File Refactoring
Scopes the refactor to a specific directory, distinguishes between safe and risky changes, and requires a change log — critical for reviewing large refactors.
Refactor {{pattern_to_change}} to {{new_pattern}} across the codebase. Scope: Only files in {{directory}} Pattern to find: {{old_pattern_description}} Replace with: {{new_pattern_description}} Rules: - Update all imports that reference changed exports - Update any tests that test the changed code - Do NOT change the behavior — this is a pure refactor - If a file uses the pattern but changing it would be risky, flag it with a comment instead of changing it - After all changes, run the project's lint command and fix any issues List every file you changed and what you changed in it.
Variables to customize
Why this prompt works
Scopes the refactor to a specific directory, distinguishes between safe and risky changes, and requires a change log — critical for reviewing large refactors.
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.