Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Rust Error Handling

БесплатноБез исполняемых скриптовНе проверен

Rust-specific error handling patterns, building on the base error handling skill. Demonstrates the 'extends' composition feature.

Dicklesworthstoneот Dicklesworthstone★ 217 звёзд на GitHub

Об этом скилле

Rust Error Handling

Rust-specific error handling patterns that extend the base error handling skill.

Rules

  • Use thiserror for defining library error types
  • Use anyhow for application-level error handling
  • Implement std::error::Error trait for custom error types
  • Use the ? operator for ergonomic error propagation
  • Prefer Result<T, E> over panicking for recoverable errors
  • Use unwrap() only in tests or when failure is impossible

Examples

// Define library errors with thiserror
use thiserror::Error;

#[derive(Error, Debug)]
pub enum ConfigError {
    #[error("failed to read config file: {0}")]
    Io(#[from] std::io::Error),

    #[error("invalid config format: {0}")]
    Parse(#[from] toml::de::Error),

    #[error("missing required field: {field}")]
    MissingField { field: String },
}
// Application-level error handling with anyhow
use anyhow::{Context, Result};

fn load_config(path: &str) -> Result<Config> {
    let content = std::fs::read_to_string(path)
        .with_context(|| format!("failed to read config from {}", path))?;

    let config: Config = toml::from_str(&content)
        .context("failed to parse config TOML")?;

    Ok(config)
}

Checklist

  • Custom error types use thiserror derive
  • Error context is added with anyhow::Context
  • No unwrap() calls in production code paths
  • Result is used instead of panic! for recoverable errors

Установить Rust Error Handling в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Rust Error Handling?

Rust-specific error handling patterns, building on the base error handling skill. Demonstrates the 'extends' composition feature.

Как установить скилл Rust Error Handling?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Rust Error Handling запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Rust Error Handling с