Skip to content
Skill

M06 error handling

Guides the agent on Rust error handling: Result vs Option, panics, ? and error crates

M06 error handling is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
21
Last commit
License
MIT
Listing updated

Similar skills

About M06 error handling

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

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 3 files (21 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

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

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.

Claude Code docs on skills

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

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.

Codex docs on skills

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

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.

Cursor docs on skills

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

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.

Gemini CLI docs on skills

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

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.

VS Code docs on skills

Get the folder:

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.

The SKILL.md format

What it does

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

M06 error handling 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.

More from k1-c/linear-tui

  1. Gives the agent a quick reference of Rust-specific naming, error handling and async rules

    • Open source
    • 21 GitHub stars
    • Developer tools
  2. Guides the agent to write Conventional Commits, splitting mixed changes into several

    • Open source
    • 21 GitHub stars
    • Developer tools
  3. Guides an agent through building Rust command-line tools with clap, config layers

    • Open source
    • 21 GitHub stars
    • Developer tools
  4. Guides the agent through Rust ownership, borrow and lifetime compiler errors

    • Open source
    • 21 GitHub stars
    • Developer tools
  5. Guides an agent in choosing Rust smart pointers like Box, Rc, Arc, Weak and RefCell

    • Open source
    • 21 GitHub stars
    • Developer tools
  6. Guides a Rust agent through E0596/E0499/E0502 borrow errors and interior mutability

    • Open source
    • 21 GitHub stars
    • Developer tools