rust-error-handling

rust-error-handling is a skill for Claude Code from fusengine/agents. It costs 21 tokens per session (1,118 once invoked), scanned A, original, MIT.

A guide to designing errors in Rust, including the difference between typed errors for libraries and convenient contextual errors for applications. It explains when a failure should be returned and when a panic is appropriate.

In plain words
What is it for?
Use it when choosing between thiserror and anyhow, defining error enums, deciding between Result and panic, or designing a public Rust API.
Why use it?
It helps callers handle failures predictably and prevents application-only error types from leaking into reusable library interfaces.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the fuse-rust plugin — 7 skills, 1 agent shipped together

Good fit Use it when choosing between thiserror and anyhow, defining error enums, deciding between Result and panic, or designing a public Rust API.

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

Made for: Claude Code.

Or install fuse-rust, the plugin that ships this one along with the rest of its 7 skills, 1 agent.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/fusengine/agents/rust-error-handling"><img src="https://agentmods.dev/badge/skills/fusengine/agents/rust-error-handling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,118 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 pass 7 Sept 2026
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.00021 $0.01118
Opus 5.5 $0.00008 $0.00447
Sonnet 5.5 $0.00004 $0.00224
Haiku 4.5 $0.00002 $0.00112

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

Security

Grade A, and why

rust-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.

plugins/rust-expert/skills/rust-error-handling/SKILL.md · 89 lines

How it starts

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

It also covers the recoverable-errors-vs-panics decision — Result for anything a caller could reasonably recover from, panic!/unwrap/expect reserved for broken invariants — and the rule that anyhow::Error must never leak into a library's public API.

Out of scope: general ownership/borrowing design belongs to rust-core-language; async-runtime-specific error handling is not covered here.

Rust Error Handling

The consensus split: thiserror for libraries, anyhow for applications. A library exposes a typed error its callers can match; an application wants one ergonomic error type and rich context. Getting this boundary right is the whole discipline.

Agent Workflow (MANDATORY)

  1. fuse-ai-pilot:explore-codebase — is this crate a library (published API, other code depends on it) or a binary/application? That answer picks the tool.
  2. fuse-ai-pilot:research-expert — confirm current thiserror / anyhow API before writing derives (verification chain: fuse-browser fast-path on docs.rs/thiserror and docs.rs/anyhow → Context7 → Exa).
  3. After writing, run fuse-ai-pilot:sniper and cargo clippy.

The rule

Crate kind Tool Why
Library (others depend on it) thiserror Typed enum, #[derive(Error)], callers can match on variants
Application (binary, top level) anyhow anyhow::Result<T>, ? everywhere, .context() for breadcrumbs
Simple / dep-free hand-written std::error::Error No dependency when one or two variants suffice

Critical Rules

  1. Never expose anyhow::Error in a library's public API. It erases the type, so callers cannot match or handle specific failures. Return a typed enum error. thiserror is designed to not appear in your public API — switching to/from a hand-written impl is not a breaking change.
  2. Applications use anyhow; libraries use thiserror. Do not pull anyhow into a reusable library's signatures.
  3. Add context at each layer in application code: .context("...") / .with_context(|| ...) turns "No such file or directory" into a traceable chain.
  4. #[from] for zero-boilerplate conversion, so ? lifts a source error into your enum. #[from] implies #[source] — never write both.
  5. Errors are values; panics are bugs. Use Result for anything a caller could reasonably recover from. Reserve panic!/unwrap/expect for broken invariants.

Read the full file on GitHub · 89 lines

Files

What ships with it

6 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.

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 8a3ec75c6d85
  2. 3mo ago First seen · 89 lines · 21 tokens per session scan A 4fd3253bbf34

Subscribe to this mod's changes

rust-error-handling is a skill published in the GitHub repository fusengine/agents (34 stars, last pushed 1mo ago), licensed MIT. It adds 21 tokens to every session and 1,118 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-09-03.

Related

rust-error-handling compared with skills from other repositories

rust-error-handling next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rust-error-handlingfusengine/agentsSkill341mo agoMITA21Claude Code
polarsK-Dense-AI/scientific-agent-skillsSkill60k4d agoMITA47Claude Code
pinocchio-developmentsendaifun/skillsSkill1294mo agoApache-2.0A44Claude Code, Codex
building-telegram-botsisvlasov/rageatc-ossSkill104mo agoMITA68Claude Code
pennylaneK-Dense-AI/scientific-agent-skillsSkill60k4d agoMITA74Claude Code
architectoliver-kriska/claude-elixir-phoenixSkill580todayMITA47Claude Code
phx-documentoliver-kriska/claude-elixir-phoenixSkill580todayMITA50Claude Code, Codex