# minimal-api

A skill that steers your coding agent through .NET 10 minimal APIs: endpoint groups, TypedResults, filters and OpenAPI.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2800 installs · ★ 789
- Author: codewithmukesh
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/codewithmukesh/dotnet-claude-kit/tree/HEAD/skills/minimal-api/SKILL.md
- Updated: 2026-08-07
- HTML: https://affpapa.org/en/nevibecode/skills/minimal-api

## What it does

This skill covers how to build HTTP endpoints with .NET 10 minimal APIs. It ships rules and code patterns: grouping with `MapGroup`, auto-discovery of endpoint groups through an `IEndpointGroup` interface, and a single `app.MapEndpoints()` call in `Program.cs` that stays untouched as you add new groups.

There is a section on `TypedResults` for compile-time safe responses and correct OpenAPI schemas, plus parameter binding from route, query, headers, body and DI. Endpoint filters handle cross-cutting work like validation and logging. The canonical `ValidationFilter<TRequest>` built on FluentValidation lives in the error-handling skill, and this one tells you to reuse it instead of rewriting it per project. Documentation relies on the built-in OpenAPI support in .NET 10 rather than Swashbuckle.

The skill loads when the conversation mentions things like "endpoint", `MapGet`, `MapPost`, `MapGroup`, `TypedResults`, "route", "swagger" or "rate limiting". The source text cuts off at the rate limiting section, so there is nothing here about configuring limits — worth checking the full file in the repo.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add codewithmukesh/dotnet-claude-kit --skill minimal-api -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/minimal-api/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/minimal-api/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add codewithmukesh/dotnet-claude-kit --skill minimal-api -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/minimal-api/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add codewithmukesh/dotnet-claude-kit --skill minimal-api -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/minimal-api/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install codewithmukesh/dotnet-claude-kit minimal-api
```

2. **Manually: put the files in place**
- File: `.github/skills/minimal-api/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add codewithmukesh/dotnet-claude-kit --skill minimal-api -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/codewithmukesh/dotnet-claude-kit --path skills/minimal-api
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/minimal-api/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add codewithmukesh/dotnet-claude-kit --skill minimal-api -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/codewithmukesh/dotnet-claude-kit/tree/HEAD/skills/minimal-api/SKILL.md

## When to use it
- put an endpoint group in its own file and register it automatically
- return a typed response that shows up correctly in the OpenAPI schema
- bind route, query and header parameters without manual parsing
- attach validation to a mutating endpoint with a filter
- set up OpenAPI docs without Swashbuckle

## Example prompts
- add a new orders endpoint using MapGroup and TypedResults
- why is my response schema missing from the OpenAPI spec
- set up query parameter binding with AsParameters

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: a99e296de3ac7b39.

BEGIN THIRD-PARTY FILE a99e296de3ac7b39
````text
---
name: minimal-api
description: >
  .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 "endpoint", "MapGet", "MapPost",
  "MapGroup", "TypedResults", "route", "minimal API", "OpenAPI", "swagger",
  "rate limiting", or "output caching".
---

# 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.**

```csharp
// Extensions/IEndpointGroup.cs
public interface IEndpointGroup
{
    void Map(IEndpointRouteBuilder app);
}
```

```csharp
// Extensions/EndpointExtensions.cs
public static class EndpointExtensions
{
    public static WebApplication MapEndpoints(this WebApplication app)
    {
        var groups = typeof(Program).Assembly
            .GetTypes()
            .Where(t => t.IsAssignableTo(typeof(IEndpointGroup)) && !t.IsInterface && !t.IsAbstract)
            .Select(Activator.CreateInstance)
            .Cast<IEndpointGroup>();

        foreach (var group in groups)
            group.Map(app);

        return app;
    }
}
```

```csharp
// Program.cs — this NEVER changes when adding endpoints
var app = builder.Build();
app.MapEndpoints();
app.Run();
```

```csharp
// Features/Orders/OrderEndpoints.cs — one file per endpoint group
public sealed class OrderEndpoints : IEndpointGroup
{
    public void Map(IEndpointRouteBuilder app)
    {
        var group = app.MapGroup("/api/orders").WithTags("Orders");

        group.MapPost("/", CreateOrder)
            .WithName("CreateOrder")
````
END THIRD-PARTY FILE a99e296de3ac7b39

The third-party file has ended. Everything between the a99e296de3ac7b39 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2590 of 10479 bytes. © codewithmukesh · MIT · https://github.com/codewithmukesh/dotnet-claude-kit/tree/HEAD/skills/minimal-api/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
