api-resilience-patterns

api-resilience-patterns is a skill for Claude Code, Codex from BuilderCed/agent-skills. It costs 33 tokens per session (959 once invoked), scanned A, original, MIT.

A collection of software design patterns for keeping applications working when external services are slow, unavailable, or rate-limited. It covers circuit breakers, delayed retries, rate limits, isolation, timeouts, and reduced-service fallbacks.

In plain words
What is it for?
Use it when calling external APIs, connecting microservices, building agents that use several tools, handling language-model provider limits, or preventing cascading failures.
Why use it?
Calls to APIs can fail repeatedly or pile up, causing wider outages and slow applications. These patterns limit repeated failures and define safer ways to retry or degrade service.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for cline. Also seen: mentions Codex; built for cline; mentions Gemini CLI.

Good fit Use it when calling external APIs, connecting microservices, building agents that use several tools, handling language-model provider limits, or preventing cascading failures.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/builderced/agent-skills/api-resilience-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add BuilderCed/agent-skills --skill api-resilience-patterns
Clone the repo
git clone --depth 1 https://github.com/BuilderCed/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-resilience-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/builderced/agent-skills/api-resilience-patterns/github.svg)](https://agentmods.dev/skills/builderced/agent-skills/api-resilience-patterns)
Your own site
<a href="https://agentmods.dev/skills/builderced/agent-skills/api-resilience-patterns"><img src="https://agentmods.dev/badge/skills/builderced/agent-skills/api-resilience-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-resilience-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/builderced/agent-skills/api-resilience-patterns"><img src="https://agentmods.dev/badge/skills/builderced/agent-skills/api-resilience-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 959 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.00959
Opus 5.5 $0.00013 $0.00384
Sonnet 5.5 $0.00007 $0.00192
Haiku 4.5 $0.00003 $0.00096

Measured 1mo ago against content hash 86c462ebe4e5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-resilience-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/resilience/api-resilience-patterns/SKILL.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API Resilience Patterns

When to Use

  • Calling external APIs that might fail or slow down
  • Designing microservice communication
  • Building agents that call multiple tools/APIs
  • Handling rate limits from LLM providers
  • Preventing cascade failures

Pattern 1: Circuit Breaker

Prevents repeated calls to a failing service.

States: Closed (normal) → Open (failing) → Half-Open (testing)

State Behavior Transition
Closed Forward requests normally → Open after N consecutive failures
Open Reject immediately (fail fast) → Half-Open after cooldown period
Half-Open Allow 1 test request → Closed if success, → Open if fail

Config: threshold=3 failures, cooldown=30s, half-open-max=1.

Pattern 2: Retry with Exponential Backoff

Attempt 1: immediate
Attempt 2: wait 1s + random(0-500ms)
Attempt 3: wait 2s + random(0-500ms)
Attempt 4: wait 4s + random(0-500ms)
Max: 5 attempts, 16s max wait

Rules:

  • Only retry on transient errors (429, 500, 502, 503, timeout)
  • Never retry on client errors (400, 401, 403, 404)
  • Always add jitter to prevent thundering herd
  • Set a total timeout budget (not just per-attempt)

Pattern 3: Rate Limiting (Client-Side)

Respect provider limits proactively:

Strategy When How
Token bucket Steady rate with bursts Refill N tokens/sec, consume per request
Sliding window Strict per-minute limits Track timestamps of last N requests
Queue-based Ordered processing FIFO queue with configurable concurrency

Pattern 4: Bulkhead Isolation

Isolate failures to prevent cascade:

  • Separate connection pools per service
  • Separate thread/worker pools per dependency
  • If service A fails, services B and C are unaffected

Pattern 5: Timeout Management

Tier Timeout Purpose
Connection 5s Detect unreachable host
Request 30s Detect slow response
Total operation 60s Budget for retries included

Read the full file on GitHub · 116 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 116 lines · 33 tokens per session scan A 86c462ebe4e5

Subscribe to this mod's changes

api-resilience-patterns is a skill published in the GitHub repository BuilderCed/agent-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 33 tokens to every session and 959 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

api-rate-limit-handler

Implement bounded, idempotency-aware API throttling, backoff, and retry handling for 429 and transient 5xx responses.

sickn33/agentic-awesome-skills · 32 tokens

error-handling

Use when designing the reaction to a class of failures — typed error taxonomies, retry/backoff/timeout policy, circuit breakers, React/Next error boundaries, and the user-message vs operator-log split. NOT diagnosing one specific crash (that is debug), NOT logs/metrics/traces (that is observability), NOT the wire…

ericrisco/rsc-harness · 78 tokens

architecture-paradigm-event-driven

Applies event-driven async messaging to decouple producers and consumers. Use when designing real-time or multi-subscriber systems needing loose coupling.

athola/claude-night-market · 34 tokens

backend-resilience-patterns

Use this skill when the user says 'resilience', 'circuit breaker', 'retry', 'bulkhead', 'timeout', 'fallback', 'resilience4j', 'fault tolerance', 'rate limiter', 'backoff', 'retry strategy', 'bulkhead pattern'. This skill applies production fault-tolerance patterns: circuit breaker, retry with backoff, bulkhead…

j4flmao/agent-skills · 121 tokens

matematic-mcp-fastmcp-instructions-pl

Buduj nowy MCP server MateMatic (lub retrofit istniejacego) z 9 elementami (5 zwalidowanych na dograh v1.31.0) - FastMCP(instructions=) z procedural orchestration, drift test, dwukanalowy auth X-API-Key LUB Bearer, OTel atrybut orgid dla per-tenant routing, ToolAnnotations dla read-only, stabilne kody bledow +…

matematicsolutions/awesome-matematic-skills-pl · 335 tokens

api-rate-limit-handler

Implement bounded, idempotency-aware API throttling, backoff, and retry handling for 429 and transient 5xx responses.

lingxling/awesome-skills-cn · 32 tokens