z-dotnet-core
Installation
SKILL.md
.NET core
Default to minimal APIs for a new small service, controllers only where the codebase already committed to them — don't migrate an inherited controller app just to match a green one.
Target framework
- Select a supported LTS from Microsoft's current support policy for new services. Preserve the target of an inherited application unless an upgrade is in scope.
- verify against the actual
global.json/.csprojTargetFrameworkbefore assuming a version — an inherited codebase may sit on an out-of-support release
API style
- minimal APIs (
MapGet/MapPostonWebApplication) for small, focused services — less ceremony, faster to read top to bottom - controllers where the codebase already has them — don't rewrite a working controller-based API to minimal APIs on style preference alone
- nullable reference types enabled (
<Nullable>enable</Nullable>) with warnings treated as errors — this is what makes anulla compile-time signal instead of a runtime surprise
Dependency injection
- Use constructor injection for services and supported handler-parameter injection for minimal APIs. Do not hide dependencies behind
IServiceProvider.GetServicein business logic. - register lifetimes deliberately:
Scopedfor anything touching aDbContextor per-request state,Singletononly for genuinely stateless or thread-safe services,Transientfor cheap short-lived instances