Skip to content
Back to skills

Rust Errors

ASecurity

Failure semantics. Use when defining Rust errors, failure mappings, exit codes, degradation, or fallible completion.

  • 14 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
developmentrustgo

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add Dankosik/cargo-modernize --skill rust-errors --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rust Errors?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rust Errors
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/dankosik-rust-errors-cargo-modernize/badge)](https://www.skillsdirectory.com/skills/dankosik-rust-errors-cargo-modernize)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rust-errors
description: "Failure semantics. Use when defining Rust errors, failure mappings, exit codes, degradation, or fallible completion."
---

# Rust Errors

**Failure semantics.** Trace failure from the operation that observes it to the consumer that acts on it, separating rejected inputs, partial effects, uncertain outcomes, and post-commit cleanup failures so each boundary can stop, degrade, retry, or continue accurately.

**Consumer-driven types.** Expose typed variants where callers branch on recovery, while letting report-and-exit boundaries use contextual errors. Implement `std::error::Error`, `Display`, and `Debug` (via `thiserror`) on public library error types, preserving upstream `#[source]` causes and adding variants only for real consumers.

**Context and redaction.** Attach safe resource identifiers or input positions at the failing operation, verify what the boundary renderer actually emits from the `source()` chain, keep messages lowercase and free of trailing punctuation, redact secrets across every nested cause, and preserve failure precedence and all-or-nothing guarantees.

**Conversions and retries.** Implement `From` for context-free canonical conversions and use `map_err` where operation context disambiguates the failure; match structured variants rather than formatted strings. Require safe effect and idempotency identity before retrying timeouts or broken connections, log ignored cleanup failures only under an explicit best-effort policy, and represent help or early clean exits as normal `Ok` outcomes.

**Fallible completion and panics.** Expose an explicit observed close or flush method whenever resource completion can fail or await, reserving `Drop` for infallible non-blocking release and keeping primary outcomes distinct from cleanup errors. Use `catch_unwind` solely as task-boundary defense in depth, observe spawned-task failures via their supervisor, and re-establish or quarantine any multi-step invariant a panic could leave partial before exposing shared state.

**Project boundaries.** Keep per-file parser or detector failures (including panics caught by the scan worker's `catch_unwind`) contained to that file and accounted in the run summary rather than aborting the workspace scan; keep `--fix` transactional so a failed `cargo check` rolls edits back; and map outcomes to process exit status only in `crates/cargo-modernize/src/main.rs`, where `--check` findings and real errors stay distinguishable. Test these mappings behaviorally rather than boilerplate variants.

Files in this skill

  • LICENSE1 KB
  • SKILL.md2.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.