Command Palette

Search for a command to run...

Back to skills
skill № 68649

backend-resilience-patterns

Use when the user asks about a circuit breaker around a flaky service, retries with backoff and jitter, timeouts, bulkheads, fallbacks, Resilience4j or Polly…

FreeNo executable scripts
j4flmaoby j4flmao★ 47 GitHub stars

Install backend-resilience-patterns in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Backend Resilience Patterns

Purpose

Protect backend services from cascading failures by applying circuit breakers, retries with backoff, bulkheads, timeouts, and fallbacks. Resilience is not optional — every external call must be wrapped in fault-tolerance patterns.

Agent Protocol

Trigger

Exact user phrases: "resilience", "circuit breaker", "retry", "bulkhead", "timeout", "fallback", "resilience4j", "fault tolerance", "retry strategy", "backoff", "rate limiter".

Input Context

  • Type of external calls (HTTP, database, message queue).
  • Existing retry or timeout configuration.
  • SLAs and latency requirements.

Output Artifact

Configuration snippets or code. No file unless requested.

Response Format

Pattern: {circuit-breaker|retry|bulkhead|timeout|fallback}
Config: {key parameters and values}

Completion Criteria

  • At least timeout configured for every external call.
  • Retry with exponential backoff and jitter configured.
  • Circuit breaker defined per dependency (not one for all).
  • Fallback handler defined for every circuit breaker.
  • Bulkhead isolation applied to thread pools where needed.

Max Response Length

4 lines per pattern. 20 lines for full configuration.

Architecture Decision Tree

Which Resilience Pattern?

What type of failure are you protecting against?
  ├── Slow responses (server busy, GC pause, overloaded)
  │   └── Timeout + Circuit Breaker
  ├── Transient failures (network blip, connection reset, DNS failure)
  │   └── Retry with backoff + Circuit Breaker
  ├── Resource exhaustion (thread pool, connection pool, memory)
  │   └── Bulkhead + Circuit Breaker
  ├── Downstream service completely down
  │   └── Circuit Breaker + Fallback
  └── Client sending too many requests
      └── Rate Limiter + Bulkhead

Pattern Composition Order

How should patterns be composed?
  ┌─────────────────────────────────┐
  │ 1. Timeout (outermost)          │  ← Fail fast
  │ 2. Bulkhead (semaphore limit)   │  ← Isolate resources
  │ 3. Circuit Breaker              │  ← Stop cascading failures
  │ 4. Retry (innermost)            │  ← Retry transient failures
  │ 5. Fallback (catch-all)         │  ← Degrade gracefully
  └─────────────────────────────────┘

Timeout Strategy Decision

What is the nature of the downstream call?
  ├── Internal service (same datacenter) → 2-5s
  ├── External API (third-party) → 5-10s
  ├── Database query → 5-30s (depending on query)
  ├── Batch/analytics query → 30-60s
  └── Must be LOWER than the caller's timeout of YOU

Workflow

Step 1: Configure Timeouts

Every external call needs a timeout. No exceptions.

timeouts:
  http_internal: { connect: 2s, read: 5s, write: 5s }
  http_external: { connect: 5s, read: 10s, write: 10s }
  database: { query: 10s, transaction: 30s }
  message_queue: { publish: 5s, consume: 30s }

Step 2: Configure Retries

retry:
  max_attempts: 3
  backoff: exponential
  initial_delay: 100ms
  multiplier: 2
  jitter: 50ms
  max_delay: 10s
  retry_on:
    - 5xx (except 500 if idempotent)
    - network_error
    - timeout
  do_not_retry:
    - 4xx (client errors)
    - 400 (bad request — will always fail)
    - 401/403 (auth — will always fail)
    - 404 (not found — will always fail)
    - 409 (conflict — needs human resolution)
async function retryWithBackoff(fn, options = {}) {
  const { maxAttempts = 3, initialDelay = 100, maxDelay = 10000 } = options;
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
    try {
      return await fn();
    } catch (error) {
      if (attempt === maxAttempts) throw error;
      if (!isRetryable(error)) throw error;
      const delay = Math.min(initialDelay * Math.pow(2, attempt - 1), maxDelay);
      const jitter = delay * 0.5 * Math.random();
      await sleep(delay + jitter);
    }
  }
}

Step 3: Configure Circuit Breaker

circuit_breaker:
  per_dependency: true                    # One CB per downstream service
  sliding_window_size: 10                 # Number of calls to evaluate
  minimum_calls: 5                        # Minimum before evaluating
  failure_rate_threshold: 50              # % failures to open circuit
  wait_duration_open: 30s                 # Time before half-open
  half_open_max_calls: 3                  # Probe requests in half-open
  record_slow_calls: true                 # Treat slow calls as failures
  slow_call_duration_threshold: 5s        # What counts as "slow"
// Node.js implementation using opossum
import CircuitBreaker from 'opossum';

const circuitBreaker = new CircuitBreaker(callExternalService, {
  timeout: 5000,
  errorThresholdPercentage: 50,
  resetTimeout: 30000,
  volumeThreshold: 5,
});

circuitBreaker.fallback(() => {
  return { status: 'degraded', cachedData: getStaleData() };
});

circuitBreaker.on('open', () => logger.warn('Circuit breaker opened for payment-service'));
circuitBreake
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • references/bulkhead-patterns.md
  • references/circuit-breaker-patterns.md
  • references/fallback-strategies.md
  • references/resilience-cache.md
  • references/resilience-testing.md
  • references/resilience4j-guide.md
  • references/retry-backoff-strategies.md
  • references/timeout-retry-patterns.md

FAQ

What does the backend-resilience-patterns skill do?

Use when the user asks about a circuit breaker around a flaky service, retries with backoff and jitter, timeouts, bulkheads, fallbacks, Resilience4j or Polly. Produces fault-tolerance config and code per dependency. Not for API request throttling (use rate-limiting).

How do I install the backend-resilience-patterns skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the backend-resilience-patterns skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare backend-resilience-patterns with