What problem does it solve?
Dependency injection misconfiguration causes subtle runtime failures, memory leaks, and stale data when service lifetimes and registrations are incorrect. This Skill helps teams diagnose lifetime mismatches, avoid captive dependencies, and choose correct registration and composition patterns so services behave reliably in production.
Core Features & Use Cases
- Lifetime guidance: Match singleton, scoped, and transient lifetimes to avoid captured scoped services and memory leaks.
- Composition patterns: Recommendations for keyed services, decorator pattern, factory delegates, and Scrutor convention-based registration to select implementations safely.
- Configuration and options: Best practices for strongly-typed options, validate-on-start, and injecting configuration without leaking mutable state.
- Use Case: Fix a bug where a singleton cache captures a scoped DbContext, implement multiple notification channels using keyed services, or refactor service registrations to follow convention-based scans.
Quick Start
Ask the AI to review your IServiceCollection registrations and identify lifetime mismatches, captive dependencies, and suggested refactorings.