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.
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versiongolang-samber-doExecute the skills CLI command in your project's root directory to begin installation:
Fetches golang-samber-do from samber/cc-skills-golang and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate golang-samber-do. Access via /golang-samber-do in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
1.0K
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
1.0K
stars
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.
Type-safe dependency injection toolkit for Go based on Go 1.18+ generics.
Official Resources:
This skill is not exhaustive. Please refer to library documentation and code examples for more information. Context7 can help as a discoverability platform.
DO NOT USE v1 OF THIS LIBRARY. INSTALL v2 INSTEAD:
go get -u github.com/samber/do/v2
import "github.com/samber/do/v2"
injector := do.New()
Services MUST be registered via provider functions:
type Provider[T any] func(i Injector) (T, error)
Follow "Accept Interfaces, Return Structs":
// Register a service (lazy by default)
do.Provide(injector, func(i do.Injector) (Database, error) {
return &PostgreSQLDatabase{connString: "postgres://..."}, nil
})
// Register a pre-created value
do.ProvideValue(injector, &Config{Port: 8080})
// Register a transient service (new instance each time)
do.ProvideTransient(injector, func(i do.Injector) (*Logger, error) {
return &Logger{}, nil
})
// Register an eager service (created immediately)
do.Provide(injector, do.Eager(&Config{Port: 8080}))
The container MUST only be accessed at the composition root:
// Invoke with error handling
db, err := do.Invoke[Database](injector)
// MustInvoke panics on error (use when confident service exists)
db := do.MustInvoke[Database](injector)
func NewUserService(i do.Injector) (UserService, error) {
db := do.MustInvoke[Database](i)
cache := do.MustInvoke[Cache](i)
return &userService{db: db, cache: cache}, nil
}
do.Provide(injector, NewUserService)
Register a concrete type and invoke as an interface without explicit aliasing:
// Register concrete type
do.Provide(injector, func(i do.Injector) (*PostgreSQLDatabase, error) {
return &PostgreSQLDatabase{}, nil
})
// Invoke directly as interface (implicit aliasing)
db := do.MustInvokeAs[Database](injector)
Register multiple services of the same type:
do.ProvideNamed(injector, "primary-db", func(i do.Injector) (*Database, error) {
return &Database{URL: "postgres://primary..."}, nil
})
mainDB := do.MustInvokeNamed[*Database](injector, "primary-db")
Use do.Package() to organize service registration by module:
// infrastructure/package.go
var Package = do.Package(
do.Lazy(func(i do.Injector) (*postgres.DB, error) {
cfg := do.MustInvoke[*Config](i)
return postgres.Connect(cfg.DatabaseURL)
}),
do.Lazy(func(i do.Injector) (*redis.Client, error) {
cfg := do.MustInvoke[*Config](i)
return redis.NewClient(cfg.RedisURL), nil
}),
)
// main.go
injector := do.New(infrastructure.Package, service.Package)
func main() {
injector := do.New(
infrastructure.Package,
repository.Package,
service.Package,
transport.Package,
)
server := do.MustInvoke[*http.Server](injector)
go server.ListenAndServe()
_ = injector.ShutdownOnSignalsWithContext(context.Background(), os.Interrupt)
}
For scopes, lifecycle management, struct injection, and debugging, see Advanced Usage.
For testing patterns (cloning, overrides, mocks), see Testing.
| Function | Purpose |
|---|---|
do.Provide[T]() |
Register lazy service (default) |
do.ProvideNamed[T]() |
Register named lazy service |
do.ProvideValue[T]() |
Register pre-created value |
do.ProvideNamedValue[T]() |
Register named value |
do.ProvideTransient[T]() |
Register new instance each time |
do.ProvideNamedTransient[T]() |
Register named transient service |
do.Package() |
Group service registrations |
| Function | Purpose |
|---|---|
do.Invoke[T]() |
Get service (with error) |
do.InvokeNamed[T]() |
Get named service |
do.InvokeAs[T]() |
Get first service matching interface |
do.InvokeStruct[T]() |
Inject into struct fields using tags |
do.MustInvoke[T]() |
Get service (panic on error) |
do.MustInvokeNamed[T]() |
Get named service (panic on error) |
do.MustInvokeAs[T]() |
Get service by interface (panic on error) |
do.MustInvokeStruct[T]() |
Inject into struct (panic on error) |
samber/cc-skills-golang@golang-dependency-injection skill for DI concepts, comparison, and when to adopt a DI librarysamber/cc-skills-golang@golang-structs-interfaces skill for interface design patternssamber/cc-skills-golang@golang-testing skill for general testing patternsPrerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
samber/cc-skills-golang
tomlord1122/tomtom-skill
jwynia/agent-skills
mindrally/skills
github/awesome-copilot
kostja94/marketing-skills
golang-samber-do is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Registry listing for golang-samber-do matched our evaluation — installs cleanly and behaves as described in the markdown.
Keeps context tight: golang-samber-do is the kind of skill you can hand to a new teammate without a long onboarding doc.
golang-samber-do reduced setup friction for our internal harness; good balance of opinion and flexibility.
I recommend golang-samber-do for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
I recommend golang-samber-do for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
golang-samber-do reduced setup friction for our internal harness; good balance of opinion and flexibility.
golang-samber-do reduced setup friction for our internal harness; good balance of opinion and flexibility.
We added golang-samber-do from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
golang-samber-do fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
showing 1-10 of 58