mds-snafu-error-design

Design contextual Rust errors with the Snafu crate.

Updated Jan 6, 2026
One-click install
npx skills add https://github.com/eboody/eran.codes --skill mds-snafu-error-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mds-snafu-error-design
Source: https://github.com/eboody/eran.codes/tree/main/.codex/skills/mds-snafu-error-design
Command: npx skills add https://github.com/eboody/eran.codes --skill mds-snafu-error-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidance on designing robust and maintainable error handling in Rust projects, specifically focusing on leveraging the snafu crate for contextualized error management.

Core Features & Use Cases

  • Contextual Error Design: Learn to categorize errors by context rather than just source type.
  • Library vs. Application Boundaries: Understand how to separate error handling concerns between internal modules and external interfaces.
  • Source Mapping: Implement clear mapping of underlying errors to specific contextual failures.
  • Use Case: When developing a new Rust service, use this guidance to establish a consistent and expressive error handling strategy from the outset, ensuring clarity and maintainability.

Quick Start

Consult the mds-snafu-error-design skill for best practices on Rust error type design.

Frequently Asked Questions about mds-snafu-error-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design contextual errors in Rust using the Snafu crate?

Snafu handles Rust error propagation by mapping underlying error sources to specific contextual failures, allowing you to implement shared backtrace wrappers and distinguish error boundaries between internal library modules and external application interfaces.

What is the best way to separate library and application error boundaries in Rust?

The best way to separate library and application error boundaries in Rust is to define module-scoped error types using Snafu, isolating internal error propagation from external interface contracts to maintain clarity and prevent leaking implementation details.

Does the Snafu crate support mapping error sources in Rust backend services?

Yes, the Snafu crate supports mapping error sources in Rust backend services by providing structured error types that attach contextual data, helping you track where and why an underlying failure occurred during propagation.

What are common pitfalls to avoid when handling Rust error propagation with Snafu?

Common pitfalls to avoid during Rust error propagation with Snafu include failing to categorize errors by context, improperly mapping underlying error sources, and neglecting to separate library and application error boundaries, which reduces maintainability.

When do I need shared backtrace wrappers in Rust error design?

You need shared backtrace wrappers in Rust error design when you want consistent debugging context across module-scoped errors, allowing your Rust service to capture unified backtrace information for mapped error sources during propagation.