golang-uber-dig

Generates Wire-style Go code for dependency injection using the asha.

Updated May 28, 2026
One-click install
npx skills add https://github.com/vanstinator/semantic-search --skill golang-uber-dig-vanstinator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-uber-dig
Source: https://github.com/vanstinator/semantic-search/tree/main/.agents/skills/golang-uber-dig
Command: npx skills add https://github.com/vanstinator/semantic-search --skill golang-uber-dig-vanstinator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you implement correct, maintainable dependency injection in Go using uber-go/dig, so your application components can be composed cleanly at startup without manual plumbing.

Core Features & Use Cases

  • Provide/Invoke graph wiring: Register constructors with Provide and resolve runtime dependencies with Invoke, with clear construction-error behavior.
  • Parameter and result objects: Use dig.In and dig.Out to keep constructor signatures readable while supporting optional dependencies, named values, and grouped results.
  • Practical DI patterns: Disambiguate duplicate types with dig.Name, aggregate many implementations with value groups, expose interfaces via dig.As, and structure request-level isolation using dig scopes.
  • Startup correctness guidance: Use container options like DryRun, DeferAcyclicVerification, and RecoverFromPanics to validate graphs early and handle constructor failures safely.

Quick Start

Use the golang-uber-dig skill to generate a dig container setup that uses dig.In parameter objects, dig.Name (or dig.Out result tags) for multiple *sql.DB instances, and a group-based dig.Out for assembling route handlers into a single consumer.

Frequently Asked Questions about golang-uber-dig

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

FAQPage Schema
How do I wire multiple constructors into a dependency graph in Go?

Use uber-go/dig to register constructors with Provide and resolve runtime dependencies through Invoke, building a typed object graph at application startup without manual plumbing.

How do I handle optional or named dependencies in Go dependency injection?

Apply dig.In parameter objects with optional and name tags to manage optional dependencies, disambiguate duplicate types with dig.Name, and keep constructor signatures readable using dig.Out result objects.

Can I expose interfaces instead of concrete types when using dig in Go?

Yes, use dig.As to expose interfaces from concrete constructor returns, enabling multiple database setups or HTTP server wiring where consumers depend on abstractions rather than implementations.

How do I validate a dig dependency graph before running my Go application?

Use the DryRun container option to validate the entire dependency graph at startup without executing constructors, catching missing dependencies and cycles early before production deployment.

What is the best way to isolate request-scoped dependencies in Go with dig?

Use dig scopes to structure request-level isolation, creating scoped containers that provide request-specific locals while sharing singleton dependencies from the root container across concurrent requests.

Why am I getting dig-wrapped dependency path errors in my Go application?

Dig wraps construction errors with full dependency paths to show which constructor failed and what it needed, helping you interpret failures when Provide or Invoke cannot resolve a required type in the graph.