# M06 error handling

> M06 error handling is an open-source agent skill for developer tools. Guides the agent on Rust error handling: Result vs Option, panics, ? and error crates. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/k1-c/linear-tui/tree/main/.claude/skills/m06-error-handling
- **Repository:** https://github.com/k1-c/linear-tui
- **GitHub stars:** 21
- **License:** MIT
- **Skill name:** m06-error-handling
- **Collection:** https://github.com/k1-c/linear-tui
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill is a decision guide for Rust error handling. It starts from a single question, whether a failure is expected or a bug, and walks the agent through who should handle the failure and what context the caller needs. It maps situations to patterns such as Result, Option, the ? operator, expect, and panic!, and suggests thiserror for typed errors in libraries and anyhow for ergonomic errors in applications.

The material is organized as a set of reference tables: a quick reference, a decision flowchart, common errors with fixes, and anti-patterns such as overusing unwrap or boxing every error. It also points to related skills for domain error design, crate boundaries and type-safe errors when a question goes beyond basic mechanics.

The skill is written for Rust code and needs no scripts or external tools. It is meant to be read by the agent while it writes or reviews code, and its guidance is plain text the agent applies directly to the files it is working on.

## When your agent uses it

> CRITICAL: Use for error handling. Triggers: Result, Option, Error, ?, unwrap, expect, panic, anyhow, thiserror, when to panic vs return Result, custom error, error propagation, 错误处理, Result 用法, 什么时候用 panic

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/k1-c/linear-tui/tree/HEAD/.claude/skills/m06-error-handling)
- [License: MIT](https://github.com/k1-c/linear-tui/tree/HEAD/.claude/skills/m06-error-handling)

## Features

- **Expected versus bug triage:** Helps decide whether a failure should return Result, return Option, or panic.
- **Library and application crates:** Explains when to reach for thiserror for typed errors or anyhow for ergonomic handling.
- **Error propagation with context:** Covers using ? and attaching context so callers see what was happening.
- **Decision flowchart:** Provides a branching guide from failure type to the matching error pattern.
- **Common errors and fixes:** Lists typical Rust error problems such as unwrap panics and type mismatches with fixes.
- **Anti-pattern checklist:** Flags habits like pervasive unwrap, silent ignores and panics for expected errors.

## Good for

- Decide whether a parse function should return Result or Option
- Replace unwrap calls with proper error propagation
- Set up thiserror error types for a Rust library
- Add anyhow context to errors in an application binary
- Review a Rust module for panics on expected failures

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/m06-error-handling` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/m06-error-handling &&
cp -R "$tmp/.claude/skills/m06-error-handling" ~/.claude/skills/m06-error-handling &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/m06-error-handling` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/m06-error-handling` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/m06-error-handling &&
cp -R "$tmp/.claude/skills/m06-error-handling" ~/.agents/skills/m06-error-handling &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/m06-error-handling` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/m06-error-handling` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/m06-error-handling &&
cp -R "$tmp/.claude/skills/m06-error-handling" ~/.cursor/skills/m06-error-handling &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/m06-error-handling` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/k1-c/linear-tui.git --path .claude/skills/m06-error-handling
```

Or copy the folder to `~/.gemini/skills/m06-error-handling` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/m06-error-handling`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/k1-c/linear-tui.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/m06-error-handling &&
cp -R "$tmp/.claude/skills/m06-error-handling" ~/.copilot/skills/m06-error-handling &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/m06-error-handling` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/k1-c/linear-tui.git
```

Then copy `linear-tui/.claude/skills/m06-error-handling` into your agent's skills folder as `m06-error-handling`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does M06 error handling trigger?

It is triggered by error-related terms such as Result, Option, unwrap, expect, panic, anyhow, thiserror, custom error and error propagation, including Chinese-language equivalents.

### Does M06 error handling run any scripts or need extra tools?

No scripts are included. It consists of a SKILL.md with reference files and does not set allowed tools.

### Which error crates does M06 error handling recommend?

It recommends thiserror for library code with typed errors and anyhow for application code, with both mixed where appropriate.

### Is M06 error handling tied to a specific AI client?

The listing does not tie it to a specific client, so it follows the shared agent skills format.

### How do I install M06 error handling in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/m06-error-handling to use it in all your projects, or to .claude/skills/m06-error-handling in one project.

### Does M06 error handling run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use M06 error handling?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to M06 error handling?

The closest alternatives to M06 error handling are M13 domain error, M11 ecosystem, M03 mutability, Coding guidelines and M01 ownership.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [M13 domain error](https://ai-powered.com/skills/m13-domain-error): M13 domain error is an open-source agent skill for developer tools.
- [M11 ecosystem](https://ai-powered.com/skills/m11-ecosystem): M11 ecosystem is an open-source agent skill for developer tools.
- [M03 mutability](https://ai-powered.com/skills/m03-mutability): M03 mutability is an open-source agent skill for developer tools.
- [Coding guidelines](https://ai-powered.com/skills/coding-guidelines): Coding guidelines is an open-source agent skill for developer tools.
- [M01 ownership](https://ai-powered.com/skills/m01-ownership): M01 ownership is an open-source agent skill for developer tools.
- [Error handling](https://ai-powered.com/skills/error-handling): Error handling is an open-source agent skill for developer tools.
- [M04 zero cost](https://ai-powered.com/skills/m04-zero-cost): M04 zero cost is an open-source agent skill for developer tools.
- [M05 type driven](https://ai-powered.com/skills/m05-type-driven): M05 type driven is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/m06-error-handling
