Error Handling Hardening
Both editors can scan and fix files systematically. The specific audit checklist prevents vague 'improve error handling' outputs. Cursor shows inline diffs for each fix. Windsurf's Cascade can apply all fixes in sequence.
Audit and improve error handling in {{file_or_module_path}}. Current state: {{current_error_handling}} Audit checklist: 1. **Unhandled promises**: Find any async operations missing try/catch or .catch() 2. **Silent failures**: Find catch blocks that swallow errors without logging or rethrowing 3. **Generic catches**: Replace catch(e) with specific error type handling where appropriate 4. **User-facing errors**: Ensure errors shown to users are helpful, not stack traces 5. **API boundaries**: Verify all API calls handle network errors, timeouts, and unexpected response shapes 6. **Validation gaps**: Find inputs that aren't validated before use For each issue, provide: - Location (file:line or function name) - Current code - Fixed code - Why this matters (what could go wrong in production) Then add: - A centralized error handler if the project doesn't have one - Retry logic for transient failures (network, rate limits) with exponential backoff - Error boundary components for React UI sections that could crash
Variables to customize
Why this prompt works
Both editors can scan and fix files systematically. The specific audit checklist prevents vague 'improve error handling' outputs. Cursor shows inline diffs for each fix. Windsurf's Cascade can apply all fixes in sequence.
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.