What problem does it solve?
This Skill helps you implement dependency injection in Go by wiring complex object graphs with uber-go/dig, so you can avoid tangled constructor signatures and reduce wiring bugs at startup.
Core Features & Use Cases
- Reflection-based DI container wiring: Use dig.New with Provide/Invoke to register constructors lazily and resolve dependencies during activation.
- Cleaner composition with parameter and result objects: Use dig.In and dig.Out to group many dependencies and return multiple related values from one constructor.
- Practical graph disambiguation and aggregation: Use dig.Name to manage multiple providers of the same type, and use value groups (including group flattening) for route handlers, migrations, or worker sets.
- Safer production behavior: Prefer dig.RecoverFromPanics and dig.DryRun(true) to validate wiring and convert constructor panics into typed failures instead of crashing.
- Best-practice architecture guidance: Keep the container at the composition root and inject only typed dependencies into business code to preserve testability.
Quick Start
Ask the AI to generate a dig wiring example for your Go service that uses dig.In for a multi-dependency constructor, uses dig.Name for two *sql.DB instances, and validates the graph with dig.DryRun(true) in a unit test.