Dotnet-skills dotnet-microsoft-extensions
Use the Microsoft.Extensions stack correctly across Generic Host, dependency injection, configuration, logging, options, HttpClientFactory, and other shared infrastructure patterns.
install
source · Clone the upstream repo
git clone https://github.com/managedcode/dotnet-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/managedcode/dotnet-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/catalog/Libraries/Microsoft-Extensions/skills/dotnet-microsoft-extensions" ~/.claude/skills/managedcode-dotnet-skills-dotnet-microsoft-extensions && rm -rf "$T"
manifest:
catalog/Libraries/Microsoft-Extensions/skills/dotnet-microsoft-extensions/SKILL.mdsource content
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
and typed or named clients for outbound HTTP instead of ad-hoc singleton or per-callIHttpClientFactory
usage.HttpClient - Use logging categories and config-driven log levels rather than scattered ad-hoc logging behavior.
- Avoid building mini-frameworks over Microsoft.Extensions unless the repo genuinely needs reusable composition primitives.
Deliver
- clean host wiring and service registration
- configuration and logging that are observable and testable
- infrastructure code that fits naturally with the .NET stack
Validate
- service lifetimes are correct
- configuration is strongly typed where it matters
- host setup remains easy to debug and reason about
References
- patterns.md - DI patterns, Configuration patterns, Options pattern, Logging patterns, HttpClientFactory patterns, Hosted Service patterns
- anti-patterns.md - Common mistakes with DI, configuration, options, logging, HttpClient, and hosted services