Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Circuit Breaker

ASecurity

Agent hata toleransi ve devre kesici pattern. Ust uste hata yapan agent'i durdur, cooldown uygula, fallback'e gec. Kaskatli hatalari ve sonsuz retry dongularini onler.

530 stars
0 votes
0 copies
1 views
Added 5/29/2026
ai-agentstypescriptgobashcode-reviewapisecurity

Works with

api

Security Analysis

A100/100

Scanned 5/29/2026

$npx -y skills add vibeeval/vibecosystem --skill circuit-breaker --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Circuit Breaker?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Circuit Breaker
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vibeeval-circuit-breaker/badge)](https://www.skillsdirectory.com/skills/vibeeval-circuit-breaker)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: circuit-breaker
description: Agent hata toleransi ve devre kesici pattern. Ust uste hata yapan agent'i durdur, cooldown uygula, fallback'e gec. Kaskatli hatalari ve sonsuz retry dongularini onler.
---

# Circuit Breaker for Agents

Agent'lar da servisler gibi basarisiz olabilir. Ayni hatayi tekrar tekrar denemek token israf eder ve sorunu cozmez. Circuit breaker bunu onler.

## 3 Durum

```
CLOSED (Normal)
  Agent calisir, hatalar sayilir.
  Hata esigi asilirsa → OPEN'a gec.

OPEN (Devre Kesik)
  Agent CALISTIRILMAZ.
  Cooldown suresi boyunca bekle.
  Cooldown bitince → HALF-OPEN'a gec.

HALF-OPEN (Test)
  Tek bir istek gonder.
  Basarili → CLOSED'a don.
  Basarisiz → OPEN'a geri don (cooldown uzat).
```

```
     basarili          hata esigi
  ┌──────────┐      ┌───────────┐
  │          │      │           │
  ▼          │      ▼           │
CLOSED ──────┼── OPEN ────── HALF-OPEN
  ▲          │      │           │
  │          │      │           │
  └──────────┘      └───────────┘
     normal          cooldown bitti
```

## Konfigrasyon

```typescript
interface CircuitBreakerConfig {
  failureThreshold: number    // Kac hata sonrasi OPEN (default: 3)
  cooldownMs: number          // OPEN'da bekleme suresi (default: 60000 = 1 dk)
  halfOpenMaxAttempts: number // HALF-OPEN'da max deneme (default: 1)
  resetAfterMs: number        // Hata sayacini sifirla (default: 300000 = 5 dk)
  onOpen?: () => void         // OPEN'a gecince cagrilir
  onClose?: () => void        // CLOSED'a donunce cagrilir
}

const DEFAULT_CONFIG: CircuitBreakerConfig = {
  failureThreshold: 3,
  cooldownMs: 60000,
  halfOpenMaxAttempts: 1,
  resetAfterMs: 300000,
}
```

## Uygulama

### Agent Seviyesinde

```typescript
class AgentCircuitBreaker {
  private state: 'CLOSED' | 'OPEN' | 'HALF-OPEN' = 'CLOSED'
  private failures = 0
  private lastFailureTime = 0
  private config: CircuitBreakerConfig

  constructor(private agentName: string, config?: Partial<CircuitBreakerConfig>) {
    this.config = { ...DEFAULT_CONFIG, ...config }
  }

  canExecute(): boolean {
    if (this.state === 'CLOSED') return true

    if (this.state === 'OPEN') {
      const elapsed = Date.now() - this.lastFailureTime
      if (elapsed >= this.config.cooldownMs) {
        this.state = 'HALF-OPEN'
        return true
      }
      return false
    }

    // HALF-OPEN: tek denemeye izin ver
    return true
  }

  recordSuccess(): void {
    this.failures = 0
    if (this.state === 'HALF-OPEN') {
      this.state = 'CLOSED'
      this.config.onClose?.()
    }
  }

  recordFailure(): void {
    this.failures++
    this.lastFailureTime = Date.now()

    if (this.state === 'HALF-OPEN') {
      this.state = 'OPEN'
      return
    }

    if (this.failures >= this.config.failureThreshold) {
      this.state = 'OPEN'
      this.config.onOpen?.()
    }
  }

  getStatus(): { state: string; failures: number; agent: string } {
    return { state: this.state, failures: this.failures, agent: this.agentName }
  }
}
```

### Kullanim Ornegi

```typescript
const breakers: Record<string, AgentCircuitBreaker> = {
  'code-reviewer': new AgentCircuitBreaker('code-reviewer', { failureThreshold: 3 }),
  'security-reviewer': new AgentCircuitBreaker('security-reviewer', { failureThreshold: 2 }),
  'sleuth': new AgentCircuitBreaker('sleuth', { failureThreshold: 3 }),
}

async function spawnAgent(name: string, task: string): Promise<string> {
  const breaker = breakers[name]

  if (!breaker?.canExecute()) {
    console.warn(`Circuit OPEN: ${name} -- fallback kullaniliyor`)
    return executeFallback(name, task)
  }

  try {
    const result = await executeAgent(name, task)
    breaker.recordSuccess()
    return result
  } catch (error) {
    breaker.recordFailure()
    console.error(`${name} basarisiz (${breaker.getStatus().failures}/${3})`)

    if (!breaker.canExecute()) {
      return executeFallback(name, task)
    }
    throw error
  }
}
```

## Fallback Zinciri

Agent devre disiyken ne yapilacagi:

| Agent | Fallback 1 | Fallback 2 | Fallback 3 |
|-------|-----------|-----------|-----------|
| code-reviewer | Manuel Grep review | Basit lint calistir | Kullaniciya bildir |
| security-reviewer | Grep ile secret scan | SAST tool calistir | Kullaniciya bildir |
| sleuth | scout ile arastir | Manuel debug | Kullaniciya bildir |
| kraken | spark ile parcali fix | Manuel implement | Kullaniciya bildir |
| verifier | Manuel build + test | Sadece build kontrol | Kullaniciya bildir |
| architect | planner ile basit plan | Kullaniciya sor | - |
| build-error-resolver | Manuel hata oku + fix | Kullaniciya bildir | - |

## Hata Tipleri

Her hata ayni agirlikta degil:

| Hata Tipi | Sayac Etkisi | Ornek |
|-----------|:------------:|-------|
| API timeout | +1 | Anthropic API timeout |
| Rate limit | +0 (beklenir) | 429 Too Many Requests |
| Invalid output | +1 | Agent bos cikti verdi |
| Tool error | +0.5 | Bash komutu basarisiz |
| Logic error | +2 | Agent yanlis dosyayi duzenledi |
| Crash | +3 | Agent tamamen cokktu |

## Monitoring

### Status Dashboard

```bash
#!/bin/bash
# scripts/circuit-status.sh

echo "=== Agent Circuit Breaker Status ==="
echo ""
printf "%-25s %-10s %-10s\n" "Agent" "State" "Failures"
echo "-------------------------------------------"

# Canavar skill-matrix'ten oku
if [ -f ~/.claude/canavar/skill-matrix.json ]; then
  cat ~/.claude/canavar/skill-matrix.json | \
    jq -r '.agents | to_entries[] | "\(.key) \(.value.failures // 0) \(.value.state // "CLOSED")"' | \
    while read name failures state; do
      if [ "$state" = "OPEN" ]; then
        printf "%-25s \033[31m%-10s\033[0m %-10s\n" "$name" "$state" "$failures"
      elif [ "$state" = "HALF-OPEN" ]; then
        printf "%-25s \033[33m%-10s\033[0m %-10s\n" "$name" "$state" "$failures"
      else
        printf "%-25s \033[32m%-10s\033[0m %-10s\n" "$name" "CLOSED" "$failures"
      fi
    done
fi
```

### Alert Kurallari

```
WARN:  Agent 2+ ust uste basarisiz
ERROR: Circuit OPEN'a gecti
CRIT:  3+ agent ayni anda OPEN (sistemik sorun)
```

## Exponential Backoff

Tekrarlayan hatalarda cooldown suresini artir:

```
1. hata → 1 dakika cooldown
2. hata → 2 dakika cooldown
3. hata → 4 dakika cooldown
4. hata → 8 dakika cooldown
Max: 15 dakika

Basarili calisma → cooldown sifirla
```

## Anti-Pattern'ler

```
YAPMA: Her hatada agent'i hemen tekrar calistir
YAP:   Circuit breaker ile kontrol et

YAPMA: Hatalari sessizce yut
YAP:   Logla, say, esik kontrolu yap

YAPMA: Tek hata tipine gore devre kes
YAP:   Hata tipine gore agirlik ver

YAPMA: Sonsuz retry dongusu
YAP:   Max retry + exponential backoff + fallback

YAPMA: Tum agent'lar icin ayni esik
YAP:   Kritik agent'lar (security) icin dusuk esik
```

## vibecosystem Entegrasyonu

- **auto-skill-activation rule**: Agent fail oldugunda fallback zincirini kullanir
- **canavar**: Hata sayilarini skill-matrix.json'a kaydeder
- **reputation-engine**: Circuit breaker durumunu guvenilirlik skoruna yansitir
- **sentinel agent**: Circuit OPEN alert'lerini yonetir
- **self-learner agent**: Tekrarlayan hatalardan pattern ogrenir
- **qa-loop rule**: 3x fail sonrasi escalation zaten mevcut -- circuit breaker bunu destekler

Attribution

vibeevalvibeeval
View sourceSee grades on GitHubMore from vibeeval →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →