dev-error-handling

dev-error-handling is a skill for Claude Code from joaoguirunas/team-os. It costs 52 tokens per session (2,333 once invoked), scanned A, original, MIT.

A guide to handling failures in complex software with retries, circuit breakers, time limits, error boundaries, and structured logs.

In plain words
What is it for?
It is for designing recovery behavior, limiting repeated failures, setting timeouts, catching interface errors, and recording useful diagnostic details.
Why use it?
It helps applications respond predictably when services are slow, unavailable, or returning errors.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit It is for designing recovery behavior, limiting repeated failures, setting timeouts, catching interface errors, and recording useful diagnostic details.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/joaoguirunas/team-os/dev-error-handling
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 joaoguirunas/team-os --skill dev-error-handling
Clone the repo
git clone --depth 1 https://github.com/joaoguirunas/team-os

Made for: Claude Code.

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 dev-error-handling

README.md
[![agentmods](https://agentmods.dev/badge/skills/joaoguirunas/team-os/dev-error-handling/github.svg)](https://agentmods.dev/skills/joaoguirunas/team-os/dev-error-handling)
Your own site
<a href="https://agentmods.dev/skills/joaoguirunas/team-os/dev-error-handling"><img src="https://agentmods.dev/badge/skills/joaoguirunas/team-os/dev-error-handling/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 dev-error-handling

Your own site · 80×15
<a href="https://agentmods.dev/skills/joaoguirunas/team-os/dev-error-handling"><img src="https://agentmods.dev/badge/skills/joaoguirunas/team-os/dev-error-handling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,333 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.
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.00052 $0.02333
Opus 5.5 $0.00021 $0.00933
Sonnet 5.5 $0.00010 $0.00467
Haiku 4.5 $0.00005 $0.00233

Measured 2d ago against content hash 36bfeadc119d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

dev-error-handling 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 2d 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.

.claude/skills/dev-error-handling/SKILL.md · 267 lines

How it starts

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

Error Handling & Resilience — Software Complexo

Princípio fundamental

Falha é inevitável. Design para falha, não apenas para sucesso.

Todo código que interage com: banco de dados, APIs externas, filesystem, serviços de terceiros — deve ter error handling explícito.

Retry com Exponential Backoff

async function withRetry<T>(
  fn: () => Promise<T>,
  options: { maxAttempts?: number; baseDelay?: number } = {}
): Promise<T> {
  const { maxAttempts = 3, baseDelay = 300 } = options

  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
    try {
      return await fn()
    } catch (error) {
      if (attempt === maxAttempts) throw error
      // Não fazer retry em erros 4xx (erro do cliente, não transitório)
      if (error.status >= 400 && error.status < 500) throw error

      const delay = baseDelay * Math.pow(2, attempt - 1)  // 300ms, 600ms, 1200ms
      const jitter = Math.random() * 100
      await sleep(delay + jitter)
    }
  }
}

// Uso
const user = await withRetry(() => externalApi.getUser(id), { maxAttempts: 3 })

Timeout Explícito

async function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {
  const timeout = new Promise<never>((_, reject) =>
    setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms)
  )
  return Promise.race([promise, timeout])
}

// Uso — nunca deixar chamada externa sem timeout
const result = await withTimeout(
  externalApi.processPayment(data),
  5000  // 5 segundos máximo
)

Circuit Breaker

Evita cascata de falhas — para de tentar quando serviço está claramente down.

class CircuitBreaker {
  private failures = 0
  private lastFailure?: Date
  private state: 'CLOSED' | 'OPEN' | 'HALF_OPEN' = 'CLOSED'

  constructor(
    private readonly threshold = 5,     // abrir após 5 falhas
    private readonly timeout = 60000    // tentar novamente após 60s
  ) {}

  async execute<T>(fn: () => Promise<T>): Promise<T> {
    if (this.state === 'OPEN') {
      const elapsed = Date.now() - this.lastFailure!.getTime()
      if (elapsed < this.timeout) {
        throw new Error('Circuit breaker is OPEN — service unavailable')
      }
      this.state = 'HALF_OPEN'
    }

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

  private onSuccess() { this.failures = 0; this.state = 'CLOSED' }
  private onFailure() {
    this.failures++
    this.lastFailure = new Date()
    if (this.failures >= this.threshold) this.state = 'OPEN'
  }
}

Read the full file on GitHub · 267 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. 2d ago Changed · +34 lines · +19 tokens per session 36bfeadc119d
  2. 27d ago Changed 1483e52a64dc
  3. 1mo ago First seen · 233 lines · 33 tokens per session scan A b44b8ecb83eb

Subscribe to this mod's changes

dev-error-handling is a skill published in the GitHub repository joaoguirunas/team-os (5 stars, last pushed 3d ago), licensed MIT. It adds 52 tokens to every session and 2,333 once invoked, about $0.0002 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

api-analyzer

Validates whether an API request is correct based on provided inputs (method, URL, headers, body, auth, query params).

lingxling/awesome-skills-cn · 30 tokens

api-integration-architect

Design, implement, debug, and optimize API integrations with expert-level patterns for REST, GraphQL, webhooks, and authentication flows.

lingxling/awesome-skills-cn · 33 tokens

ast-grep

Searches and rewrites code by AST shape across 25 languages. Use when the target is a syntax pattern (every call/class/import shaped like X, a codemod, a YAML rule) rather than literal text; for plain strings, comments, or filenames, use rg.

code-yeongyu/oh-my-openagent · 61 tokens

lcx-doctor

Diagnose LazyCodex and Codex CLI installation health against the latest sources. Use whenever the user asks for a doctor or health check, says LazyCodex, lazycodex-ai, omo-codex, or Codex behaves oddly after an install, update, or config change, suspects a stale, drifted, or broken setup, or wants the local install…

code-yeongyu/oh-my-openagent · 93 tokens

lcx-report-bug

Create a high-signal bug issue or PR in the repo that owns the defect. Use this whenever the user asks to report, file, open, or triage a LazyCodex, lazycodex-ai, omo-codex, Codex plugin, or upstream Codex CLI bug, especially when they need source-backed root cause, reproduction steps, fix guidance, and GitHub routing.

code-yeongyu/oh-my-openagent · 85 tokens

tidewave-integration

Tidewave MCP runtime tools — debugging, smoke testing, live state inspection, SQL queries, hex docs. Use when evaluating code in a running Phoenix app.

oliver-kriska/claude-elixir-phoenix · 38 tokens