minimal-api
Installation
SKILL.md
Minimal APIs (.NET 10)
Core Principles
- Minimal APIs are the default — Use controllers only when migrating legacy code. Minimal APIs are lighter, faster, and compose well with any architecture style.
- Group endpoints with
MapGroup— Never scatter individualMapGet/MapPostcalls inProgram.cs. Group related endpoints together. - Use
TypedResultsfor OpenAPI —TypedResults.Ok(value)gives you compile-time type safety AND correct OpenAPI documentation.Results.Ok(value)does not. - Metadata over comments — Use
.WithName(),.WithTags(),.WithSummary()to document endpoints. The metadata feeds into OpenAPI specs.
Patterns
Endpoint Group Auto-Discovery (Required Pattern)
Every endpoint group lives in its own file and implements IEndpointGroup. A single app.MapEndpoints() call in Program.cs discovers and registers all groups automatically. Program.cs never changes when you add new endpoint groups.