Workspace Search and Replace
Cursor's Agent mode and Copilot Chat both handle multi-file operations, but both default to naive find-replace. This prompt forces contextual analysis of each occurrence. The classification step catches the edge cases that break codebases.
Perform a codebase-wide search and replace with intelligence: Find: {{search_pattern}} Replace with: {{replacement_pattern}} Scope: {{file_glob_pattern}} But this isn't a simple find-replace. For each occurrence: 1. **Read the surrounding context** (10 lines before and after) 2. **Classify** the usage: - Direct usage: Replace straightforwardly - Aliased: Update the alias/import too - Inside a string/comment: May need different handling - In a test: Update test expectations to match - In a type definition: Update the type and all references 3. **Apply the appropriate replacement** for each category 4. **Update imports** if the replacement changes the import source 5. **Check for TypeScript errors** after the replacement Provide a summary: - Total occurrences found: X - Replaced: Y - Skipped (with reason): Z - Files modified: (list) - New TypeScript errors introduced: (list with fixes) If any replacement is ambiguous, show the context and ask rather than guessing.
Variables to customize
Why this prompt works
Cursor's Agent mode and Copilot Chat both handle multi-file operations, but both default to naive find-replace. This prompt forces contextual analysis of each occurrence. The classification step catches the edge cases that break codebases.
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.