A solid primer on Uber's reflection-based DI container, the engine that powers fx. The skill walks you through Provide/Invoke semantics, parameter and result objects with dig.In/dig.Out, named values, value groups, and the difference between dig (just wiring) and fx (wiring plus lifecycle). Best part is the practical advice: keep the container at the composition root, depend on interfaces, validate the graph in tests. The comparison table showing what fx adds on top of dig is genuinely helpful for choosing between them. If you're building a CLI tool or embedding DI into an existing app that manages its own lifecycle, this is the right pick. For long-running services that need signal handling and graceful shutdown, you want fx instead.

skills.sh installs
38K
GitHub stars
3.8K
last updated
Aug 21, 2026

Install

$ npx -y skills add samber/cc-skills-golang --skill golang-uber-dig --agent claude-code

Installs into .claude/skills of the current project.

Files

Persona: You are a Go architect wiring an application graph with dig. You keep the container at the composition root, depend on interfaces not concrete types, and treat constructor errors as first-class failures.

Using uber-go/dig for Dependency Injection in Go

Reflection-based DI toolkit, designed to power application frameworks (it is the engine behind uber-go/fx) and resolve object graphs during startup.

Official Resources:

This skill is not exhaustive — refer to library documentation and code examples for more information:

  • For Go package docs, symbols, versions, importers, and known vulnerabilities, → See samber/cc-skills-golang@golang-pkg-go-dev skill (godig), preferred over Context7 for Go package facts.
  • To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See samber/cc-skills-golang@golang-gopls skill (gopls).
  • Context7 remains a fallback for docs not indexed on pkg.go.dev.
go get go.uber.org/dig

dig vs. fx

Sponsors

Details

Repository
github.com/samber/cc-skills-golang
Category
Go
First seen
May 16, 2026

More from samber/cc-skills-golang

All 47

Recommended

More Go
1samber avatargolang-how-tosamber/cc-skills-golangGolang skills orchestrator — always active on any Golang coding, review, debug, or setup task. Reads the task context and loads the most relevant skills from sa37.9Kskills.sh installs
2samber avatargolang-lintersamber/cc-skills-golanggolang linter26.5Kskills.sh installs
3samber avatargolang-refactoringsamber/cc-skills-golangGolang refactoring — the safe, at-scale process for restructuring existing Go code: a coverage-adaptive safety net, tool-driven behavior-preserving transforms (12.9Kskills.sh installs
4github avatargo-mcp-server-generatorgithub/awesome-copilotGenerate a complete Go MCP server project with proper structure, dependencies, and implementation using the official github.com/modelcontextprotocol/go-sdk.9.2Kskills.sh installs
5affaan-m avatargolang-testingaffaan-m/everything-claude-codegolang testing8.4Kskills.sh installs
6affaan-m avatargolang-testingaffaan-m/eccGo testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices.6.2Kskills.sh installs