/claude-pack:clade-reliability-patternsfrom claude-pack
Builds fault-tolerant Claude integrations with SDK retries, model fallback chains, circuit breakers, graceful degradation, and timeout configuration.
Ships in claude-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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:
const client = new Anthropic({
maxRetries: 3, // default: 2
timeout: 120_000, // 2 minutes
});
const 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');
}
class 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;
}
}
}
async 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.";
}
}
const 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.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
32 skills in this plugin
/clade-advanced-troubleshootingDebug complex Claude issues — inconsistent outputs, tool use failures,
Use when working with advanced-troubleshooting patterns.
streaming problems, and edge cases.
Trigger with "claude inconsistent", "anthropic advanced debug",
"claude tool use broken", "anthropic streaming issues".
/clade-architecture-variantsBuild different types of Claude-powered applications — chatbots, RAG systems,
Use when working with architecture-variants patterns.
agents, content pipelines, and code generation tools.
Trigger with "claude architecture", "anthropic rag", "build with claude",
"claude agent pattern", "anthropic app design".
/clade-ci-integrationTest and validate Claude integrations in CI/CD pipelines —
Use when working with ci-integration patterns.
GitHub Actions, mocking strategies, and cost control.
Trigger with "anthropic ci", "test claude in ci", "anthropic github actions",
"claude automated testing".
/clade-common-errorsDiagnose and fix Anthropic API errors — authentication, rate limits,
Use when working with common-errors patterns.
overloaded, context length, and content policy issues.
Trigger with "anthropic error", "claude 429", "claude overloaded",
"anthropic not working", "debug claude api".
/clade-core-workflow-aRedirect to claude-model-inference for Messages API streaming,
vision, and structured output patterns.
Use when looking for the primary Anthropic workflow.
Trigger with "anthropic workflow", "claude main workflow".
/clade-core-workflow-bRedirect to claude-embeddings-search for tool use (function calling)
and agentic loop patterns with Claude.
Use when looking for the secondary Anthropic workflow.
Trigger with "anthropic tools", "claude function calling".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin claude-packOther plugins' skills for the same job