igmarin/agent-profiles/error-handling

Claude Code and agent skill by igmarin/agent-profiles

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Result over panic. thiserror in libs, anyhow in bins. ? propagation, no unwrap on recoverable errors. Trigger: thiserror, anyhow, unwrap, expect, ?, error chain, eyre.

Install

npx vskill@latest install igmarin/agent-profiles/error-handling

SKILL.md

Error handling

Apply the execution contract before this procedure.

Goal

Recoverable failure is Result. Panics are bugs, not control flow.

Inputs / outputs

  • In: a fallible operation
  • Out: Result<T, E> with a useful E, or a typed panic only for invariants

Reads / writes

  • Read: the fallible fn and its callers
  • Write: none unless a playbook opened the task

Approval

Adding thiserror / anyhow if they are not already in Cargo.toml.

RULES — no exceptions

  1. Library crates: preserve the existing typed error API; use a small handwritten enum or existing thiserror dependency implementing Error and needed conversions
  2. Binary / app crates: use the existing error convention; anyhow with .context() is an option when already installed, not a required dependency
  3. ? to propagate; From impls make ? work
  4. No .unwrap() on user/IO/parse paths
  5. .expect("…") only for proven invariants (a bug if it fires)
  6. Messages: lowercase, no trailing punctuation
  7. Preserve source (#[source] / .context())
  8. Document # Errors on public fallible fns

Example

rust
use std::num::NonZeroU16;
// ❌
let n: u16 = s.parse().unwrap();
// ✅ lib
#[derive(Debug, thiserror::Error)]
enum ParsePortError {
#[error("not a number")]
Num(#[from] std::num::ParseIntError),
#[error("port must be non-zero")]
Zero,
}
fn parse_port(s: &str) -> Result<NonZeroU16, ParsePortError> {
let n: u16 = s.parse()?;
NonZeroU16::new(n).ok_or(ParsePortError::Zero)
}

Steps

  1. Classify: recoverable vs invariant
  2. Recoverable → Result + ?
  3. If the crate is a lib, keep E typed; if a bin, anyhow is enough

Validation

No new unwrap/expect on IO/parse. cargo test covers the error variant.

Pitfalls

❌✅
unwrap in a lib?
expect("failed") on a missing fileErr + context
Swallow with let _ =return or log once at the edge

Integration

Predecessor: rust-essentials. Successor: none.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/igmarin/agent-profiles/error-handling/badge)](https://verified-skill.com/skills/igmarin/agent-profiles/error-handling)

Something wrong with this skill or its page? Tell us.