What problem does it solve?
Many Angular applications suffer from inconsistent service lifecycles, incorrect providedIn scopes, awkward dependency patterns, and fragile shared state management; this skill provides concrete guidance to align services with modern Angular DI patterns and reduce bugs and memory leaks.
Core Features & Use Cases
- Provide clear DI guidance: advice on when to use providedIn: 'root', providedIn: 'any', or module-specific providers to control service lifetime.
- Modern injection patterns: recommendations for using the inject() function versus constructor injection and when to apply factory providers for configurable services.
- State and lazy-loading strategies: patterns for shared state using signals, lazy-service lifecycles, and examples for converting legacy services to signal-backed services.
- Use Case: Migrate a legacy DataService to use inject(), set the correct providedIn scope for a lazily loaded feature module, and implement a LoggerService via a factory provider that reads environment flags.
Quick Start
Review my Angular service and provide a prioritized list of dependency injection improvements, recommended providedIn scope changes, and example refactors using inject(), factory providers, and signals.