circuit-breaker-pattern

circuit-breaker-pattern is a skill for Claude Code from pjt222/agent-almanac. It costs 115 tokens per session (5,182 once invoked), scanned A, original, MIT.

A design pattern for agents that depend on several tools and must cope when one of them fails. It tracks tool health, stops repeated failed calls, narrows the task when needed, and uses suitable alternatives when available.

In plain words
What is it for?
Use it when building or hardening agents with multiple tool dependencies, partial-result workflows, or failure and outage handling.
Why use it?
It prevents one unavailable tool from causing the whole agent workflow to fail or enter a retry loop.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the agent-almanac plugin — 122 skills, 77 agents shipped together

Good fit Use it when building or hardening agents with multiple tool dependencies, partial-result workflows, or failure and outage handling.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pjt222/agent-almanac/circuit-breaker-pattern
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add pjt222/agent-almanac --skill circuit-breaker-pattern
Clone the repo
git clone --depth 1 https://github.com/pjt222/agent-almanac

Made for: Claude Code.

Or install agent-almanac, the plugin that ships this one along with the rest of its 122 skills, 77 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for circuit-breaker-pattern

README.md
[![agentmods](https://agentmods.dev/badge/skills/pjt222/agent-almanac/circuit-breaker-pattern/github.svg)](https://agentmods.dev/skills/pjt222/agent-almanac/circuit-breaker-pattern)
Your own site
<a href="https://agentmods.dev/skills/pjt222/agent-almanac/circuit-breaker-pattern"><img src="https://agentmods.dev/badge/skills/pjt222/agent-almanac/circuit-breaker-pattern/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for circuit-breaker-pattern

Your own site · 80×15
<a href="https://agentmods.dev/skills/pjt222/agent-almanac/circuit-breaker-pattern"><img src="https://agentmods.dev/badge/skills/pjt222/agent-almanac/circuit-breaker-pattern.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,182 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Excessive Agency · line 392
    Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.
    Fix: Restrict tool access to only the tools required for the skill's stated purpose. Use an explicit allowlist rather than granting blanket access.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00115 $0.05182
Opus 5.5 $0.00046 $0.02073
Sonnet 5.5 $0.00023 $0.01036
Haiku 4.5 $0.00012 $0.00518

Measured 1mo ago against content hash 14d6f127b045, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

circuit-breaker-pattern scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

i18n/caveman-lite/skills/circuit-breaker-pattern/SKILL.md · 466 lines

How it starts

The opening of the file, as written. The whole thing — 466 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Circuit Breaker Pattern

Graceful degradation when tools fail. An agent that calls five tools and one is broken should not fail entirely — it should recognize the broken tool, stop calling it, reduce scope to what remains achievable, and report honestly about what was skipped. This skill codifies that logic using the circuit breaker pattern from distributed systems, adapted to agentic tool orchestration.

The core insight, from kirapixelads' "Kitchen Fire Problem": the expeditor (orchestration layer) must not cook. Separation of concerns between deciding what to attempt and how to attempt it prevents the orchestrator from getting trapped in a failing tool's retry loop.

When to Use

  • Building agents that depend on multiple tools with varying reliability
  • Designing fault-tolerant agentic workflows where partial results are better than total failure
  • An agent is stuck in a retry loop on a broken tool instead of continuing with working tools
  • Recovering gracefully from tool outages mid-task
  • Hardening existing agents against cascading tool failures
  • Stale or cached tool output is being treated as fresh data

Inputs

  • Required: List of tools the agent depends on (names and purposes)
  • Required: The task the agent is trying to accomplish
  • Optional: Known tool reliability issues or past failure patterns
  • Optional: Failure threshold (default: 3 consecutive failures before opening circuit)
  • Optional: Failure budget per cycle (default: 5 total failures before pause-and-report)
  • Optional: Half-open probe interval (default: every 3rd attempt after opening)

Procedure

Step 1: Build the Capability Map

Declare what each tool provides and what alternatives exist. This map is the foundation for scope reduction — without it, a tool failure leaves the agent guessing about what to do next.

capability_map:
  - tool: Grep
    provides: content search across files
    alternatives:
      - tool: Bash
        method: "rg or grep command"
        degradation: "loses Grep's built-in output formatting"
      - tool: Read
        method: "read suspected files directly"
        degradation: "requires knowing which files to check; no broad search"
    fallback: "ask the user which files to examine"

  - tool: Bash
    provides: command execution, build tools, git operations
    alternatives: []
    fallback: "report commands that need to be run manually"

  - tool: Read
    provides: file content inspection
    alternatives:
      - tool: Bash
        method: "cat or head command"
        degradation: "loses line numbering and truncation safety"
    fallback: "ask the user to paste file contents"

  - tool: Write
    provides: file creation
    alternatives:
      - tool: Edit
        method: "create via full-file edit"
        degradation: "requires file to already exist for Edit"
      - tool: Bash
        method: "echo/cat heredoc"
        degradation: "loses Write's atomic file creation"
    fallback: "output file contents for the user to save manually"

  - tool: WebSearch
    provides: external information retrieval
    alternatives: []
    fallback: "state what information is needed; ask user to provide it"

Read the full file on GitHub · 466 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 466 lines · 115 tokens per session scan A 14d6f127b045

Subscribe to this mod's changes

circuit-breaker-pattern is a skill published in the GitHub repository pjt222/agent-almanac (42 stars, last pushed 5d ago), licensed MIT. It adds 115 tokens to every session and 5,182 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

audit-pr

Audit a whole PR against the delivery contract and return MERGE-READY or evidenced blockers with the full URL. Consumes the current review-change REVIEW-PASS receipt instead of re-running review axes; posts a SHA-bound ready comment; never edits or merges. Triggers: "audit-pr", "is this PR ready", "merge gate".

gtrabanco/agentic-workflow · 71 tokens

execute-phase

Step executor for units whose triage (unit-lane) decided which steps the unit needs. Implements one triaged step (or all remaining steps), with frozen acceptance, step-local gates, commits, red-gate repair, and diff-size guard. BREAKING: replaced PLAN.md/TASKS.md/progress.md/ACCEPTANCE.md with the unit doc's Tasks…

gtrabanco/agentic-workflow · 106 tokens

fold-findings

Repair persisted fix-now findings in compatible atomic batches: root-cause fixes, green gate, commit/push, and per-row folded: yes updates. Never reclassify or substitute backlog notes. Triggers: "fold-findings", "fix the review findings", "repair audit blockers".

gtrabanco/agentic-workflow · 65 tokens

init-workspace

Adapt the workflow scaffold to a new repository or add only missing substrate blocks to an existing install. Every install, hook, and overwrite needs explicit consent. Triggers: "init-workspace", "set up agentic workflow", "upgrade workflow scaffold".

gtrabanco/agentic-workflow · 54 tokens

product-audit

Audit the whole product across code, quality, process, docs, roadmap, and tooling; it owns the repo-wide bug hunt, security research, and broken-version investigation (scoped and budgeted per dimension, as distinct from review-change's change-scoped review). Persist one severity-ranked, F-numbered report with…

gtrabanco/agentic-workflow · 107 tokens

review-change

Review a change with only applicable internal axes, classify every finding, persist fix-now work, and return one evidence-backed decision. Findings only; --adversarial N uses isolated reviewers; --synthesize fuses supplied reviewer tables. Triggers: "review-change", "review this change", "adversarial review".

gtrabanco/agentic-workflow · 67 tokens