loom-error-handling

loom-error-handling is a skill for Claude Code, Codex from cosmix/loom. It costs 29 tokens per session (3,656 once invoked), scanned A, original, MIT.

An error-handling guide covers how software should classify, report, retry, recover from, or deliberately expose failures across languages and systems. It includes Rust's Result and Option types, API errors, and data-pipeline failures.

In plain words
What is it for?
Use it to design error types and responses, choose retry and fallback behavior, add circuit breakers, and handle failures securely.
Why use it?
It helps prevent swallowed errors, unsafe retries, lost causes, leaked internal details, and duplicated logging.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to design error types and responses, choose retry and fallback behavior, add circuit breakers, and handle failures securely.

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

Made for: Claude Code, Codex.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/cosmix/loom/loom-error-handling"><img src="https://agentmods.dev/badge/skills/cosmix/loom/loom-error-handling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,656 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 Output Handling · line 233
    Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.
    Fix: Set explicit limits on output length, generation count, and rate. Use max_tokens and truncation to prevent unbounded output.
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.00029 $0.03656
Opus 5.5 $0.00012 $0.01462
Sonnet 5.5 $0.00006 $0.00731
Haiku 4.5 $0.00003 $0.00366

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

Security

Grade A, and why

loom-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 2mo 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.

skills/loom-error-handling/SKILL.md · 278 lines

How it starts

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

Error Handling

Overview

Cross-language error-handling reference. The recurring mistakes are not syntactic: swallowing errors, retrying non-idempotent operations, losing the cause chain when wrapping, leaking internals in API responses, and log-and-rethrow double logging. This skill leads with the decision rules an expert applies, then shows the minimum code to implement each.

Agent Delegation

  • loom-senior-software-engineer (Opus) — DEFAULT. Error architecture, strategy choice, secure handling (no info leak), infra resilience (retry/circuit breaker/fallback).
  • loom-software-engineer (Sonnet) — ONLY boilerplate error types / unit tests following an established pattern.

Error Taxonomy — Classify First

Every failure is exactly one of three kinds; the kind dictates handling:

Kind Meaning Handle by
Expected / recoverable Invalid input, not-found, transient network/rate-limit Return a typed error (Result/checked exception); retry only if transient AND idempotent
Bug / programmer error Broken invariant, unreachable state, index OOB Fail loud: panic!/assert/throw. Do NOT try to recover — it hides the bug
Fatal / environmental OOM, disk full, config missing at startup Fail fast at the boundary; crash cleanly, let the supervisor restart

⚠ Do not model expected failures as panics/exceptions-for-control-flow, and do not swallow bugs into a recoverable path. Rust encodes this split directly: Result = recoverable, panic! = bug. In exception languages, keep the split by convention: validation → typed exception you catch; invariant break → let it propagate/crash.

Rust: Result/Option & the anyhow-vs-thiserror Rule

Decision rule:

  • thiserror → libraries and any code whose caller must match on and react to specific error variants. Gives typed, exhaustive enums with #[from] conversions.
  • anyhow (or eyre) → application/binary top layers where you only need to propagate, add context, and report. One anyhow::Error type, cheap .context(), backtraces.
  • Mixed is normal: libs export thiserror enums; main/handlers use anyhow and add context as errors bubble up.

Read the full file on GitHub · 278 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. 2mo ago Changed · -1 lines 74e01f14cfa4
  2. 2mo ago Changed · -30 tokens per session 891838c1e266
  3. 3mo ago First seen · 279 lines · 59 tokens per session scan A 577117f2fbf7

Subscribe to this mod's changes

loom-error-handling is a skill published in the GitHub repository cosmix/loom (66 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 3,656 once invoked, about $0.0001 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-08-30.

Related

loom-error-handling compared with skills from other repositories

loom-error-handling next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
loom-error-handlingcosmix/loomSkill66yesterdayMITA29Claude Code, Codex
API Discoverability for Agentsniels-emmer/myaceSkill1yesterdayMITA51Claude Code, Codex
durable-objectscloudflare/skillsSkill3.5k5d agoApache-2.0A22Claude Code
sandbox-nextcloudflare/skillsSkill3.5k5d agoApache-2.0A39Claude Code
cloudflarecloudflare/skillsSkill3.5k5d agoApache-2.0A103Claude Code
cloudflare-email-servicecloudflare/skillsSkill3.5k5d agoApache-2.0A21Claude Code
workers-best-practicescloudflare/skillsSkill3.5k5d agoApache-2.0A25Claude Code