dependency-injection-review

Audit codebases for DryIoc dependency injection issues during code reviews.

13|2|Updated Jul 17, 2023
One-click install
npx skills add https://github.com/kateusz/GameEngine --skill dependency-injection-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dependency-injection-review
Source: https://github.com/kateusz/GameEngine/tree/main/.claude/skills/dependency-injection-review
Command: npx skills add https://github.com/kateusz/GameEngine --skill dependency-injection-review

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill audits code for strict adherence to the game engine's Dependency Injection (DI) architecture using DryIoc. It ensures all services use constructor injection, identifies and flags static singleton violations, validates service registration patterns, and helps resolve complex issues like circular dependencies, leading to a more maintainable and testable codebase.

Core Features & Use Cases

  • Constructor Injection Validation: Verifies that all dependencies are injected via constructors, not properties or service locators.
  • Static Singleton Detection: Identifies and flags forbidden static singletons, enforcing the "DI-first" principle.
  • Service Lifetime Guidelines: Provides best practices for Singleton vs. Transient service registration in Program.cs.
  • Circular Dependency Resolution: Offers strategies (events, shared dependencies) to break circular dependencies.
  • Use Case: When reviewing a new feature module, use this Skill to ensure that all new services are correctly registered in DryIoc, use constructor injection, and do not introduce any static singletons or circular dependencies that could destabilize the application.

Quick Start

Review the AnimationSystem class for proper constructor injection and ensure its dependencies are correctly registered as singletons in Program.cs.

Frequently Asked Questions about dependency-injection-review

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

FAQPage Schema
How do I validate constructor injection in my C# codebase?

Constructor injection validation checks that all dependencies are injected through constructors rather than properties or service locators. This Skill verifies your services follow the constructor injection pattern, ensuring proper dependency management and testability across your DryIoc-configured application.

How do I detect and remove static singletons from my code?

Static singleton detection identifies forbidden static access patterns that violate DI-first principles. This Skill flags static singletons in your codebase and guides you toward proper DryIoc registration, replacing static access with injected dependencies for maintainability.

What's the best way to resolve circular dependencies in DryIoc?

Circular dependency resolution offers strategies like event-based communication or shared intermediate dependencies to break cycles. This Skill detects circular dependencies in your service graph and recommends architectural patterns to eliminate them.

How do I ensure correct service lifetime configuration in Program.cs?

Service lifetime guidelines define when to use Singleton versus Transient registration in DryIoc. This Skill validates your Program.cs registrations against best practices, ensuring services have appropriate lifecycles for your application's requirements.

Can I use this during code reviews for new feature modules?

Yes, this Skill audits new modules during code review to verify constructor injection usage, validate DryIoc registration patterns, detect static singletons, and identify circular dependencies, ensuring architectural compliance before integration.

What happens if my services don't pass dependency injection validation?

Failed validation identifies specific violations: missing constructor injection, static singletons, improper registrations, or circular dependencies. This Skill flags each issue and provides guidance to refactor services into compliant DI patterns.