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 skills add tmj-90/gaffer --skill error-handlinggit clone --depth 1 https://github.com/tmj-90/gafferWrote 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/tmj-90/gaffer/error-handling)<a href="https://agentmods.dev/skills/tmj-90/gaffer/error-handling"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/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.
<a href="https://agentmods.dev/skills/tmj-90/gaffer/error-handling"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/error-handling.svg" alt="Reviewed on agentmods" width="80" 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.00084 | $0.01344 |
| Opus 5.5 | $0.00034 | $0.00538 |
| Sonnet 5.5 | $0.00017 | $0.00269 |
| Haiku 4.5 | $0.00008 | $0.00134 |
Grade A, and why
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.
How it starts
The opening of the file, as written. The whole thing — 86 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Handle errors so failures are visible and recoverable
Every error is a decision: recover, translate, or propagate. An empty catch makes that decision silently and wrongly. Design the error path with the happy path: typed errors with stable codes, context added on the way up with the cause preserved, and one place at the top that logs and decides what the caller sees.
Steps
- Map the failure modes. For the code the ticket touches, list what can fail:
invalid input, not found, conflict, permission, dependency down, timeout, and bugs.
For each, decide who must know (caller, user, operator) and whether anything can be
done. Call
search_lorefor the repo's error base class or result type and the API error envelope. - Use the repo's error shape. A typed error hierarchy or result type carrying a
stable machine code (
NOT_FOUND,CONFLICT) separate from the human message. Never throw strings. Use return values for expected outcomes where the language favours them (Goerror, RustResult) and exceptions for exceptional ones elsewhere. - Fail fast at boundaries. Validate input where it enters (the
security-input-validationskill) and reject with the documented code before any side effect. Inside the boundary, trust your own types. - Wrap with context, keep the cause. Add what the caller needs (which record, which
operation) and preserve the original:
- JavaScript/TypeScript:
new AppError(msg, { cause: err }); neverthrow "msg". - Python:
raise AppError(msg) from err;add_note()for context. - Go:
fmt.Errorf("load order %s: %w", id, err); test witherrors.Is/errors.As; never compare error strings. - Rust:
?withthiserrortypes in libraries,anyhow::Contextin binaries; nounwrap()on fallible runtime paths. - Java/Kotlin: pass the cause to the constructor; C#:
throw;to rethrow, neverthrow ex;(it resets the stack trace).
- JavaScript/TypeScript:
- Recover only where recovery is real. Retry only transient failures of idempotent
operations, with backoff, jitter and a cap (the
idempotency-and-retriesskill). Fall back only when the degraded result is acceptable and is logged or counted. Otherwise propagate. An emptycatch,except: pass,except Exceptionthat continues, an ignorederr, or.catch(() => {})is a bug: handle it or delete it. Do not catch an error to hide a race or a bug (e.g. retrying on a temp-file collision instead of fixing it with theconcurrency-and-asyncskill). - Leave no half-applied state. Fail before the first side effect, or make the
sequence atomic (one transaction), or compensate explicitly. Release resources in
finally/defer/using/with. - Report once, at the top. The outermost handler (request middleware, job runner,
CLI
main) logs once with code, context, cause chain and correlation id through the structured logger (thestructured-logging-and-tracingskill); intermediate layers wrap, they do not log and rethrow. It maps typed errors to the external contract: for HTTP, the repo's envelope or RFC 9457 problem details (type,title,status,detail) with the right status (400/422 validation, 404, 409 conflict, 503 dependency unavailable, 500 only for bugs). Stack traces, SQL, file paths and secrets never reach a client. Install process-level handlers (unhandled rejection, uncaught exception, panic recovery at the goroutine or request boundary) that log and exit or fail the request, never continue in an unknown state. - Test the error paths as first-class cases, one test per AC exercising the AC's own behaviour: each failure mode asserts the error code or status, the body shape, that the cause is preserved (or logged), and that no partial write or side effect happened. Inject failures with fakes or fault hooks, not by editing production code.
- Evidence with the
record-evidenceskill.
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.
- 2mo ago Changed · +22 lines 14ec0e424e7f
- 2mo ago First seen · 64 lines · 84 tokens per session scan A 7a548e223d07
error-handling is a skill published in the GitHub repository tmj-90/gaffer (1 stars, last pushed yesterday), licensed Apache-2.0. It adds 84 tokens to every session and 1,344 once invoked, about $0.0003 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-28.
error-handling compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| error-handlingtmj-90/gaffer | Skill | 1 | yesterday | Apache-2.0 | A | 84 | Claude Code, Codex |
| issue-debuggingQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 39 | Claude Code |
| fix-bugQBall-Inc/the-bulwark | Skill | 9 | yesterday | MIT | A | 46 | Claude Code |
| pact-bugjonathanmr22/pact | Skill | 16 | 5mo ago | MIT | A | 11 | Claude Code |
| express-error-handlingVersoXBT/claude-initial-setup | Skill | 4 | 6mo ago | MIT | A | 84 | Claude Code |
| deep-debug-apianotherben/claude-harness | Skill | 7 | 4mo ago | none | A | 149 | Claude Code, Codex |
| api-health-checkernek1987/auto-agent-harness | Skill | 4 | 7mo ago | none | A | 64 | Claude Code |