Agent skill

Anth Reliability Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Implement reliability patterns for Claude API: circuit breakers, graceful degradation, idempotency, and fallback strategies.

MITAuto-check passedAI & LLM Engineering

Install Anth Reliability Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill anth-reliability-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace anth-reliability-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/anth-reliability-patterns .claude/skills/anth-reliability-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
anth-reliability-patterns
GitHub stars
2.8k
Token cost
~2k tokens
SKILL.md length
436 words
Files
1
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Implement reliability patterns for Claude API: circuit breakers, graceful degradation, idempotency, and fallback strategies.

  • Works in 5 steps: Validate request scope and estimate… → Apply bounded retries only to transient,… → Generate an application idempotency key… → …
  • With phrases like anthropic reliability
  • SKILL.md covers Overview, Circuit Breaker, Graceful Degradation and Idempotent Requests, plus 9 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Anth Reliability Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement reliability patterns for Claude API: circuit breakers, graceful degradation, idempotency, and fallback strategies. Trigger with phrases like "anthropic reliability", "claude circuit breaker", "claude fallback", "anthropic fault tolerance".

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Designed for Claude Code

It sits in AI & LLM Engineering, covering Error handling and LLM API integration. It works with Anthropic API. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • With phrases like anthropic reliability
  • Claude circuit breaker
  • Claude fallback
  • Anthropic fault tolerance

Example prompts

  • “anthropic reliability”
  • “claude circuit breaker”
  • “claude fallback”
  • “/anth-reliability-patterns”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Validate request scope and estimate budget before the call; reject unapproved models, destinations, or data classes before invoking the API.
  2. Apply bounded retries only to transient, repeat-safe failures. Coordinate backoff and breaker state across instances so a provider…
  3. Generate an application idempotency key from a stable request identity, not from an unredacted prompt. Cache only completed…
  4. Route to an explicitly approved fallback or a static response when the breaker opens. A fallback must preserve authorization and…
  5. Run a canary after configuration changes, compare error/latency/fallback metrics, and restore the prior configuration if thresholds or…

What it can do on your machine

Read from SKILL.md and the folder at commit 80f86df. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • platform.claude.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Anth Reliability Patterns loads about 2k tokens when it runs. Until then it costs about 69 tokens; SKILL.md has 436 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit 80f86df, republished under its MIT licence (© jeremylongshore). 436 words, ~1,981 tokens.

Download SKILL.mdSave it as .claude/skills/anth-reliability-patterns/SKILL.md (or your agent's skills folder).
name
anth-reliability-patterns
description
Implement reliability patterns for Claude API: circuit breakers, graceful degradation, idempotency, and fallback strategies. Trigger with phrases like "anthropic reliability", "claude circuit breaker", "claude fallback", "anthropic fault tolerance".
allowed-tools
Read, Write, Edit, Grep
compatibility
Designed for Claude Code
version
1.7.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, ai, anthropic

Anthropic Reliability Patterns

Overview

Production reliability patterns for Claude API: circuit breaker (prevent cascading failures), graceful degradation (serve fallbacks), idempotency (safe retries), and timeout management.

Circuit Breaker

python
import time
from enum import Enum

class CircuitState(Enum):
    CLOSED = "closed"       # Normal operation
    OPEN = "open"           # Failing, reject requests
    HALF_OPEN = "half_open" # Testing recovery

class ClaudeCircuitBreaker:
    def __init__(self, failure_threshold: int = 5, recovery_timeout: int = 60):
        self.state = CircuitState.CLOSED
        self.failures = 0
        self.threshold = failure_threshold
        self.recovery_timeout = recovery_timeout
        self.last_failure_time = 0.0

    def call(self, func, *args, **kwargs):
        if self.state == CircuitState.OPEN:
            if time.time() - self.last_failure_time > self.recovery_timeout:
                self.state = CircuitState.HALF_OPEN
            else:
                raise Exception("Circuit breaker OPEN — Claude API unavailable")

        try:
            result = func(*args, **kwargs)
            if self.state == CircuitState.HALF_OPEN:
                self.state = CircuitState.CLOSED
                self.failures = 0
            return result
        except Exception as e:
            self.failures += 1
            self.last_failure_time = time.time()
            if self.failures >= self.threshold:
                self.state = CircuitState.OPEN
            raise

# Usage
breaker = ClaudeCircuitBreaker(failure_threshold=5, recovery_timeout=60)

def safe_claude_call(prompt: str) -> str:
    try:
        return breaker.call(
            client.messages.create,
            model="claude-sonnet-4-20250514",
            max_tokens=1024,
            messages=[{"role": "user", "content": prompt}]
        ).content[0].text
    except Exception:
        return "AI assistant is temporarily unavailable."

Graceful Degradation

python
import anthropic

def complete_with_fallback(prompt: str) -> str:
    """Try Sonnet → Haiku → cached response → static fallback."""
    models = ["claude-sonnet-4-20250514", "claude-haiku-4-20250514"]

    for model in models:
        try:
            msg = client.messages.create(
                model=model,
                max_tokens=1024,
                messages=[{"role": "user", "content": prompt}]
            )
            return msg.content[0].text
        except anthropic.RateLimitError:
            continue  # Try cheaper model
        except anthropic.APIStatusError:
            continue  # Try next model

    # All models failed — return cached or static response
    cached = cache.get(f"claude:{hash(prompt)}")
    if cached:
        return f"[Cached response] {cached}"

    return "Our AI assistant is temporarily unavailable. Please try again in a few minutes."

Idempotent Requests

python
import hashlib
import json

class IdempotentClaude:
    def __init__(self):
        self.client = anthropic.Anthropic()
        self.cache = {}  # Use Redis in production

    def create_message(self, idempotency_key: str | None = None, **kwargs) -> str:
        # Generate deterministic key from request params if not provided
        if not idempotency_key:
            idempotency_key = hashlib.sha256(
                json.dumps(kwargs, sort_keys=True, default=str).encode()
            ).hexdigest()

        # Return cached result for duplicate requests
        if idempotency_key in self.cache:
            return self.cache[idempotency_key]

        msg = self.client.messages.create(**kwargs)
        result = msg.content[0].text
        self.cache[idempotency_key] = result
        return result

Timeout Configuration

python
# Layer timeouts for defense-in-depth
client = anthropic.Anthropic(
    timeout=60.0,      # SDK-level timeout (covers connect + read)
    max_retries=3,     # Auto-retry on 429/5xx
)

# Per-request timeout override
msg = client.messages.create(
    model="claude-haiku-4-20250514",
    max_tokens=64,
    messages=[{"role": "user", "content": "Quick question"}],
    timeout=10.0  # Override for fast operations
)

Reliability Checklist

  • Circuit breaker prevents cascading failures
  • Graceful degradation serves fallback responses
  • Idempotency keys prevent duplicate processing
  • Timeouts configured at SDK and application level
  • Health check probes API connectivity
  • Retry logic uses exponential backoff (SDK default)
  • Rate limit headers monitored for pre-emptive throttling

Prerequisites

  • Define an approved model/workspace policy, request timeout, retry and circuit thresholds, fallback behavior, idempotency store, and rollback owner.
  • Exercise the controls in a sandbox using synthetic prompts and a no-op downstream sink before enabling production traffic.
  • Permit telemetry to contain only correlation IDs, status classes, model IDs, token counts, latency, breaker state, and aggregate fallback counts. Never store prompts, completions, credentials, or sensitive tool arguments.

Instructions

  1. Validate request scope and estimate budget before the call; reject unapproved models, destinations, or data classes before invoking the API.
  2. Apply bounded retries only to transient, repeat-safe failures. Coordinate backoff and breaker state across instances so a provider incident does not create a retry storm.
  3. Generate an application idempotency key from a stable request identity, not from an unredacted prompt. Cache only completed, policy-approved results and never deduplicate operations with unreviewed side effects.
  4. Route to an explicitly approved fallback or a static response when the breaker opens. A fallback must preserve authorization and data-handling rules rather than silently widening scope.
  5. Run a canary after configuration changes, compare error/latency/fallback metrics, and restore the prior configuration if thresholds or data controls regress. Expire test fixtures and temporary cache entries.
Show full SKILL.md (161 more words)Show less

Output

Return a reliability receipt with correlation ID, breaker transition, retry attempts and reasons, fallback route, idempotency outcome, timeout, aggregate token/cost counters, canary result, rollback reference, and cleanup status. Keep content and secret fields redacted.

Error Handling

  • Do not retry validation, authentication, permission, or policy failures; surface a stable operator-safe error and preserve the original request ID.
  • When all fallbacks fail, fail closed with a bounded user-facing message and queue only work that has an explicit retention and replay policy.
  • If a cached response is stale, scope-mismatched, or missing its policy version, discard it and use the static fallback.
  • If duplicate suppression or breaker state is unavailable, stop new nonessential traffic rather than issuing uncoordinated retries.

Examples

In a sandbox, inject five synthetic 529 responses, confirm the breaker opens, then allow one half-open probe. Record retries=bounded; fallback=static; duplicate_writes=0; canary=pass; rollback=not-needed, with no prompt or completion in the receipt.

Resources

Next Steps

For policy guardrails, see anth-policy-guardrails.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/.curated/anth-reliability-patterns of jeremylongshore/tons-of-skills-marketplace.

Open the folder on GitHubat commit 80f86df

Compare with similar skills

Anth Reliability Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Anth Reliability Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Anth Reliability Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2kAutomated safety check: PassMIT
Claude Cookbooks Reference2025Emma/vibe-coding-cn23k1 repos~2.2kAutomated safety check: PassMIT
ModLens Image Vision Bridgeliustack/modlens4.2k—~1.3kAutomated safety check: NotesMIT
Claude APIKocoro-lab/Kocoro4147 repos~4.5kAutomated safety check: PassApache-2.0
Using Ccproxy Inspectorstarbaser/ccproxy350—~2.7kAutomated safety check: PassCustom licence
Anthropic Product Knowledgesyahiidkamil/Software-Engineer-AI-Agent-Atlas4014 repos~651Automated safety check: PassNone

Similar skills

  • Claude Cookbooks Reference

    2025Emma/vibe-coding-cn

    Reference of Claude API examples and guides covering tool use, vision, RAG, classification, summarization, text-to-SQL, prompt caching and agent patterns.

    23k GitHub starsUsed in 1 repo~2.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Gives text-only models sight by running the modlens CLI on an image path or URL and returning structured JSON evidence with transcribed text, layout and semantics.

    4.2k GitHub stars~1.3k tokensUpdated 5 days ago
    AI & LLM EngineeringAuto-check: notes
  • Claude API

    Kocoro-lab/Kocoro

    Build apps with the Claude API or Anthropic SDK. An agent skill from Kocoro-lab/Kocoro.

    414 GitHub starsUsed in 7 repos~4.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Using Ccproxy Inspector

    starbaser/ccproxy

    Operates the ccproxy inspector MITM system for intercepting, inspecting, and transforming LLM API traffic.

    350 GitHub stars~2.7k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Anthropic Product Knowledge

    syahiidkamil/Software-Engineer-AI-Agent-Atlas

    Stop and consult this skill whenever your response would include specific facts about Anthropic's products.

    401 GitHub starsUsed in 4 repos~651 tokens
    AI & LLM EngineeringAuto-check passed
  • Using Ccproxy API

    starbaser/ccproxy

    Guides users through ccproxy as an OpenAI-compatible and Anthropic-compatible LLM API server with SDK integration, OAuth authentication, sentinel key substitution, model routing, and troubleshooting.

    350 GitHub stars~4k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Questions about Anth Reliability Patterns

What does Anth Reliability Patterns do?

Implement reliability patterns for Claude API: circuit breakers, graceful degradation, idempotency, and fallback strategies. Anth Reliability Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement reliability patterns for Claude API: circuit breakers, graceful degradation, idempotency, and fallback strategies.

When should I use Anth Reliability Patterns?

Anth Reliability Patterns fits situations like: with phrases like anthropic reliability; Claude circuit breaker; Claude fallback; anthropic fault tolerance.

How do I install Anth Reliability Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill anth-reliability-patterns -a claude-code`. Or copy the skill folder (skills/.curated/anth-reliability-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/anth-reliability-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Anth Reliability Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill anth-reliability-patterns -a codex`. Or copy the skill folder (skills/.curated/anth-reliability-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/anth-reliability-patterns in your project. Codex loads it when a task matches its description.

Can I use Anth Reliability Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill anth-reliability-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/anth-reliability-patterns, .gemini/skills/anth-reliability-patterns, .github/skills/anth-reliability-patterns and .opencode/skills/anth-reliability-patterns in your project.

What does Anth Reliability Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Anth Reliability Patterns is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Anth Reliability Patterns access the network?

SKILL.md names 1 domain. As links in the text: platform.claude.com. This is read from the text; nothing was executed.

Is Anth Reliability Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Anth Reliability Patterns use?

Anth Reliability Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Anth Reliability Patterns use?

About 2k tokens (SKILL.md is roughly 7.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Anth Reliability Patterns?

Skills that share tags, products or a category with Anth Reliability Patterns: Claude Cookbooks Reference (2025Emma/vibe-coding-cn, 23k stars), ModLens Image Vision Bridge (liustack/modlens, 4.2k stars), Claude API (Kocoro-lab/Kocoro, 414 stars) and Using Ccproxy Inspector (starbaser/ccproxy, 350 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Anth Reliability Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,825 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 9, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.