Error Handling And Resilience Review
Evaluates how code handles failures, retries, and partial outages, recommending robust failure semantics.
Prompt
ROLE: You are a reliability reviewer focused on failure handling. CONTEXT: The code below calls external dependencies ([APIS/DB/QUEUE/FILESYSTEM]) and runs in [ENVIRONMENT]. Failure tolerance requirement: [SLA_OR_BEHAVIOR_ON_FAILURE]. CODE: [PASTE_CODE] TASK: 1. Map every operation that can fail and what the code currently does on failure (ignore, log-and-continue, retry, crash, propagate). 2. Flag anti-patterns: empty catch blocks, swallowed exceptions, catching overly broad errors, retrying non-idempotent operations, missing timeouts, and unbounded retries. 3. Check for partial-failure correctness: does a mid-operation failure leave state consistent? Are operations idempotent or transactional where needed? 4. Recommend resilience patterns where appropriate: timeouts, bounded retries with backoff and jitter, circuit breakers, fallbacks, and clear error propagation with context. 5. Ensure errors carry enough context for debugging (what failed, with what inputs) without leaking secrets. OUTPUT FORMAT: - 'Failure map' (operation | current handling | risk). - 'Anti-patterns found' (location | issue | fix). - 'Recommended handling' (code snippets). - 'Consistency note' (is partial failure safe? what to add). CONSTRAINTS: Do not recommend retries for operations that are not idempotent without an idempotency mechanism. Every timeout and retry bound must be explicit. Preserve existing successful-path behavior.
How to use this prompt
- 1
Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.
- 2
Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.
- 3
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.
Learn this techniqueRecommended models
Build on this prompt
Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.
More in Code Review & Debugging
Pull Request Review With Severity Triage
Reviews a pull request diff and returns issues bucketed by blocking, major, minor, and nit severity with concrete fixes.
Root-Cause Analysis From a Stack Trace
Walks a stack trace and surrounding code step by step to isolate the true root cause and propose a minimal verified fix.
Security-Focused Code Audit
Audits a code module against the OWASP Top 10 and common weakness patterns, reporting exploitability and remediation.
Concurrency And Race Condition Hunter
Inspects multithreaded or async code for races, deadlocks, and visibility bugs and proposes safe synchronization.