implement-circuit-breaker

Implement configurable circuit breakers with state machine, metrics, and fallbacks.

Updated Oct 27, 2025
One-click install
npx skills add https://github.com/mariotoffia/gobridge --skill implement-circuit-breaker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implement-circuit-breaker
Source: https://github.com/mariotoffia/gobridge/tree/main/.cursor/skills/implement-circuit-breaker
Command: npx skills add https://github.com/mariotoffia/gobridge --skill implement-circuit-breaker

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a structured approach to protecting services from cascading failures by introducing circuit breakers around unreliable dependencies.

Core Features & Use Cases

  • Stateful protection: Open, Half-Open, and Closed states with configurable timeouts and thresholds.
  • Configurable recovery: Tailor intervals, max in-flight requests, and failure thresholds to match dependency behavior.
    • Use Case: Safeguard external APIs (payments, data fetchers) and cache layers from latency spikes.
  • Observability & fallbacks: Emit metrics and implement graceful degradation when dependencies are unhealthy.
  • Use Case: Maintain responsive UX during partial outages.

Quick Start

Wrap your HTTP client calls with a circuit breaker using a configurable pattern to enable fast failure and recovery.

Frequently Asked Questions about implement-circuit-breaker

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

FAQPage Schema
How do I prevent cascading failures when calling external APIs?

A circuit breaker prevents cascading failures by wrapping external API calls with a state machine that stops traffic when failure thresholds are exceeded. It safeguards dependencies like payment or data fetcher services from latency spikes and outages by failing fast.

What is a circuit breaker state machine and how does it handle recovery?

A circuit breaker state machine transitions between closed, open, and half-open states to manage fault tolerance. It uses configurable timeouts, failure thresholds, and recovery intervals to test dependency health before allowing full traffic to resume.

How do I configure circuit breaker thresholds and timeouts for HTTP clients?

Configure circuit breaker thresholds and timeouts by setting failure limits, max in-flight requests, and recovery intervals to match your HTTP client dependency behavior. This tailors the state machine to trigger fast failure during latency spikes.

Can I implement graceful degradation with fallbacks when a dependency is unhealthy?

Yes, you can implement graceful degradation using a pluggable fallback strategy when a dependency is unhealthy. This allows your service to maintain a responsive UX during partial outages by returning fallback data instead of errors.

What is the best way to add observability to a circuit breaker in distributed systems?

The best way to add observability is configuring the circuit breaker to emit metrics and logs during state transitions. This provides visibility into fault tolerance behavior across distributed systems and helps track dependency health.