Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Build fault-tolerant Claude integrations — retries, circuit breakers, Use when working with reliability-patterns patterns. fallbacks, timeouts, and graceful degradation. Trigger with "anthropic reliability", "claude fault tolerance", "anthropic circuit breaker", "claude fallback".
.claude/skills/jeremylongshore-clade-reliability-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 9% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -11% | 0% |
Build fault-tolerant Claude integrations with built-in SDK retries, model fallback chains (Sonnet → Haiku), circuit breakers to avoid hammering a failing API, graceful degradation with cached/static responses, and per-request timeout configuration.
The SDK retries 429 (rate limit) and 529 (overloaded) automatically:
typescriptconst client = new Anthropic({ maxRetries: 3, // default: 2 timeout: 120_000, // 2 minutes });
typescriptconst FALLBACK_CHAIN = ['claude-sonnet-4-20250514', 'claude-haiku-4-5-20251001']; async function callWithFallback(params: Anthropic.MessageCreateParams) { for (const model of FALLBACK_CHAIN) { try { return await client.messages.create({ ...params, model }); } catch (err) { if (err instanceof Anthropic.APIError && err.status >= 500) { console.warn(`${model} failed (${err.status}), trying next...`); continue; } throw err; // Don't retry client errors (4xx) } } throw new Error('All models failed'); }
typescriptclass ClaudeCircuitBreaker { private failures = 0; private lastFailure = 0; private readonly threshold = 5; private readonly resetMs = 60_000; async call(params: Anthropic.MessageCreateParams) { if (this.failures >= this.threshold && Date.now() - this.lastFailure < this.resetMs) { throw new Error('Circuit open — Claude API unavailable'); } try { const result = await client.messages.create(params); this.failures = 0; return result; } catch (err) { if (err instanceof Anthropic.APIError && err.status >= 500) { this.failures++; this.lastFailure = Date.now(); } throw err; } } }
typescriptasync function getResponse(userInput: string): Promise<string> { try { const message = await client.messages.create({ model: 'claude-sonnet-4-20250514', max_tokens: 1024, messages: [{ role: 'user', content: userInput }], }); return message.content[0].text; } catch (err) { // Return cached/static response instead of failing console.error('Claude unavailable, using fallback'); return "I'm temporarily unable to process your request. Please try again shortly."; } }
typescriptconst client = new Anthropic({ timeout: 30_000, // 30s for most requests }); // Override per-request for long-running tasks const message = await client.messages.create(params, { timeout: 120_000, // 2 minutes for complex prompts });
maxRetries and timeout| Error | Cause | Solution | |-------|-------|----------| | API Error | Check error type and status code | See clade-common-errors |
See Built-In SDK Retries, Model Fallback Chain, Circuit Breaker class, Graceful Degradation handler, and Timeout Handling above.
See clade-policy-guardrails for content safety patterns.
clade-install-authEach section contains production-ready code examples. Copy and adapt them to your use case.
Integrate the patterns that match your requirements. Test each change individually.
Run your test suite to confirm the integration works correctly.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 23,368 | 16,952 | -27% | 1 | 1 | 0% | 4,488 | 4,592 | +2% | 0 | 0 | — |
case-02 | pass→pass | 14,888 | 12,000 | -19% | 1 | 1 | 0% | 2,763 | 3,298 | +19% | 0 | 0 | — |
case-03 | pass→fail | 16,663 | 13,556 | -19% | 1 | 1 | 0% | 2,668 | 3,406 | +28% | 0 | 0 | — |
case-04 | fail→pass | 13,006 | 7,997 | -39% | 1 | 1 | 0% | 2,194 | 2,344 | +7% | 0 | 0 | — |
case-05 | fail→fail | 6,978 | 6,224 | -11% | 1 | 1 | 0% | 1,356 | 2,085 | +54% | 0 | 0 | — |
case-06 | fail→pass | 8,447 | 7,694 | -9% | 1 | 1 | 0% | 1,508 | 2,416 | +60% | 0 | 0 | — |
case-07 | fail→pass | 11,178 | 6,125 | -45% | 1 | 1 | 0% | 2,057 | 2,236 | +9% | 0 | 0 | — |
case-08 | pass→pass | 21,192 | 4,277 | -80% | 1 | 1 | 0% | 1,759 | 1,800 | +2% | 0 | 0 | — |
case-09 | pass→pass | 11,907 | 4,279 | -64% | 1 | 1 | 0% | 1,837 | 1,799 | -2% | 0 | 0 | — |
case-10 | fail→pass | 15,590 | 6,585 | -58% | 1 | 1 | 0% | 2,560 | 2,290 | -11% | 0 | 0 | — |
case-11 | pass→pass | 9,836 | 2,889 | -71% | 1 | 1 | 0% | 1,895 | 1,554 | -18% | 0 | 0 | — |
case-17 | pass→pass | 15,591 | 7,789 | -50% | 1 | 1 | 0% | 2,879 | 1,997 | -31% | 0 | 0 | — |
case-12 | fail→pass | 10,417 | 3,619 | -65% | 1 | 1 | 0% | 2,026 | 1,712 | -15% | 0 | 0 | — |
case-13 | fail→pass | 13,291 | 9,410 | -29% | 1 | 1 | 0% | 2,217 | 2,697 | +22% | 0 | 0 | — |
case-14 | pass→pass | 6,726 | 5,120 | -24% | 1 | 1 | 0% | 1,063 | 1,930 | +82% | 0 | 0 | — |
case-15 | pass→pass | 9,748 | 2,685 | -72% | 1 | 1 | 0% | 1,804 | 1,450 | -20% | 0 | 0 | — |
case-16 | fail→pass | 8,148 | 4,441 | -45% | 1 | 1 | 0% | 1,467 | 1,879 | +28% | 0 | 0 | — |
case-18 | fail→pass | 12,685 | 5,588 | -56% | 1 | 1 | 0% | 2,095 | 1,997 | -5% | 0 | 0 | — |
case-19 | pass→pass | 11,175 | 9,220 | -17% | 1 | 1 | 0% | 1,966 | 2,567 | +31% | 0 | 0 | — |
case-20 | pass→pass | 2,921 | 1,316 | -55% | 1 | 1 | 0% | 468 | 1,263 | +170% | 0 | 0 | — |
case-21 | pass→pass | 10,794 | 6,393 | -41% | 1 | 1 | 0% | 1,725 | 2,029 | +18% | 0 | 0 | — |
case-22 | pass→pass | 5,746 | 4,151 | -28% | 1 | 1 | 0% | 967 | 1,755 | +81% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +36 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.