error-handling

Standardize .NET API error responses as RFC 9457 ProblemDetails.

1|Updated Apr 28, 2026
One-click install
npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill error-handling-trossitec
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/Trossitec/dotnet-claude-kit/tree/main/skills/error-handling
Command: npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill error-handling-trossitec

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you stop .NET APIs from returning inconsistent or leaky error responses by standardizing how validation, expected failures, and unexpected exceptions are represented to clients.

Core Features & Use Cases

  • Result pattern for expected failures: model business/lookup outcomes (e.g., “order not found”, “validation failed”) without throwing exceptions.
  • RFC 9457 ProblemDetails everywhere: consistently map failures to ProblemDetails with type, title, status, detail, and optional errors.
  • Global exception handling: capture unexpected crashes and convert them into safe ProblemDetails (with more detail in development only).
  • FluentValidation at the boundary: validate request DTOs using FluentValidation, typically via endpoint filters, and return ValidationProblem-style responses.

Quick Start

Load the error-handling skill when implementing API error contracts, request validation, or global exception handling so your endpoints return consistent RFC 9457 ProblemDetails responses.

Frequently Asked Questions about error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize .NET API error responses to RFC 9457 ProblemDetails?

To standardize .NET API error responses, map validation, expected business failures, and unexpected crashes to RFC 9457 ProblemDetails objects containing type, title, status, detail, and optional errors fields.

What is the best way to handle expected business failures without throwing exceptions in .NET?

The best way to handle expected business failures without throwing exceptions is implementing the Result pattern, modeling outcomes like validation failures or missing lookups, then mapping them directly to ProblemDetails responses.

How do I validate request DTOs using FluentValidation in .NET APIs?

You validate request DTOs using FluentValidation at the API boundary via endpoint filters, catching invalid inputs early and returning structured validation errors matching the ValidationProblem response format.

How does global exception handling prevent leaky error responses in .NET APIs?

Global exception handling prevents leaky error responses by capturing unexpected crashes and converting them into safe ProblemDetails objects, exposing detailed error information only during development environments.

Does the Result pattern work with TypedResults for consistent API errors?

Yes, the Result pattern works with TypedResults to ensure consistent API errors by modeling expected failures explicitly and mapping those outcomes into structured RFC 9457 ProblemDetails responses.