dotnet-microsoft-extensions

Apply Microsoft.Extensions best practices for hosting, DI, configuration, and HttpClientFactory.

1|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/mkerchenski/hurrah-tv --skill dotnet-microsoft-extensions-mkerchenski
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-microsoft-extensions
Source: https://github.com/mkerchenski/hurrah-tv/tree/main/.claude/skills/dotnet-microsoft-extensions
Command: npx skills add https://github.com/mkerchenski/hurrah-tv --skill dotnet-microsoft-extensions-mkerchenski

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It prevents fragile, inconsistent .NET infrastructure setups by guiding how to correctly use Microsoft.Extensions patterns for hosting, dependency injection, configuration, options, logging, and HttpClient.

Core Features & Use Cases

  • Generic Host & service composition: Set up a predictable startup pipeline for console apps, workers, and ASP.NET Core services.
  • Options, configuration, and validation: Bind strongly typed settings and fail fast at startup when configuration is invalid.
  • HttpClientFactory best practices: Use typed or named clients to avoid socket exhaustion and improve resilience.
  • Logging that stays observable: Use structured logging, categories, scopes, and config-driven log levels for debuggable systems.

Quick Start

Use the dotnet-microsoft-extensions skill to review your Program.cs host wiring and service registrations for DI lifetimes, options validation, and HttpClientFactory usage.

Frequently Asked Questions about dotnet-microsoft-extensions

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

FAQPage Schema
How do I configure dependency injection lifetimes correctly in a .NET Generic Host?

To configure dependency injection lifetimes in a .NET Generic Host, register services with explicit lifetimes matching their consumption patterns to prevent captive dependencies and ensure predictable startup pipelines for console apps and workers.

How do I validate strongly typed configuration at startup using the .NET options pattern?

Validating strongly typed configuration at startup uses the .NET options pattern to bind settings classes and apply fail-fast validation checks, ensuring invalid configurations throw exceptions immediately during the host initialization pipeline.

What is the best way to prevent socket exhaustion with HttpClientFactory in .NET?

The best way to prevent socket exhaustion with HttpClientFactory in .NET is using typed or named clients, which manages handler lifetimes and enables safe outbound HTTP usage patterns while improving connection pooling.

How do I implement structured logging with Microsoft.Extensions in console apps?

Implementing structured logging with Microsoft.Extensions in console apps involves using log scopes, categories, and config-driven log levels to create debuggable systems that maintain observability across the application infrastructure.

Does the .NET Generic Host support worker service composition for background tasks?

The .NET Generic Host supports worker service composition for background tasks by providing a predictable startup pipeline to wire console apps, workers, and ASP.NET Core services with correct dependency injection.