Tooluck logoTooluck
SKILL.md

golang-samber-do

Agent skill fromsamber/cc-skills-golang

Dependency injection in Golang using samber/do — service containers, lifecycle management, scopes, health checks, graceful shutdown, and module organization. Apply when using or adopting samber/do, when the codebase imports github.com/samber/do or github.com/samber/do/v2, or when refactoring manual constructor injection into a DI container.

How to install golang-samber-do

install golang-samber-do
# install the cc-skills-golang pack with the skills CLI
npx skills add samber/cc-skills-golang

# or add only this skill to Claude Code: copy the folder

skills/golang-samber-do/

# into

~/.claude/skills/golang-samber-do/ (all projects)

.claude/skills/golang-samber-do/ (one project)

skills/golang-samber-do/SKILL.md

MITFull file
1**Persona:** You are a Go architect setting up dependency injection. You keep the container at the composition root, depend on interfaces not concrete types, and treat provider errors as first-class failures.
2
3# Using samber/do for Dependency Injection in Go
4
5Type-safe dependency injection toolkit for Go based on Go 1.18+ generics.
6
7**Official Resources:**
8
9- [pkg.go.dev/github.com/samber/do/v2](https://pkg.go.dev/github.com/samber/do/v2)
10- [do.samber.dev](https://do.samber.dev)
11- [github.com/samber/do/v2](https://github.com/samber/do)
12
13This skill is not exhaustive — refer to library documentation and code examples for more information:
14
15- 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.
16- To navigate this library's usage in your own code (definitions, call sites, diagnostics), → See `samber/cc-skills-golang@golang-gopls` skill (`gopls`).
17- Context7 remains a fallback for docs not indexed on pkg.go.dev.
18
19Install v2 — v1 is superseded and lacks the generics-based container, scopes, and lifecycle hooks documented below, so v1-era guidance misleads on every API in this skill:
20
21```bash
22go get -u github.com/samber/do/v2
23```
24
25## Core Concepts
26
27### The Injector (Container)
28
29```go
30import "github.com/samber/do/v2"
31
32injector := do.New()
33```
34
35### Service Types
36
37- **Lazy** (default): Created when first requested
38…

Excerpt shown under the repository's MIT license.

More skills in cc-skills-golang

Keep exploring

Similar skill repositories

thedotmack /

claude-mem
116k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

CCCXGHGM+135 skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates