error-handling

error-handling is a skill for Claude Code from armanzeroeight/fastagent-plugins. It costs 59 tokens per session (2,038 once invoked), scanned A, original, MIT.

A guide to handling errors in Go, including adding context, defining custom errors, and distinguishing expected errors from serious failures. Error wrapping preserves the original cause while adding useful information.

In plain words
What is it for?
Use it when returning errors, wrapping them, defining sentinel or custom errors, and passing failures through Go code.
Why use it?
It helps make failures easier to understand and lets calling code respond to specific error types.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the go-toolkit plugin — 2 skills shipped together

Good fit Use it when returning errors, wrapping them, defining sentinel or custom errors, and passing failures through Go code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/armanzeroeight/fastagent-plugins/error-handling
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add armanzeroeight/fastagent-plugins --skill error-handling
Clone the repo
git clone --depth 1 https://github.com/armanzeroeight/fastagent-plugins

Made for: Claude Code.

Or install go-toolkit, the plugin that ships this one along with the rest of its 2 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for error-handling

README.md
[![agentmods](https://agentmods.dev/badge/skills/armanzeroeight/fastagent-plugins/error-handling.svg)](https://agentmods.dev/skills/armanzeroeight/fastagent-plugins/error-handling)
Your own site
<a href="https://agentmods.dev/skills/armanzeroeight/fastagent-plugins/error-handling"><img src="https://agentmods.dev/badge/skills/armanzeroeight/fastagent-plugins/error-handling.svg" alt="Measured on agentmods" height="20"></a>
Per session 59 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,038 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00059 $0.02038
Opus 5 $0.00030 $0.01019
Sonnet 5 $0.00012 $0.00408
Haiku 4.5 $0.00006 $0.00204

Measured 4d ago against content hash 98732008fa26, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

error-handling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/go-toolkit/skills/error-handling/SKILL.md · 390 lines

How it starts

The opening of the file, as written. The whole thing — 390 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Error Handling

Implement idiomatic Go error handling patterns.

Quick Start

Basic error handling:

result, err := doSomething()
if err != nil {
    return fmt.Errorf("do something: %w", err)
}

Sentinel error:

var ErrNotFound = errors.New("not found")

if errors.Is(err, ErrNotFound) {
    // Handle not found
}

Instructions

Step 1: Return Errors

Basic error return:

func ReadFile(path string) ([]byte, error) {
    data, err := os.ReadFile(path)
    if err != nil {
        return nil, fmt.Errorf("read file %s: %w", path, err)
    }
    return data, nil
}

Multiple return values:

func Divide(a, b float64) (float64, error) {
    if b == 0 {
        return 0, errors.New("division by zero")
    }
    return a / b, nil
}

Step 2: Wrap Errors with Context

Using fmt.Errorf with %w:

func ProcessFile(path string) error {
    data, err := ReadFile(path)
    if err != nil {
        return fmt.Errorf("process file: %w", err)
    }
    
    if err := Validate(data); err != nil {
        return fmt.Errorf("validate data: %w", err)
    }
    
    return nil
}

Error chain:

// Original error
err := os.Open("file.txt")

// Wrapped once
err = fmt.Errorf("open config: %w", err)

// Wrapped again
err = fmt.Errorf("initialize app: %w", err)

// Unwrap to check original
if errors.Is(err, os.ErrNotExist) {
    // Handle file not found
}

Step 3: Use Sentinel Errors

Define sentinel errors:

var (
    ErrNotFound     = errors.New("not found")
    ErrUnauthorized = errors.New("unauthorized")
    ErrInvalidInput = errors.New("invalid input")
)

func GetUser(id string) (*User, error) {
    user, ok := cache[id]
    if !ok {
        return nil, ErrNotFound
    }
    return user, nil
}

Check with errors.Is:

user, err := GetUser("123")
if errors.Is(err, ErrNotFound) {
    // Handle not found case
    return nil
}
if err != nil {
    // Handle other errors
    return err
}

Read the full file on GitHub · 390 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 390 lines · 59 tokens per session scan A 98732008fa26

Subscribe to this mod's changes

error-handling is a skill published in the GitHub repository armanzeroeight/fastagent-plugins (29 stars, last pushed 1mo ago), licensed MIT. It adds 59 tokens to every session and 2,038 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

stack-trace-go-probe

Internal helper for meta-stack-trace-investigator. Use when a Go panic or stack trace needs Go-specific nil/error checks, go test reproducer guidance, and patch targets.

opensquilla/opensquilla · 42 tokens

golang-troubleshooting

Troubleshoot Golang programs systematically - find and fix the root cause. Use when encountering bugs, crashes, deadlocks, races, or unexpected behavior in Go code. Covers debugging methodology, common Go pitfalls, test-driven debugging, pprof setup and capture, Delve, race detection, GODEBUG tracing, and production…

samber/cc-skills-golang · 175 tokens

golang-error-handling

Idiomatic Golang error handling — creation, wrapping with %w, errors.Is/As, errors.Join, custom error types, sentinel errors, panic/recover, the single handling rule, structured logging with slog, HTTP request logging middleware, and samber/oops for production errors. Built to make logs usable at scale with log…

samber/cc-skills-golang · 144 tokens

python-performance

Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.

seaworld008/Commonly-used-high-value-skills · 38 tokens

python-debugpy

Debug Python: pdb REPL + debugpy remote (DAP).

HezaoHezao/poirot · 17 tokens

aidd-error-causes

Use the error-causes library for structured error handling in JavaScript/TypeScript. Use when throwing errors, catching errors, defining error types, or implementing error routing.

paralleldrive/aidd · 40 tokens