← Back to list

minimal-api-patterns
by michaellperry
⭐ 0🍴 0📅 Jan 23, 2026
SKILL.md
name: minimal-api-patterns description: Best practices for defining Endpoints, DTOs, and Validators using ASP.NET Core Minimal APIs.
Minimal API Patterns
Role Responsibilities
As an API Contract Guardian, you are responsible for:
- Contracts: Defining clear Request/Response DTOs in
GloboTicket.Application/DTOs. - Endpoints: Implementing
MapGroupdefinitions inGloboTicket.API/Endpoints/. - Services: Implementing Application Services that orchestrate Domain Entities.
- Validation: Ensuring all inputs are validated before processing.
Endpoint Structure
Grouping
- Use
MapGroupto organize related endpoints. - Apply common middleware (Auth, Versioning) at the group level.
public static WebApplication MapVenueEndpoints(this WebApplication app)
{
var venues = app.MapGroup("/api/venues")
.RequireAuthorization()
.WithTags("Venues");
venues.MapGet("/", GetAllVenues);
return app;
}
DTO Pattern
Separation of Concerns
- NEVER return Domain Entities directly from an endpoint.
- Always map to a specific DTO.
- Use
recordtypes for DTOs for immutability.
// Good
public record VenueDto(Guid Id, string Name, string Location);
// Bad
public class Venue : Entity { ... } // Do not return this!
Service Layer Integration
Injection
- Inject Application Services (
IVenueService) into endpoint delegates. - Keep endpoint logic thin; delegate business logic to the Service.
venues.MapPost("/", async (CreateVenueDto dto, IVenueService service) =>
{
var result = await service.CreateAsync(dto);
return Results.Created($"/api/venues/{result.Id}", result);
});
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon