minimal-api

.NET 10 minimal APIs — the default for building HTTP endpoints. Covers MapGroup, endpoint filters, TypedResults, OpenAPI metadata, parameter binding, and route conventions. Load this skill when creating API endpoints, configuring routing, setting up OpenAPI documentation, or when the user mentions "

By codewithmukesh · 1,193 installs

npx skills add codewithmukesh/dotnet-claude-kit --skill minimal-api

Source repository · Upstream listing

Minimal APIs (.NET 10) Core Principles 1. Minimal APIs are the default — Use controllers only when migrating legacy code. Minimal APIs are lighter, faster, and compose well with any architecture style. 2. Group endpoints with MapGroup — Never scatter individual MapGet / MapPost calls in Program.cs . Group related endpoints together. 3. Use TypedResults for OpenAPI — TypedResults.Ok(value) gives you compile time type safety AND correct OpenAPI documentation. Results.Ok(value) does not. 4. 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. TypedResults for Type Safe Responses TypedResults provides compile time guarantees and automatic OpenAPI schema generation. Parameter Binding .NET 10 minimal APIs bind parameters from route, query, header, body, and DI automatically. Endpoint Filters Filters are the minimal API equivalent of action filters. Use them for cross cutting concerns like validation, logging, and idempotency checks. The canonical ValidationFilter<TRequest implementation (FluentValidation, resolves the validator from DI and skips gracefully when none is registered) lives in the error handling skill — use that one, don't re implement it per project. OpenAPI / Swagger Configuration .NET 10 has built in OpenAPI support. Use it instead of Swashbuckle. Rate Limiting Output Caching Anti patterns Don't Put Endpoints in Program.cs Don't Use Untyped Results Don't Return Domain Entities Directly Decision Guide Scenario Recommendation New HTTP API IEndpointGroup per feature + app.MapEndpoints() auto discovery Existing MVC project Keep controllers, migrate incrementally OpenAPI documentation Use TypedResults + .WithName() + .WithSummary() Request validation Endpoint filter with FluentValidation Authentication/authorization .RequireAuthorization("PolicyName") on group or endpoint Rate limiting AddRateLimiter + .RequireRateLimiting() Response caching AddOutputCache + .CacheOutput() Complex model binding [AsParameters] with a record type