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 lugassawan/swe-workbench --skill principle-error-handlinggit clone --depth 1 https://github.com/lugassawan/swe-workbenchWrote 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/lugassawan/swe-workbench/principle-error-handling)<a href="https://agentmods.dev/skills/lugassawan/swe-workbench/principle-error-handling"><img src="https://agentmods.dev/badge/skills/lugassawan/swe-workbench/principle-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.00074 | $0.01515 |
| Opus 5 | $0.00037 | $0.00758 |
| Sonnet 5 | $0.00015 | $0.00303 |
| Haiku 4.5 | $0.00007 | $0.00152 |
Grade A, and why
principle-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 4d 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 — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Error Handling
Errors are part of the contract. Handling them is not defensive programming — it is the design.
Errors as Values vs Exceptions
Use the language's native error style; don't fight it.
- Go
errorvalues, RustResult<T, E>, TypeScript typed unions: errors are explicit return paths, visible in signatures, handled by callers. - Exceptions (Java, Python, C#) work best for truly unexpected conditions — programmer errors, not business failures.
- Reserve
panic/throw/ unchecked exceptions for unrecoverable programmer errors. Expected failures (network timeout, not found) must be value-level errors.
Classify Before Handling
Not all errors deserve the same response.
- Transient — network blip, timeout, lock contention: retry with backoff (fail soft — degrade gracefully while recovering).
- Permanent — bad input, not found, permission denied: fail fast — surface immediately to the caller, never retry.
- Programmer — nil deref, index out of bounds, invariant violated: panic/crash, fix the code.
- Misclassifying a permanent error as transient wastes retry budget and delays the caller.
Wrap, Don't Swallow
At each layer boundary, add context to the error and preserve the original cause for downstream inspection.
- Go:
fmt.Errorf("loading user config: %w", err)—%wpreserveserrors.Is/errors.Astraversal. - Rust:
anyhow::Context/.with_context(|| ...)— attach human-readable context without losing the source. - TypeScript: native
Errorsupports acauseoption —new Error("fetch failed", { cause: err }). - Never discard the original error (
return errors.New("failed")with no wrapping). The original context is lost forever.
Sentinel vs Typed vs Coded Errors
Three models; choose based on callsite needs.
Sentinel errors (Go io.EOF, Rust ErrorKind::NotFound)
- Use when: callers need to branch on a single known condition without importing a type.
- Costs: error set is open; callers do string-equal or
errors.Isidentity checks; hard to carry payload. - Don't use when: the error needs structured data (retry-after, field name, status code).
What ships with it
28 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- examples/config.cs.md 3.6 KB
- examples/config.go.md 2.7 KB
- examples/config.java.md 4.3 KB
- examples/config.kt.md 3.2 KB
- examples/config.py.md 2.9 KB
- examples/config.rb.md 2.5 KB
- examples/config.rs.md 3.3 KB
- examples/config.swift.md 3.0 KB
- examples/config.ts.md 3.0 KB
- examples/fetch.cs.md 3.4 KB
- examples/fetch.go.md 3.3 KB
- examples/fetch.java.md 3.6 KB
- examples/fetch.kt.md 3.4 KB
- examples/fetch.py.md 3.4 KB
- examples/fetch.rb.md 2.8 KB
- examples/fetch.rs.md 3.7 KB
- examples/fetch.swift.md 3.1 KB
- examples/fetch.ts.md 3.5 KB
- examples/withdraw.cs.md 2.8 KB
- examples/withdraw.go.md 2.7 KB
- examples/withdraw.java.md 3.3 KB
- examples/withdraw.kt.md 2.7 KB
- examples/withdraw.py.md 2.8 KB
- examples/withdraw.rb.md 2.5 KB
- examples/withdraw.rs.md 3.3 KB
- examples/withdraw.swift.md 2.9 KB
- examples/withdraw.ts.md 2.7 KB
- triggers.txt 538 B
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.
- 4d ago First seen · 104 lines · 74 tokens per session scan A efcc8b3262e2
principle-error-handling is a skill published in the GitHub repository lugassawan/swe-workbench (2 stars, last pushed 2d ago), licensed MIT. It adds 74 tokens to every session and 1,515 once invoked, about $0.0004 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-09-03.
Other skills, from other repositories
printing-press-amend
Amend a published CLI from one of two input sources: (1) dogfood mode mines the active Claude Code session transcript for friction (missing flags, hand- rolled API payloads, silent-null returns); (2) direct-input mode accepts user-supplied asks (rename a command, add commands or feeds, fix a named bug, optionally…
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.
perf
Analyze Elixir/Phoenix performance — N+1 queries, assign bloat, ecto optimization, genserver bottlenecks. Use when slowness, timeouts, or high memory reported.
api-error-handling
Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building production APIs, implementing error recovery patterns, or integrating error monitoring services.
bug-fix
Investigate, reproduce, and safely fix a bug with regression protection. Composes context, diagnosis, architecture, code quality, and testing guardrails into a reproduce-first repair workflow. Use when the user says 'fix this bug', 'debug this', 'investigate this failure', 'patch this regression', 'repair this issue'…
code-forge
Generate implementation code from an approved design blueprint or verbal requirements. Composes context anchoring, architecture, clean code, DDD, security, and test quality into an inside-out implementation workflow. Use when moving from design to code, implementing approved contracts, or when the user says…