microsoft-extensions
Installation
SKILL.md
Microsoft.Extensions for .NET
Trigger On
- wiring dependency injection, configuration, logging, or options
- introducing Generic Host patterns into non-web .NET apps
- cleaning up service registration, typed HTTP clients, or shared infrastructure code
Workflow
- Prefer the Generic Host for apps that need configuration, DI, logging, hosted services, or coordinated startup.
- Keep service registration predictable: composition at the edge, concrete implementations hidden behind interfaces only where that abstraction buys flexibility.
- Use options binding for structured configuration and validate configuration at startup when bad settings would fail later at runtime.
- Prefer
IHttpClientFactoryand typed or named clients for outbound HTTP instead of ad-hoc singleton or per-callHttpClientusage. - Use logging categories and config-driven log levels rather than scattered ad-hoc logging behavior.
- For Kubernetes-hosted services, prefer the stable
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Kubernetespackage from the 10.7+ line when CPU/memory request and limit metrics should come from pod resource quotas. - Avoid building mini-frameworks over Microsoft.Extensions unless the repo genuinely needs reusable composition primitives.