aspnet-core

Build, debug, and review ASP.NET Core applications with correct middleware, security, and configuration patterns.

Updated May 2, 2026
One-click install
npx skills add https://github.com/hdeshev/pi-config --skill aspnet-core-hdeshev
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: aspnet-core
Source: https://github.com/hdeshev/pi-config/tree/main/agent/skills/aspnet-core
Command: npx skills add https://github.com/hdeshev/pi-config --skill aspnet-core-hdeshev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? ASP.NET Core projects frequently suffer from misordered middleware, misused HttpClient instances, leaked secrets in configuration, and subtle async or dependency injection bugs. This Skill provides structured guidance and reference patterns to build, debug, modernize, and review ASP.NET Core applications correctly on current .NET. ## Core Features & Use Cases - Middleware Pipeline Guidance: Enforces the canonical middleware order (exception handling, HTTPS redirection, routing, CORS, authentication, authorization, rate limiting, endpoints) and provides custom middleware patterns. - Security & Configuration Patterns: Covers JWT and cookie authentication, policy-based authorization, CORS, rate limiting, strongly-typed options with validation, and secret management via User Secrets or Key Vault. - Anti-Pattern Catalog: A detailed reference of common mistakes including socket exhaustion from new HttpClient(), sync-over-async deadlocks, captive dependencies, N+1 EF Core queries, and exposed exception details. - Use Case: When modernizing a legacy ASP.NET application to ASP.NET Core, use this Skill to restructure Program.cs, fix middleware ordering, replace raw HttpClient usage with IHttpClientFactory, and move secrets out of appsettings.json. ## Quick Start Review my ASP.NET Core project's Program.cs and fix any middleware ordering, security, or configuration issues.

Frequently Asked Questions about aspnet-core

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

FAQPage Schema
What is the correct middleware order in ASP.NET Core?▼

The canonical order is ExceptionHandler, HSTS, HttpsRedirection, StaticFiles, Routing, CORS, Authentication, Authorization, RateLimiting, ResponseCaching, custom middleware, then endpoints. Placing authentication before routing or exception handling last causes broken behavior.

How do I use HttpClient correctly in ASP.NET Core?▼

Use IHttpClientFactory via AddHttpClient instead of creating new HttpClient instances. Direct instantiation causes socket exhaustion, while static instances cache DNS indefinitely. The factory manages handler lifetimes and supports typed clients with Polly retry policies.

Should I use Minimal APIs or controller-based Web APIs?▼

Prefer Minimal APIs for new HTTP APIs unless you specifically need controller features like filters and model binding conventions. The Skill routes new HTTP API work to minimal-apis and controller APIs to web-api guidance.

Where should I store secrets in an ASP.NET Core app?▼

Never store secrets in appsettings.json committed to source control. Use User Secrets in development and environment variables or Azure Key Vault in production, loaded through the configuration builder.

Why does my ASP.NET Core app deadlock with async code?▼

Deadlocks and thread starvation come from sync-over-async patterns like calling .Result or .GetAwaiter().GetResult() on tasks. Make the full call chain async with await, and never use async void in middleware since exceptions crash the process.

When should I not use this ASP.NET Core guidance?▼

Do not use it for unrelated technology stacks or generic tasks that do not involve ASP.NET Core hosting, middleware, auth, routing, configuration, or deployment. It requires an existing ASP.NET Core project or solution to be applicable.