← ClaudeAtlas

golang-samber-dolisted

Maintain or extend Go dependency graphs built with `github.com/samber/do` or `github.com/samber/do/v2`, including providers, scopes, overrides, health checks, and shutdown. Use when implementing, migrating, testing, or diagnosing samber/do wiring and lifecycle behavior.
reagin/agent-skills · ★ 0 · Code & Development · score 63
Install: claude install-skill reagin/agent-skills
# samber/do dependency injection Work from the module path selected by the project. `github.com/samber/do` and `github.com/samber/do/v2` are different major-version contracts; inspect `go.mod`, imports, wrappers, and generated wiring before choosing API names. ## Map the graph Locate: - the root injector and any `Scope` calls; - `Provide*`, package-based registrations, names, aliases, and overrides; - the `Invoke*` roots that force construction; - constructors that open files, sockets, clients, workers, or timers; - health checks, signal handling, shutdown, and test clones. Keep injector access at composition boundaries. Providers can accept the injector as required by the library, while constructed domain services should normally receive typed dependencies. ## Select registration and lookup APIs Verify these families against the selected major version: | Need | Representative API | | --- | --- | | Lazy singleton | `Provide`, `ProvideNamed` | | Existing value | `ProvideValue`, `ProvideNamedValue` | | New value per lookup | `ProvideTransient`, named transient variant | | Grouped v2 registrations | `Package` with `Lazy`, `Eager`, `Transient`, or `Value` specs | | Typed lookup | `Invoke`, `InvokeNamed` | | Interface lookup or alias | `InvokeAs`, explicit `As` APIs | | Tagged struct population | `InvokeStruct` | Preserve lifetime, name, and scope when changing a registration. Interface lookup can become ambiguous when several concrete services satisfy the same interface;