What problem does it solve?
This Skill provides concise, opinionated rules and examples to ensure C# projects use correct exception types, guard clauses, try/catch patterns, global error handling, and RFC-compliant ProblemDetails responses, reducing inconsistent error handling and fragile APIs.
Core Features & Use Cases
- Standardize when to throw exceptions versus return values and promote guard clauses at method entry to avoid nested control flow.
- Recommend specific exception types, best practices for custom exceptions, proper rethrowing, and forbidding empty catch blocks.
- Guide ASP.NET Core global error handling with IExceptionHandler, ProblemDetails serialization, handler chains, and async/cancellation handling.
- Common uses: code reviews, API refactors, implementing consistent error-response layers, and adopting the Result Pattern in services.
Quick Start
Review this ASP.NET Core endpoint and refactor its exception handling to use guard clauses, correct exception types, proper rethrowing, and standardized ProblemDetails responses.