aspnet-api-patterns

Define ASP.NET Core API patterns for controllers, minimal APIs, middleware, and JWT authentication.

4|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/zdanovichnick/dotnet-pilot --skill aspnet-api-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: aspnet-api-patterns
Source: https://github.com/zdanovichnick/dotnet-pilot/tree/main/skills/aspnet-api-patterns
Command: npx skills add https://github.com/zdanovichnick/dotnet-pilot --skill aspnet-api-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you avoid inconsistent or fragile ASP.NET Core API implementations by providing practical guidance on choosing controller vs minimal API, structuring middleware, handling errors, and setting up authentication correctly.

Core Features & Use Cases

  • Controller vs Minimal API guidance: Decide between Controllers and Minimal APIs based on team familiarity, OpenAPI support, filter pipeline needs, and organization preferences.
  • Production-ready error handling: Use a global exception handler and RFC 7807 ProblemDetails for consistent API responses.
  • Authentication and middleware ordering: Apply JWT Bearer authentication and ensure middleware order is correct for reliable behavior.

Quick Start

Ask the assistant to generate a consistent ASP.NET Core API startup configuration and sample endpoints using controllers with global exception handling, JWT authentication, and the correct middleware order.

Frequently Asked Questions about aspnet-api-patterns

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

FAQPage Schema
How do I implement global exception handling in ASP.NET Core APIs with ProblemDetails?

To implement global exception handling in ASP.NET Core, use a global exception handler that returns RFC 7807 ProblemDetails. This ensures your API provides consistent error responses across all endpoints.

What's the difference between controllers and minimal APIs in ASP.NET Core?

Choose controllers over minimal APIs when you need the filter pipeline, extensive OpenAPI support, or team familiarity. Minimal APIs suit lightweight endpoint definitions without controller overhead.

How do I set up JWT Bearer authentication in an ASP.NET Core API?

Set up JWT Bearer authentication in ASP.NET Core by configuring JWT token validation. This enforces secure access control across your API endpoints.

Why does middleware ordering matter around authentication and authorization in ASP.NET Core?

Middleware ordering matters because authentication must precede authorization in the ASP.NET Core pipeline. Correct ordering ensures reliable security behavior and proper access enforcement.

Can I scaffold a complete ASP.NET Core API startup configuration with secure endpoints?

Yes, you can scaffold a complete ASP.NET Core API startup configuration. It generates sample endpoints using controllers with global exception handling, JWT authentication, and correct middleware ordering.

When do I need ProblemDetails for API error responses in ASP.NET Core?

You need ProblemDetails when your ASP.NET Core API requires consistent, standardized error responses. This RFC 7807 format provides maintainable request and response structures for REST APIs.