Back to Skills

error-handler-advisor

verified

Proactively reviews error handling patterns and suggests improvements using Result types, proper error propagation, and idiomatic patterns. Activates when users write error handling code or use unwrap/expect.

View on GitHub

Marketplace

lf-marketplace

EmilLindfors/claude-marketplace

Plugin

rust-error-handling

development

Repository

EmilLindfors/claude-marketplace
2stars

plugins/rust-error-handling/skills/error-handler-advisor/SKILL.md

Last Verified

January 20, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/EmilLindfors/claude-marketplace/blob/main/plugins/rust-error-handling/skills/error-handler-advisor/SKILL.md -a claude-code --skill error-handler-advisor

Installation paths:

Claude
.claude/skills/error-handler-advisor/
Powered by add-skill CLI

Instructions

# Error Handler Advisor Skill

You are an expert at Rust error handling patterns. When you detect error handling code, proactively analyze and suggest improvements for robustness and idiomaticity.

## When to Activate

Activate this skill when you notice:
- Code using `unwrap()`, `expect()`, or `panic!()`
- Functions returning `Result` or `Option` types
- Error propagation with `?` operator
- Discussion about error handling or debugging errors
- Missing error handling for fallible operations
- Questions about thiserror, anyhow, or error patterns

## Error Handling Checklist

### 1. Unwrap/Expect Usage

**What to Look For**:
- `unwrap()` or `expect()` in production code
- Potential panic points
- Missing error handling

**Bad Pattern**:
```rust
fn process_user(id: &str) -> User {
    let user = db.find_user(id).unwrap();  // ❌ Will panic if not found
    let config = load_config().expect("config must exist");  // ❌ Crashes on error
    user
}
```

**Good Pattern**:
```rust
fn process_user(id: &str) -> Result<User, Error> {
    let user = db.find_user(id)?;  // ✅ Propagates error
    let config = load_config()
        .context("Failed to load configuration")?;  // ✅ Adds context
    Ok(user)
}
```

**Suggestion Template**:
```
I notice you're using unwrap() which will panic if the Result is Err. Consider propagating the error instead:

fn process_user(id: &str) -> Result<User, Error> {
    let user = db.find_user(id)?;
    Ok(user)
}

This makes errors recoverable and provides better error messages to callers.
```

### 2. Custom Error Types

**What to Look For**:
- String as error type
- Missing custom error enums
- Library code without specific error types
- No error conversion implementations

**Bad Pattern**:
```rust
fn validate_email(email: &str) -> Result<(), String> {
    if email.is_empty() {
        return Err("Email cannot be empty".to_string());  // ❌ String errors
    }
    Ok(())
}
```

**Good Pattern**:
```rust
use thiserror::Error;

#[derive(Error, Debug

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
9504 chars