dotnet-webapi

Creates ASP.NET Core Web API endpoints with OpenAPI metadata and error handling.

1|Updated Jul 27, 2026
One-click install
npx skills add https://github.com/FittyAr/Cardscape --skill dotnet-webapi-fittyar
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-webapi
Source: https://github.com/FittyAr/Cardscape/tree/main/.agents/skills/dotnet-webapi
Command: npx skills add https://github.com/FittyAr/Cardscape --skill dotnet-webapi-fittyar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building ASP.NET Core Web APIs involves many easy-to-miss conventions: correct HTTP status codes, OpenAPI documentation, DTO design, cancellation support, and centralized error handling. This Skill guides the creation and modification of Web API endpoints so they follow consistent HTTP semantics and project conventions without manual checklist work. ## Core Features & Use Cases - Endpoint Implementation: Adds controller-based or minimal API endpoints matching the existing project style, with correct status codes, TypedResults, and CancellationToken forwarding. - OpenAPI & DTO Conventions: Wires up built-in .NET 9+ OpenAPI support, XML doc comments, string enum serialization, and sealed record DTOs with validation. - Error Handling & Testing: Configures RFC 7807 Problem Details via IExceptionHandler middleware and generates .http request files for manual verification. - Use Case: Ask the AI to add a CRUD endpoint for a new Product resource, and it produces the DTOs, service layer with interface, minimal API mappings with OpenAPI metadata, global exception handling, and a .http test file that builds cleanly. ## Quick Start Add a new REST endpoint to my ASP.NET Core project for managing products, including DTOs, OpenAPI documentation, error handling, and a .http test file.

Frequently Asked Questions about dotnet-webapi

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

FAQPage Schema
How do I add a new endpoint to an ASP.NET Core Web API?▼

First detect whether the project uses controllers or minimal APIs, then follow that style. Define sealed record request and response DTOs, implement the endpoint with correct status codes and CancellationToken, and add OpenAPI metadata like WithName, WithSummary, and Produces.

Should I use controllers or minimal APIs in ASP.NET Core?▼

Match whatever style the project already uses and never mix both in one project. For brand-new projects, default to minimal APIs unless controllers are explicitly requested, organizing endpoints in static classes with a Map method per resource.

Does .NET 10 need Swashbuckle for OpenAPI documentation?▼

No. .NET 9 and later include built-in OpenAPI support via AddOpenApi() and MapOpenApi(), and Swashbuckle packages have known compatibility issues with these versions. Swashbuckle remains acceptable only for projects targeting .NET 8 or earlier.

Why does TypedResults cause CS1593 in minimal API handlers?▼

The error occurs when TypedResults.Ok and TypedResults.NotFound appear in a ternary without an explicit return type, since they share no common base type. Annotate the handler with Task<Results<Ok<T>, NotFound>> so the compiler can infer the delegate correctly.

How do I return consistent error responses from an ASP.NET Core API?▼

Register AddProblemDetails() and UseExceptionHandler(), then implement IExceptionHandler to map exception types to status codes and write RFC 7807 Problem Details JSON. Place the handler class in a Middleware folder and avoid leaking exception messages to clients.

When should I not use this Web API guidance?▼

It does not apply to gRPC services, SignalR hubs, Blazor or frontend work, or EF Core query optimization, which is covered by the optimizing-ef-core-queries skill. It also excludes general C# style questions unrelated to HTTP APIs.