Circuit Breaker Pattern

🌐Community
by aj-geddes · vlatest · Repository

This skill implements the Circuit Breaker pattern to prevent cascading failures by temporarily halting requests when a service is overwhelmed – boosting resilience.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add circuit-breaker-pattern npx -- -y @trustedskills/circuit-breaker-pattern
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "circuit-breaker-pattern": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/circuit-breaker-pattern"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

The circuit-breaker pattern allows AI agents to detect when a specific tool or API call is failing repeatedly and automatically stop invoking it for a set duration. This prevents cascading errors, saves computational resources, and forces the agent to switch strategies or retry later once the service recovers.

When to use it

  • Failing External APIs: Stop an agent from looping endlessly when a weather or payment API returns 503 errors.
  • Rate Limit Protection: Halt requests immediately after hitting a quota limit to avoid temporary bans.
  • Unstable Integrations: Pause interactions with flaky third-party services while the system stabilizes.
  • Resource Conservation: Prevent wasting tokens and compute cycles on doomed operations during high-load periods.

Key capabilities

  • Automatic invocation halting after consecutive failures.
  • Configurable cooldown periods before retry attempts resume.
  • State tracking to distinguish between transient and permanent errors.
  • Graceful degradation by switching to fallback tools or alternative logic.

Example prompts

  • "Implement a circuit breaker for my weather API that stops requests after 3 consecutive failures and retries after 5 minutes."
  • "Add a circuit breaker pattern to prevent my agent from spamming the payment gateway during high traffic."
  • "Configure a fallback mechanism that activates when the primary search engine returns errors too frequently."

Tips & gotchas

Ensure you define clear thresholds for failure counts and cooldown durations; setting them too low may cause unnecessary interruptions, while setting them too high delays recovery. Monitor the underlying service health to distinguish between temporary glitches and permanent outages before relying on automatic fallbacks.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
aj-geddes
Installs
107

🌐 Community

Passed automated security scans.