Skip to main content
skill CX Codex

reliability-strategy-builder — Claude Code skill

reliability-strategy-builder builds a failure-handling plan for a service: circuit breaker, retries with backoff, fallback, bulkhead isolation and SLOs with error budgets.

MIT 273 installs ★ 64 updated 2026-01-12

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add patricio0312rev/skills --skill reliability-strategy-builder -a claude-code
Open on GitHub

What reliability-strategy-builder does

Reliability Strategy Builder hands the agent a set of failure-handling patterns to work from: a circuit breaker that moves between closed, open and half-open, retry with exponential backoff, fallback to cache or a trimmed response, and bulkhead pools that stop background work from eating capacity reserved for critical calls. The samples are TypeScript classes and functions, so an agent can adapt them into a Node service.

The skill also covers the measurement side. It ships a YAML SLO template for availability, latency and error rate, the error budget formula (100% minus the SLO), a failure mode table listing impact, likelihood, detection and mitigation, plus checklists for infrastructure, application, monitoring and operations.

Incident response is spelled out too: four severity levels from SEV1 to SEV4 with target response times, and six steps from acknowledging the alert to writing the postmortem. Because every code block is TypeScript, a Go or Python codebase means rewriting the samples by hand. The 5-failure threshold and one-minute reset window come from the example, not from a rule you should copy.

What it helps with

  • wrap calls to a flaky third-party API in a circuit breaker
  • add backoff retries around transient errors
  • define SLOs and work out the error budget
  • map component failure modes into a mitigation table
  • sort incidents into SEV1–SEV4 with response targets

Example prompts for the agent

  • Add circuit breaker and fallback handling to our payment gateway client
  • Draft SLOs for user-api: availability, p95 latency and error budget over 30 days
  • Build an incident response plan with SEV1–SEV4 levels and a postmortem step

How to install reliability-strategy-builder

1Skills CLI (Vercel)

npx skills add patricio0312rev/skills --skill reliability-strategy-builder -a claude-code

2Manually: put the files in place

~/.claude/skills/reliability-strategy-builder/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/reliability-strategy-builder/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about reliability-strategy-builder

How do I install reliability-strategy-builder in Claude Code?

Run npx skills add patricio0312rev/skills --skill reliability-strategy-builder -a claude-code. The skill lands at ~/.claude/skills/reliability-strategy-builder/SKILL.md.

What does reliability-strategy-builder do?

It gives the agent patterns and templates for resilient services: circuit breakers, backoff retries, fallbacks, bulkheads, SLOs, failure mode analysis and incident response.

Which language are the code samples in?

TypeScript throughout, including the circuit breaker class and the semaphore pools. Other stacks need the templates ported.

Source text

SKILL.md · MIT
---
name: reliability-strategy-builder
description: Implements reliability patterns including circuit breakers, retries, fallbacks, bulkheads, and SLO definitions. Provides failure mode analysis and incident response plans. Use for "SRE", "reliability", "resilience", or "failure handling".
---

# Reliability Strategy Builder

Build resilient systems with proper failure handling and SLOs.

## Reliability Patterns

### 1. Circuit Breaker

Prevent cascading failures by stopping requests to failing services.

```typescript
class CircuitBreaker {
  private state: "closed" | "open" | "half-open" = "closed";
  private failureCount = 0;
  private lastFailureTime?: Date;

  async execute<T>(operation: () => Promise<T>): Promise<T> {
    if (this.state === "open") {
      if (this.shouldAttemptReset()) {
        this.state = "half-open";
      } else {
        throw new Error("Circuit breaker is OPEN");
      }
    }

    try {
      const result = await operation();
      this.onSuccess();
      return result;
    } catch (error) {
      this.onFailure();
      throw error;
    }
  }

  private onSuccess() {
    this.failureCount = 0;
    this.state = "closed";
  }

  private onFailure() {
    this.failureCount++;
    this.lastFailureTime = new Date();

    if (this.failureCount >= 5) {
      this.state = "open";
    }
  }

  private shouldAttemptReset(): boolean {
    if (!this.lastFailureTime) return false;
    const now = Date.now();
    const elapsed = now - this.lastFailureTime.getTime();
    return elapsed > 60000; // 1 minute
  }
}
```

### 2. Retry with Backoff

Handle transient failures with exponential backoff.

```typescript
async function retryWithBackoff<T>(
  operation: () => Promise<T>,
  maxRetries = 3,
  baseDelay = 1000
): Promise<T> {
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
    try {
      return await operation();
    } catch (error) {
      if (attempt === maxRetries) throw error;

      // Exponential backoff: 1s, 2s, 4s
      const delay = baseDelay * Math.pow(2, attempt);
      await sleep(delay);
    }
  }
  throw new Error("Max retries exceeded");
}
```

### 3. Fallback Pattern

Provide degraded functionality when primary fails.

```typescript
async function getUserWithFallback(userId: string): Promise<User> {
  try {
    // Try primary database
    return await primaryDb.users.findById(userId);
  } catch (error) {
    logger.warn("Primary DB failed, using cache");

    // Fallback to cache
    const cached = await cache.get(`user:${userId}`);
    if (cached) return cached;

    // Final fallback: return minimal user object
    return {
      id: userId,
      name: "Unknown User",
      email: "unavailable",
    };
  }
}
```

### 4. Bulkhead Pattern

Isolate failures to prevent resource exhaustion.

```typescript
class ThreadPool {
  private pools = new Map<string, Semaphore>();

  constructor() {
    // Separate pools for different operations
    this.pools.set("critical", new Semaphore(100));
    this.pools.set("standard", new Semaphore(50));
    this.pools.set("background", new Semaphore(10));
  }

  async execute(priority: string, operation: () => Promise<any>) {
    const pool = this.pools.get(priority);
    await pool.acquire();

    try {
      return await operation();
    } finally {
      pool.release();
    }
  }
}
```

## SLO Definitions

### SLO Template

```yaml
service: user-api
slos:
  - name: Availability
    description: API should be available for successful requests
    target: 99.9%
    measurement:
      type: ratio
      success: status_code < 500
      total: all_requests
    window: 30 days

  - name: Latency
    description: 95% of requests complete within 500ms
    target: 95%
    measurement:
      type: percentile
      metric: request_duration_ms
      threshold: 500
      percentile: 95
    window: 7 days

  - name: Error Rate
    description: Less than 1% of requests result in errors
    target: 99%
    measurement:
      type: ratio
      success: status_code < 400 OR status_code IN [401, 403, 404]
      total: all_requests
    window: 24 hours
```

### Error Budget

```
Error Budget = 100% - SLO

Example:
SLO: 99.9% availability
Error Budget: 0.1% = 43.2 minutes/month downtime allowed
```

## Failure Mode Analysis

```markdown
| Component   | Failure Mode | Impact | Probability | Detection               | Mitigation                     |
| ----------- | ------------ | ------ | ----------- | ----------------------- | ------------------------------ |
| Database    | Unresponsive | HIGH   | Medium      | Health checks every 10s | Circuit breaker, read replicas |
| API Gateway | Overload     | HIGH   | Low         | Request queue depth     | Rate limiting, auto-scaling    |
| Cache       | Eviction     | MEDIUM | High        | Cache hit rate          | Fallback to DB, larger cache   |
| Queue       | Backed up    | LOW    | Medium      | Queue depth metric      | Add workers, DLQ               |
```

## Reliability Checklist

### Infrastructure

- [ ] Load balancer with health checks
- [ ] Multiple availability zones
- [ ] Auto-scaling configured
- [ ] Database replication
- [ ] Regular backups (tested!)

### Application

- [ ] Circuit breakers on external calls
- [ ] Retry logic with backoff
- [ ] Timeouts on all I/O
- [ ] Fallback mechanisms
- [ ] Graceful degradation

### Monitoring

- [ ] SLO dashboard
- [ ] Error budgets tracked
- [ ] Alerting on SLO violations
- [ ] Latency percentiles (p50, p95, p99)
- [ ] Dependency health checks

### Operations

- [ ] Incident response runbook
- [ ] On-call rotation
- [ ] Postmortem template
- [ ] Disaster recovery plan
- [ ] Chaos engineering tests

## Incident Response Plan

### Severity Levels

```
SEV1 (Critical): Complete service outage, data loss
  - Response time: <15 minutes
  - Page on-call immediately

SEV2 (High): Partial outage, degraded performance
  - Response time: <1 hour
  - Alert on-call

SEV3 (Medium): Minor issues, workarounds available
  - Response time: <4 hours
  - Create ticket

SEV4 (Low): Cosmetic issues, no user impact
  - Response time: Next business day
  - Backlog
```

### Incident Response Steps

1. **Acknowledge**: Confirm receipt within SLA
2. **Assess**: Determine severity and impact
3. **Communicate**: Update status page
4. **Mitigate**: Stop the bleeding (rollback, scale, disable)
5. **Resolve**: Fix root cause
6. **Document**: Write postmortem

## Best Practices

1. **Design for failure**: Assume components will fail
2. **Fail fast**: Don't let slow failures cascade
3. **Isolate failures**: Bulkhead pattern
4. **Graceful degradation**: Reduce functionality, don't crash
5. **Monitor SLOs**: Track error budgets
6. **Test failure modes**: Chaos engineering
7. **Document runbooks**: Clear incident response

## Output Checklist

- [ ] Circuit breakers implemented
- [ ] Retry logic with backoff
- [ ] Fallback mechanisms
- [ ] Bulkhead isolation
- [ ] SLOs defined (availability, latency, errors)
- [ ] Error budgets calculated
- [ ] Failure mode analysis
- [ ] Monitoring dashboard
- [ ] Incident response plan
- [ ] Runbooks documented

© patricio0312rev · MIT · patricio0312rev/skills

Similar skills

All skills for DevOps and infrastructure →

From the same set148

The whole set →
rbac-policy-tester rbac-policy-tester generates role permission matrices and automated authorization test suites to catch RBAC regressions in CI. CX Codex +1 274installs etl-sync-job-builder etl-sync-job-builder generates TypeScript ETL pipelines with incremental watermark tracking, idempotent batch upserts, and retry backoff logic. CX Codex +1 274installs structured-logging-standardizer structured-logging-standardizer sets up structured JSON logging with request correlation IDs using AsyncLocalStorage and pino. Keeps backend logs queryable and connected. CX Codex +1 273installs data-retention-archiving-planner data-retention-archiving-planner plans data retention policies, maps compliance requirements, and automates cold storage migration for databases. CX Codex +1 273installs e2e-test-builder e2e-test-builder generates end-to-end browser tests for Playwright and Cypress using Page Object patterns, test fixtures, and semantic selectors. CX Codex +1 273installs caching-strategy-optimizer The caching-strategy-optimizer skill configures CI/CD caching for dependencies, Docker layers, build outputs, and test results. Use it when installs, builds, or tests slow down the pipeline. CX Codex +1 272installs component-scaffold-generator component-scaffold-generator builds the skeleton of a React or Vue component: typed props, variants, a test file, a Storybook story and JSDoc with an example. It asks for a name and props, then writes the files. CX Codex +1 272installs git-hygiene-enforcer git-hygiene-enforcer is a Claude Code skill for setting commit and branch conventions, preparing PR templates, and documenting review steps for a consistent Git workflow. CX Codex +1 271installs

Project sponsors

Companies that keep this analytics open