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 cass-2003/local-workflow-skill --skill error-handling-patternsgit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWrote 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/cass-2003/local-workflow-skill/error-handling-patterns)<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/error-handling-patterns"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/error-handling-patterns/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/cass-2003/local-workflow-skill/error-handling-patterns"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/error-handling-patterns.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.00113 | $0.03431 |
| Opus 5 | $0.00056 | $0.01716 |
| Sonnet 5 | $0.00023 | $0.00686 |
| Haiku 4.5 | $0.00011 | $0.00343 |
Grade A, and why
error-handling-patterns 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 7d 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 — 377 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Error Handling Patterns Skill — 错误处理跨语言
何时使用
- 设计公共库 / SDK 的错误 API
- 调试"日志写了但堆栈没了"/ "错误吞了没人知道"
- 跨服务调用错误传递(HTTP / gRPC)
- 决定何时 throw / 何时返回 error / 何时 panic
- 重试 / 熔断 / 降级策略
一、错误的两个维度
| 维度 | 取值 |
|---|---|
| 方向 | 上游传来 / 自家产生 / 下游返回 |
| 可恢复性 | 可重试(瞬时) / 不可重试(永久) / 灾难(停服) |
| 可重试 | 不可重试 | 灾难
--------------|---------------|----------------|----------
用户输入错 | - | 400/422 显示 | -
认证失败 | - | 401 引导登录 | -
权限不足 | - | 403 提示 | -
不存在 | - | 404 提示 | -
冲突 | (有时可) | 409 让用户改 | -
限流 | 重试退避 | - | -
依赖超时 | 重试 1-2 次 | 降级 | -
依赖 5xx | 重试退避 | 降级 | -
DB 死锁 | 立即重试 | - | -
DB 连不上 | 重试退避 | - | 启动失败 panic
代码 bug | - | 500 + 告警 | -
OOM | - | - | crash + restart
二、四大流派
1. Exception(Java / C# / Python / Ruby / JS)
try {
const user = await db.findUser(id)
if (!user) throw new NotFoundError('user', id)
return user
} catch (e) {
if (e instanceof NotFoundError) return null
throw e // rethrow 未知错误
}
优点:调用栈自动展开 / 不污染正常路径 缺点:函数签名隐藏失败可能 / 容易吞噬 / 性能(构造 stack)
2. Error Value(Go)
user, err := db.FindUser(id)
if err != nil {
if errors.Is(err, sql.ErrNoRows) { return nil, nil }
return nil, fmt.Errorf("db.FindUser: %w", err) // wrap
}
return user, nil
优点:错误是显式返回值 / 不会忘记处理
缺点:样板代码多 / 容易 if err != nil { return err } 丢失上下文
3. Result/Either(Rust / Haskell / Scala / 现代 TS)
fn find_user(id: u64) -> Result<User, FindError> {
db.find_user(id).map_err(FindError::DbError)
}
match find_user(123) {
Ok(user) => println!("{}", user.name),
Err(FindError::DbError(e)) => log::error!("db: {}", e),
Err(FindError::NotFound) => println!("not found"),
}
// TS / fp-ts / neverthrow
import { Result, ok, err } from 'neverthrow'
function findUser(id: number): Result<User, FindError> {
return db.findUser(id).match(
user => user ? ok(user) : err({ kind: 'not_found' }),
e => err({ kind: 'db_error', cause: e })
)
}
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.
- 7d ago First seen · 377 lines · 113 tokens per session scan A 265185958c4c
error-handling-patterns is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 113 tokens to every session and 3,431 once invoked, about $0.0006 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…
convex-performance-audit
Audits Convex performance for reads, subscriptions, write contention, and function limits. Use for slow features, insights findings, OCC conflicts, or read amplification.
convex-insights
Query a running Convex app's logs + health in natural language (official MCP): failures, slow/expensive functions, deploy causality — scoped, evidence-backed, with a dashboard deep link.
ssl-proxy-troubleshoot
Systematic workflow for troubleshooting SSL/proxy connectivity issues with government websites.
diagnose-backend-bug
Diagnose a bounded backend or multi-service failure from GitHub Issues, Jira, Aone, user-provided exports, logs, traces, responses, stack traces, or job records. Use when a service, API, RPC, worker, queue, CLI, or scheduled job bug needs correlation through the project's existing observability route before repair; do…
axiom-networking
Use when implementing or debugging ANY network connection, API call, or socket. Covers URLSession, Network.framework, NetworkConnection, connection diagnostics.