error-handling

error-handling is a skill for Claude Code from zdanovichnick/dotnet-pilot. It costs 28 tokens per session (2,041 once invoked), scanned A, original, MIT.

A reference for structured error handling in .NET APIs, including expected-result types, RFC 7807 ProblemDetails responses, validation errors, and global exception handling.

In plain words
What is it for?
Use it when designing .NET API result types, validation responses, exception boundaries, and HTTP 500 error handling.
Why use it?
It helps separate expected business failures from unexpected system failures and prevents errors from being hidden or reported inconsistently.

Skill for Claude Code

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

Part of the dotnet-pilot plugin — 16 skills, 15 agents, 3 hooks, 1 MCP server shipped together

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.

agentmods
npx agentmods add skills/zdanovichnick/dotnet-pilot/error-handling
Any agent
npx skills add zdanovichnick/dotnet-pilot --skill error-handling
Clone the repo
git clone --depth 1 https://github.com/zdanovichnick/dotnet-pilot

Made for: Claude Code.

Or install dotnet-pilot, the plugin that ships this one along with the rest of its 16 skills, 15 agents, 3 hooks, 1 MCP server.

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/zdanovichnick/dotnet-pilot/error-handling.svg)](https://agentmods.dev/skills/zdanovichnick/dotnet-pilot/error-handling)
Your own site
<a href="https://agentmods.dev/skills/zdanovichnick/dotnet-pilot/error-handling"><img src="https://agentmods.dev/badge/skills/zdanovichnick/dotnet-pilot/error-handling.svg" alt="Measured on agentmods" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,041 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00028 $0.02041
Opus 5 $0.00014 $0.01020
Sonnet 5 $0.00006 $0.00408
Haiku 4.5 $0.00003 $0.00204

Measured 6d ago against content hash cbf7817512d9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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.

skills/error-handling/SKILL.md · 275 lines

How it starts

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

Error Handling Patterns

Reference for structured error handling in .NET APIs. Used by dnp-planner, dnp-api-scaffolder, and dnp-tdd-developer-hard.

Philosophy: When to Use Results vs Exceptions

Scenario Approach
Domain rule violation (not found, invalid state, business constraint) Result<TValue, TError> — expected failure path
Infrastructure failure (DB timeout, network error, config missing) Exception — unexpected, unrecoverable at call site
Validation failure (bad input from HTTP layer) ValidationProblemDetails via model binding / FluentValidation
Unhandled exception escaping to HTTP GlobalExceptionHandler → 500 ProblemDetails

Never throw exceptions for expected domain outcomes. Never swallow exceptions at call sites.

Result Type

Define in a shared location (e.g., Common/Result.cs):

namespace MyApp.Common;

public readonly record struct Result<TValue, TError>
{
    private readonly TValue? _value;
    private readonly TError? _error;

    public bool IsSuccess { get; }
    public bool IsFailure => !IsSuccess;

    private Result(TValue value) { _value = value; IsSuccess = true; }
    private Result(TError error) { _error = error; IsSuccess = false; }

    public static Result<TValue, TError> Success(TValue value) => new(value);
    public static Result<TValue, TError> Failure(TError error) => new(error);

    public TResult Match<TResult>(
        Func<TValue, TResult> onSuccess,
        Func<TError, TResult> onFailure)
        => IsSuccess ? onSuccess(_value!) : onFailure(_error!);

    public void Match(Action<TValue> onSuccess, Action<TError> onFailure)
    {
        if (IsSuccess) onSuccess(_value!);
        else onFailure(_error!);
    }
}

Typed Error Records

Define errors as discriminated records in the domain layer:

namespace MyApp.Domain.Errors;

public abstract record DomainError(string Message);

public record NotFoundError(string Resource, object Id)
    : DomainError($"{Resource} with id '{Id}' was not found.");

public record ConflictError(string Resource, string Reason)
    : DomainError($"{Resource} conflict: {Reason}");

public record ValidationError(string Field, string Reason)
    : DomainError($"Validation failed for '{Field}': {Reason}");

public record ForbiddenError(string Action, string Resource)
    : DomainError($"Not permitted to {Action} {Resource}.");

Read the full file on GitHub · 275 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. 6d ago First seen · 275 lines · 28 tokens per session scan A cbf7817512d9

Subscribe to this mod's changes

error-handling is a skill published in the GitHub repository zdanovichnick/dotnet-pilot (4 stars, last pushed 9d ago), licensed MIT. It adds 28 tokens to every session and 2,041 once invoked, about $0.0001 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-08-31.

Related

Other skills, from other repositories

meta-tags-optimizer

Optimize title tags, meta descriptions, Open Graph, and Twitter cards for maximum click-through rate. Generates multiple A/B test variations with character counting and SERP preview. Use when asked to "optimize title tag", "write meta description", "improve CTR", "Open Graph tags", "fix my meta tags", "social media…

nowork-studio/notfair-plugin · 91 tokens

google-ads-audit

Google Ads account audit and business context setup. Run this first — it gathers business information, analyzes account health, and saves context that all other ads skills reuse. Trigger on "audit my ads", "ads audit", "set up my ads", "onboard", "account overview", "how's my account", "ads health check", "what should…

nowork-studio/notfair-plugin · 114 tokens

sxo

Search Experience Optimization (SXO) — the bridge between SEO and UX/CRO. Audits the full journey from the SERP click to the on-page goal: SERP click-through factors (title/meta/rich results that win the click), then post-click experience signals that keep users and drive conversions — above-the-fold relevance and…

nowork-studio/notfair-plugin · 235 tokens

brooks-sweep

Full-sweep mode: runs a unified analysis across all quality dimensions — code decay, architecture, tech debt, and test quality — then applies fixes directly to the codebase. Safe changes are auto-applied; risky changes are confirmed before execution. Drawing on twelve classic engineering books. Triggers when: user…

hyhmrright/brooks-lint · 178 tokens

architecture-refiner

Facilitate a structured conversation to define architecture principles for a repository. Supports multiple architecture styles: clean architecture (default), hexagonal / ports & adapters, modular monolith, or custom. Produces a formal architecture document that the corresponding atom will use. Use when setting up a…

techygarg/lattice · 114 tokens

content-repurposer

Adapt content across platforms with tone/format shifting — blog to social, long to short, text to visual outline. Use when repurposing content for different channels, audiences, or formats.

travisjneuman/.claude · 43 tokens