auto-generated-circuit-breaker-pattern

Implement per-service circuit breakers for external API calls with configurable timeouts.

Updated Aug 17, 2025
One-click install
npx skills add https://github.com/planetaryescape/ai-digest --skill auto-generated-circuit-breaker-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auto-generated-circuit-breaker-pattern
Source: https://github.com/planetaryescape/ai-digest/tree/main/.claude/skills/auto-generated-circuit-breaker-pattern
Command: npx skills add https://github.com/planetaryescape/ai-digest --skill auto-generated-circuit-breaker-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured pattern to guard external API calls with per-service circuit breakers, preventing cascading failures and enabling graceful degradation.

Core Features & Use Cases

  • Singleton breaker instances per service using a shared registry to coordinate state across the application.
  • Configurable timeouts, thresholds, and automatic recovery to balance availability and fault tolerance.
  • Uniform execute wrapper to encapsulate async calls and provide consistent error handling and logging.
  • Observability via state and statistics reporting for proactive monitoring and debugging.

Quick Start

Integrate the EnhancedCircuitBreaker by replacing direct external calls with the breaker.execute wrapper.

Frequently Asked Questions about auto-generated-circuit-breaker-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent cascading failures when calling external APIs in a TypeScript backend?

You prevent cascading failures by implementing circuit breakers that wrap external API calls. This pattern uses a singleton registry to track state, configurable timeouts, and an execute wrapper to halt traffic to failing downstream services automatically.

What is a singleton circuit breaker registry and how does it manage fault tolerance?

A singleton circuit breaker registry maintains shared breaker instances per service to coordinate state across an application. It enforces fault tolerance through configurable thresholds, automatic recovery, and environment-driven timeouts for external API calls.

How do I configure timeouts for circuit breakers in a backend service?

You configure circuit breaker timeouts through environment-driven configuration variables. This allows backend services to dynamically adjust availability and fault tolerance thresholds for external API calls without modifying application code.

Can I track circuit breaker state changes and statistics for runtime observability?

Yes, you can track circuit breaker state changes and statistics using event listeners. This provides runtime observability and diagnostics for backend services, enabling proactive monitoring under both normal and degraded API conditions.

What's the best way to handle async API calls gracefully during degraded service conditions?

The best way to handle async API calls gracefully is by encapsulating them in a uniform execute wrapper. This provides consistent error handling, logging, and automatic state tracking via a singleton circuit breaker to manage degraded conditions.

When should I not use a circuit breaker pattern for external API calls?

Avoid using a circuit breaker pattern for internal or highly reliable API calls where cascading failure risk is minimal. It is designed specifically for external API dependencies requiring fault tolerance, state management, and timeout handling under degraded conditions.