Skip to content
aj-geddes avatar

Circuit Breaker Pattern

Reusable circuit breaker pattern that stops cascading failures with states, fallbacks, and monitoring.

CCM score
40 of 100
skills.sh installs
482
GitHub stars
396
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the closed, open, and half-open states, with failure counting, reset timeouts, and recovery thresholds
  • Includes a minimal TypeScript example plus reference guides for TypeScript, Node.js (opossum-style), Python, and Java (Resilience4j-style)
  • Adds a monitored variant that logs state transitions and alerts on frequent trips
  • Designed for external API calls, microservice communication, database connections, and third-party integrations

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill circuit-breaker-pattern -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Circuit Breaker Pattern

Table of Contents

Overview

Implement circuit breaker patterns to prevent cascading failures and provide graceful degradation when dependencies fail.

When to Use

  • External API calls
  • Microservices communication
  • Database connections
  • Third-party service integrations
  • Preventing cascading failures
  • Implementing fallback mechanisms
  • Rate limiting protection
  • Timeout handling

Quick Start

Minimal working example:

enum CircuitState {
  CLOSED = "CLOSED",
  OPEN = "OPEN",
  HALF_OPEN = "HALF_OPEN",
}

interface CircuitBreakerConfig {
  failureThreshold: number;
  successThreshold: number;
  timeout: number;
  resetTimeout: number;
}

interface CircuitBreakerStats {
  failures: number;
  successes: number;
  consecutiveFailures: number;
  consecutiveSuccesses: number;
  lastFailureTime?: number;
}

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Category
Backend & APIs
First seen
Jun 3, 2026

Questions

What does the circuit-breaker-pattern skill do?

The circuit-breaker-pattern skill implements circuit breakers for fault tolerance, automatic failure detection and fallback mechanisms. It stops cascading failures when external services, microservices or database connections go down, and it provides graceful degradation with fallbacks.

How do I install the circuit-breaker-pattern skill?

Run npx -y skills add aj-geddes/useful-ai-prompts --skill circuit-breaker-pattern -y in your project. After that, the circuit-breaker-pattern skill lets your agent add circuit breakers around calls to external APIs and third-party integrations.

Which languages do the circuit-breaker-pattern reference guides cover?

The circuit-breaker-pattern skill ships reference guides for TypeScript, Node.js using an Opossum-style breaker, Python, and Java using a Resilience4j-style breaker. It also includes a guide that adds monitoring to the circuit breaker.

Where does the circuit-breaker-pattern skill fit in the Backend & APIs category?

The circuit-breaker-pattern skill is listed in the Backend & APIs category on Claude Marketplaces, next to entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. Its distinct focus is resilience: detecting failing dependencies and falling back before they take the whole system down.

More from aj-geddes/useful-ai-prompts

All 258

Similar to Circuit Breaker Pattern

More Backend & APIs