Skip to content
Back to skills

Fault Tolerance

ASecurity

```typescript async function withRetry<T>( fn: () => Promise<T>, options: { attempts: number; delay: number } = { attempts: 3, delay: 1000 } ): Promise<T> { for (let i = 0; i < options.attempts; i++) { try { return await fn() } catch (err) { if (i === options.attempts - 1) throw err await new Promise(r => setTimeout(r, options.delay * Math.pow(2, i))) } } throw new Error('Unreachable') } ``` ```typescript class CircuitBreaker { pr

  • 21 stars
  • 0 votes
  • 0 copies
  • 8 views
  • Added September 7, 2026
developmenttypescript

Security analysis

A100/100

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill fault-tolerance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Fault Tolerance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Fault Tolerance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-fault-tolerance/badge)](https://www.skillsdirectory.com/skills/modbender-fault-tolerance)

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

Download with Pro
SKILL.md
# Fault Tolerance & Resilience

## Retry Strategies

```typescript
async function withRetry<T>(
  fn: () => Promise<T>,
  options: { attempts: number; delay: number } = { attempts: 3, delay: 1000 }
): Promise<T> {
  for (let i = 0; i < options.attempts; i++) {
    try {
      return await fn()
    } catch (err) {
      if (i === options.attempts - 1) throw err
      await new Promise(r => setTimeout(r, options.delay * Math.pow(2, i)))
    }
  }
  throw new Error('Unreachable')
}
```

## Circuit Breaker

```typescript
class CircuitBreaker {
  private failures = 0
  private state: 'closed' | 'open' | 'half-open' = 'closed'
  
  async call<T>(fn: () => Promise<T>): Promise<T> {
    if (this.state === 'open') {
      throw new Error('Circuit open')
    }
    
    try {
      const result = await fn()
      this.failures = 0
      this.state = 'closed'
      return result
    } catch (err) {
      this.failures++
      if (this.failures >= 5) {
        this.state = 'open'
        setTimeout(() => this.state = 'half-open', 30000)
      }
      throw err
    }
  }
}
```

## Timeout Management

```typescript
// Request timeout
app.use((req, res, next) => {
  res.setTimeout(30000, () => {
    res.status(503).json({ error: 'Request timeout' })
  })
  next()
})
```

## Checklist

- [ ] Implement retry with exponential backoff
- [ ] Add circuit breaker
- [ ] Set proper timeouts
- [ ] Handle graceful degradation
- [ ] Set up dead-letter queues

Attribution

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

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.