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.
npx agentmods add skills/cosmix/loom/loom-error-handlingnpx skills add cosmix/loom --skill loom-error-handlinggit clone --depth 1 https://github.com/cosmix/loomWrote 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.
[](https://agentmods.dev/skills/cosmix/loom/loom-error-handling)<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="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00029 | $0.03660 |
| Opus 5 | $0.00015 | $0.01830 |
| Sonnet 5 | $0.00006 | $0.00732 |
| Haiku 4.5 | $0.00003 | $0.00366 |
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 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.
How it starts
The opening of the file, as written. The whole thing — 279 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(oreyre) → application/binary top layers where you only need to propagate, add context, and report. Oneanyhow::Errortype, cheap.context(), backtraces.- Mixed is normal: libs export
thiserrorenums;main/handlers useanyhowand add context as errors bubble up.
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.
- 2d ago Changed · -30 tokens per session 891838c1e266
- 6d ago First seen · 279 lines · 59 tokens per session scan A 577117f2fbf7
loom-error-handling is a skill published in the GitHub repository cosmix/loom (54 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 3,660 once invoked, about $0.0001 per session on Opus 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.
Other skills, from other repositories
workers-best-practices
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from…
find-journalists
Build, refine, dedupe, and enrich small fit-checked journalist lists for newsjack campaigns. Uses the newsjack CLI (preferred) or the medialyst MCP for news search and journalist enrichment, and falls back to a best-effort local mode with no verified contacts; the agent owns how returned data is organized.
story-origin-check
Recover the first public timestamp and canonical major coverage for a newsjacking signal, then decide whether newer coverage is the same story, a different story, or a materially new development.
relevance-coarse-filter
Cheap, high-recall first-pass filter that removes obvious junk from a detector candidate pool before expensive story-origin research and PR judgment. Decides keep, monitoronly, or reject — never ranks, writes angles, verifies dates, or decides whether to pitch.
annotating-task-lineage
Annotate Airflow tasks with data lineage using inlets and outlets. Use when the user wants to add lineage metadata to tasks, specify input/output datasets, or enable lineage tracking for operators without built-in OpenLineage extraction.
ai-visibility-writing
Audit, question, suggest, or fact-preservingly revise a press release, blog post, contributed article, or expert explainer so AI answer systems can more easily retrieve, understand, quote, and cite its useful information. Use when someone asks for AI visibility, AI search, answer-engine, AEO, GEO, AI Overview, or…