Claude Skill

rust-errors

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

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download dankosik-cargo-modernize-.agents_skills_rust-errors-6f540c3.zip · 2 KB

Install

skills CLI npx skills add https://github.com/Dankosik/cargo-modernize/tree/main/.agents/skills/rust-errors
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install dankosik-cargo-modernize@llmmart
Git git clone https://github.com/Dankosik/cargo-modernize.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole dankosik/cargo-modernize collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

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 (cargo-modernize)
  • LICENSE 1 KB · in bundle
  • SKILL.md 2.5 KB
    ---
    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.
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.