ER

error-handling

Provides conventions for defining custom error types, diagnostic reporting, and input validation using miette and thiserror.

Install

mkdir -p .claude/skills/error-handling-kumasan00 && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17202" && unzip -o skill.zip -d .claude/skills/error-handling-kumasan00 && rm skill.zip

Installs to .claude/skills/error-handling-kumasan00

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Seiran のエラーハンドリング・バリデーション規約。新しいエラー型を定義する時、 既存エラー enum にバリアントを足す時、miette 診断(code / help / label / related)を 設計する時、ソース位置付きエラーや複数エラーの集約を返す時、garde で設定値の バリデーションを書く時に必ず参照する。
168 charsno explicit “when” trigger
Intermediate

Key capabilities

  • →Define custom error enums using `thiserror::Error` and `miette::Diagnostic`
  • →Attach diagnostic codes, help messages, and source labels to error variants
  • →Chain external errors using the `#[source]` field
  • →Aggregate multiple errors into a single report using `#[related]`
  • →Validate configuration values declaratively with `garde`
  • →Return crate-specific error types from functions

How it works

This skill defines error enums with `thiserror::Error` and `miette::Diagnostic` to structure errors, attach diagnostic information, and chain external errors. It uses `garde` for declarative validation of configuration values.

Inputs & outputs

You give it
External error, source text, configuration values
You get back
Structured error reports with diagnostics, aggregated validation errors

When to use error-handling

  • →Defining custom error enums
  • →Implementing diagnostic reporting
  • →Adding validation logic with garde
  • →Aggregating multiple errors

About this skill

エラーハンドリング

正典は docs/error-handling.md。この skill は読むタイミングを固定するだけで規約の本文を持たない (本文をここへ複製しない — 変更は正典側だけに入れる)。

作業ごとに読む節:

作業節
エラー enum の新設・variant 追加、#[source] / #[diagnostic_source] の選択エラー型の定義
診断 code の命名・変更(golden の再生成を含む)診断 code の規約
span・SourceId・NamedSource の付与ソース位置付きエラー
複数の違反をまとめて返す(Failures<E> / CompileFailure)複数エラーの集約
warning の追加、tracing::warn! との使い分けwarning と tracing
「到達しないはず」の分岐、unreachable!内部不変条件違反
関数の戻り型、main の形シグネチャの原則
config.toml / style.toml の値検証バリデーション(garde)

When not to use it

  • →`miette::Result<T>` should not be used in library public APIs
  • →`miette::Report` cannot be directly put into a `Vec` for `#[related]` aggregation
  • →Error aggregation is not used for `read_references` during deserialization

Limitations

  • →`miette::Result<T>` is limited to `main` or higher-level pipeline functions
  • →`miette::Report` does not implement `Diagnostic`
  • →Error aggregation is not applied to `read_references`

How it compares

This approach standardizes error reporting with detailed diagnostics and structured aggregation, unlike manual error handling that might lack consistent formatting or diagnostic context.

Compared to similar skills

error-handling side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
error-handling (this skill)03moNo flagsIntermediate
tauri762moReviewAdvanced
arm-cortex-expert295moNo flagsAdvanced
blockchain-developer65moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

tauri

EpicenterHQ

Tauri path handling, cross-platform file operations, and API usage. Use when working with file paths in Tauri frontend code, accessing filesystem APIs, or handling platform differences in desktop apps.

76185

arm-cortex-expert

sickn33

Senior embedded software engineer specializing in firmware and driver development for ARM Cortex-M microcontrollers (Teensy, STM32, nRF52, SAMD). Decades of experience writing reliable, optimized, and maintainable embedded code with deep expertise in memory barriers, DMA/cache coherency, interrupt-driven I/O, and peripheral drivers.

2975

blockchain-developer

sickn33

Build production-ready Web3 applications, smart contracts, and decentralized systems. Implements DeFi protocols, NFT platforms, DAOs, and enterprise blockchain integrations. Use PROACTIVELY for smart contracts, Web3 apps, DeFi protocols, or blockchain infrastructure.

655

rust-async-patterns

wshobson

Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns. Use when building async Rust applications, implementing concurrent systems, or debugging async code.

1132

rust-errors

EpicenterHQ

Rust to TypeScript error handling patterns for Tauri apps. Use when defining Rust errors that will be passed to TypeScript, handling Tauri command errors, or creating discriminated union error types.

521

memory-safety-patterns

sickn33

Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C. Use when writing safe systems code, managing resources, or preventing memory bugs.

415

Search skills

Search the agent skills registry