aspnet-core
/aspnet-core
Expert ASP.NET Core assistance covering Minimal APIs, Controller routing, Entity Framework Core, middleware, and dependency injection. Use when building enterprise .NET backend APIs and cloud services.
- Author
- G1Joshi ↗
- Repository
- Agent-Skills ↗
- Licence
- MIT
- Last repository change
- 01.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Expert ASP.NET Core assistance covering Minimal APIs, Controller routing, Entity Framework Core, middleware, and dependency injection. Use when building enterprise .NET backend APIs and cloud services.
Original author description
Expert ASP.NET Core assistance covering Minimal APIs, Controller routing, Entity Framework Core, middleware, and dependency injection. Use when building enterprise .NET backend APIs and cloud services.
How it works
- When to Use
- Quick Start
- Core Concepts
- Common Patterns
- Best Practices
- Troubleshooting
- References
SKILL.md preview
---
name: aspnet-core
description: Expert ASP.NET Core assistance covering Minimal APIs, Controller routing, Entity Framework Core, middleware, and dependency injection. Use when building enterprise .NET backend APIs and cloud services.
---
# ASP.NET Core
Cross-platform, high-performance framework for building modern web apps.
## When to Use
- **High-Performance Enterprise Backends**: Developing mission-critical APIs, microservices, and gRPC services on .NET 8 / 9.
- **Cloud-Native Containerized Applications**: Microservices deployed to Kubernetes, Azure Container Apps, or AWS ECS.
- **Real-Time Bidirectional Communication**: Scalable WebSocket and SSE apps using SignalR.
- **Full-Stack C# Web Development**: Blazor Server, Blazor WebAssembly, and Minimal APIs with C# 13.
## Quick Start
```csharp
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
```
## Core Concepts
### Minimal APIs with Typed Results & OpenAPI
Lightweight, high-performance endpoint mapping with zero controller ceremony:
```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<IOrderRepository, InMemoryOrderRepository>();
var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();
app.MapGet("/api/orders/{id:guid}", async (Guid id, IOrderRepository repo) =>
{
var order = await repo.GetByIdAsync(id);
return order is not null
? Results.Ok(order)
: Results.NotFound(new { message = $"Order {id} not found" });
})
.WithName("GetOrderById")
.Produces<Order>(StatusCodes.Status200OK)
.Produces(StatusCodes.Status404NotFound);
app.Run();
```
### Dependency Injection, Options Pattern & Configuration
Strongly typed configuration with validation:
```csharp
public class DatabaseOptions
{
public const string SectionName = "Database";
public required string ConnectionString { get; set; }
public int MaxPoolSize { get; set; } = 100;
}
// In Program.cs:
builder.Services.AddOptions<DatabaseOptions>()
.BindConfiguration(DatabaseOptions.SectionName)
.ValidateDataAnnotations()
.ValidateOnStart();
// In Service:
public class OrderService(IOptions<DatabaseOptions> options, ILogger<OrderService> logger)
{
private readonly DatabaseOptions _options = options.Value;
}
```
### Global Error Handling Middleware & Problem Details
Standardized RFC 7807 error responses:
```csharp
app.UseExceptionHandler(exceptionHandlerApp =>
{
exceptionHandlerApp.Run(async context =>
{
var exceptionHandlerPathFeature = context.Features.Get<IExceptionHandlerPathFeature>();
var exception = exceptionHandlerPathFeature?.Error;
var problemDetails = new ProblemDetails
{
Status = StatusCodes.Status500InternalServerError,
Title = "An unexpected error occurred",
Detail = exception?.Message,
Instance = context.Request.Path
};
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
context.Response.ContentType = "application/problem+json";
await context.Response.WriteAsJsonAsync(problemDetails);
});
});
```
## Common Patterns
### Minimal API Endpoint Group with Validation
**Problem**: Controller-heavy boilerplate for simple microservice CRUD endpoints.
**Solution**:
Use ASP.NET Core Minimal APIs with Route Groups:
```csharp
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
var users = app.MapGroup("/api/users");
users.MapGet("/", async (AppDbContext db) =>
await db.Users.AsNoTracking().ToListAsync());
users.MapPost("/", async (CreateUserDto dto, AppDbContext db) => {
var user = new User { Name = dto.Name, Email = dto.Email };
db.Users.Add(user);
await db.SaveChangesAsync();
return Results.Created($"/api/users/{user.Id}", user);
});
app.Run();
```
## Best Practices
**Do**:
- Use Minimal APIs for microservices to maximize throughput and minimize cold-start latency.
- Return `IResult` / `TypedResults` from endpoints for compile-time response verification.
- Use `IHttpClientFactory` with Polly resilience pipelines for external HTTP calls.
- Enable AOT (Ahead-of-Time) compilation (`PublishAot=true`) for microservices to slash memory footprint.
**Don't**:
- Call `.Result` or `.Wait()` on async Tasks; always use `await` to prevent thread pool starvation.
- Register transient services in singletons without scoping via `IServiceScopeFactory`.
- Log sensitive credentials or PII; configure logging sanitization filters.
## Troubleshooting
| Error | Cause | Solution |
| :--------------------------------------------------------------------- | :------------------------------------------------------------------- | :--------------------------------------------------------------------------- |
| `InvalidOperationException: Unable to resolve service for type ...` | Service not registered in DI container. | Register service in `builder.Services.AddScoped<IService, Service>()`. |
| `System.Text.Json.JsonException: A possible object cycle was detected` | Circular reference in Entity Framework navigation properties. | Configure `ReferenceHandler.IgnoreCycles` in JSON options or return DTOs. |
| `HTTP 500.30 - ANCM In-Process Start Failure` | Startup exception during application bootstrapping in IIS / Kestrel. | Inspect `stdoutLogEnabled="true"` in web.config or review event viewer logs. |
## References
- [ASP.NET Core Docs](https://learn.microsoft.com/en-us/aspnet/core/)
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · G1Joshi/Agent-Skills | 100 | MIT |
| managedcode/dotnet-skills | 100 | MIT |
| Tyler-R-Kendrick/agent-skills | 100 | MIT |
| ar4mirez/samuel | 100 | MIT |
| claude-dev-suite/claude-dev-suite | 95 | MIT |
| openai/skills | 85 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 0455560acb41 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90dotnet-backend-patterns
Provides .NET and ASP.NET Core patterns for REST APIs, Entity Framework, dependency injection, and middleware. Use when working with C# files (*.cs, *.csproj) or when the user mentions .NET, ASP.NET Core, C#, or Entity Framework. - 100csharp-aspnet-core-web-api
Use this skill when building cross-platform, high-throughput REST APIs and minimal APIs using C# and ASP.NET Core. - 96aspnet-rest-apis
Guidelines for building REST APIs with ASP.NET Triggers on: **/*.cs, **/*.json - 95aspnet-minimal-api
ASP.NET Core Minimal API endpoints, route groups, filters, and typed results. Covers modern .NET 8+ endpoint patterns. USE WHEN: user mentions "Minimal API", "MapGet", "MapPost", "route groups", "endpoint filters", ".NET minimal", "lambda endpoints" DO NOT USE FOR:… - 100dotnet-idioms
.NET 8+ framework architecture: Minimal APIs, EF Core data access, IOptions configuration, middleware pipelines, and WebApplicationFactory testing. Use when building ASP.NET Core services, Web APIs, or .NET cloud backends. Pair with csharp-idioms. - 100csharp-developer
Use this agent when building ASP.NET Core web APIs, cloud-native .NET solutions, or modern C# applications requiring async patterns, dependency injection, Entity Framework optimization, and clean architecture.