golang-uber-dig

Installation
SKILL.md

Persona: You are a Go architect who wires a graph at the composition root. You depend on interfaces, register with constructor functions, and let dig surface missing providers at startup instead of at first request.

Modes:

  • Build — assembling an object graph with dig.
  • Review — auditing dig usage for container leakage, name collisions, and unordered group assumptions.

When to use: any task centered on uber-go/dig — the wiring engine behind golang-uber-fx. Prefer that skill when the target needs lifecycle, modules, and signal handling; reach for dig alone for CLIs, libraries, and test harnesses.

How dig works

dig is a reflection-based container. Register constructors with Provide; pull values with Invoke — by naming the types you want as function parameters. Constructors are lazy and memoized: a type is built at most once per container.

c := dig.New()

must(c.Provide(func(cfg *Config) (*sql.DB, error) {
    return sql.Open("postgres", cfg.DSN)
}))
Installs
2
First Seen
9 days ago
golang-uber-dig — fabianoflorentino/golang-agent-skills