What problem does it solve? Configuring dependency injection in .NET often leads to subtle bugs like captive dependencies, incorrect service lifetimes, and unorganized Program.cs files. This Skill provides proven patterns for registering, resolving, and organizing services with the built-in Microsoft.Extensions.DependencyInjection container. ## Core Features & Use Cases - Service Lifetime Management: Guidance on Transient, Scoped, and Singleton lifetimes, including how to avoid captive dependencies using IServiceScopeFactory and enable scope validation. - Advanced Registration Patterns: Keyed services (net8.0+), factory delegates, multiple implementations via IEnumerable, TryAdd for libraries, and decoration with manual wiring or the Scrutor library. - Hosted Services: Patterns for BackgroundService workers and IHostedService startup hooks with proper scope handling and exception management. - Use Case: When building an ASP.NET Core order processing API, use this Skill to register repositories and services with correct lifetimes, add a background queue processor worker, and organize all registrations into clean extension methods. ## Quick Start Ask the AI to register an order repository and service with scoped lifetime, add a background worker using BackgroundService, and organize the registrations into an extension method for Program.cs.