go-samber-do

go-samber-do is a skill for Claude Code from RaNDoM6913/claude-code-superkit. It costs 65 tokens per session (1,376 once invoked), scanned A, original, MIT.

A guide to using samber/do, a Go dependency-injection container. Dependency injection is a way to create services and supply their required parts from a central setup.

In plain words
What is it for?
Use it to register and retrieve services, create dependencies lazily, shut them down in order, provide multiple named instances, and replace dependencies in tests.
Why use it?
It can organize construction and shutdown when a Go application has many connected services, while still allowing simpler manual setup for smaller projects.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Good fit Use it to register and retrieve services, create dependencies lazily, shut them down in order, provide multiple named instances, and replace dependencies in tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/random6913/claude-code-superkit/go-samber-do
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add RaNDoM6913/claude-code-superkit --skill go-samber-do
Clone the repo
git clone --depth 1 https://github.com/RaNDoM6913/claude-code-superkit

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for go-samber-do

README.md
[![agentmods](https://agentmods.dev/badge/skills/random6913/claude-code-superkit/go-samber-do/github.svg)](https://agentmods.dev/skills/random6913/claude-code-superkit/go-samber-do)
Your own site
<a href="https://agentmods.dev/skills/random6913/claude-code-superkit/go-samber-do"><img src="https://agentmods.dev/badge/skills/random6913/claude-code-superkit/go-samber-do/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for go-samber-do

Your own site · 80×15
<a href="https://agentmods.dev/skills/random6913/claude-code-superkit/go-samber-do"><img src="https://agentmods.dev/badge/skills/random6913/claude-code-superkit/go-samber-do.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,376 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00065 $0.01376
Opus 5.5 $0.00026 $0.00550
Sonnet 5.5 $0.00013 $0.00275
Haiku 4.5 $0.00006 $0.00138

Measured 1mo ago against content hash 42f01dfeb7ae, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

go-samber-do scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/codex/skills/go-samber-do/SKILL.md · 159 lines

How it starts

The opening of the file, as written. The whole thing — 159 lines — stays where its author put it; the contents beside it link to each section on GitHub.

samber/do — Dependency Injection Container

Upstream: https://github.com/samber/do · v2: https://github.com/samber/do/tree/v2

When to Reach for DI

Manual NewX(deps...) wiring scales to ~10 services. Past that, the wiring file becomes the second-largest file in the project. samber/do adds: lazy construction, reverse-order shutdown, and Override for testing.

If none of those apply, stay with manual wiring.

Core API (v1)

import "github.com/samber/do"

injector := do.New()

do.Provide(injector, func(i *do.Injector) (*pgxpool.Pool, error) {
    return pgxpool.New(context.Background(), os.Getenv("DATABASE_URL"))
})

do.Provide(injector, func(i *do.Injector) (*UserRepository, error) {
    pool := do.MustInvoke[*pgxpool.Pool](i)
    return NewUserRepository(pool), nil
})

repo, err := do.Invoke[*UserRepository](injector) // (T, error)
svc := do.MustInvoke[*UserService](injector)      // panics; main/init only

defer injector.Shutdown()

Providers are indexed by concrete type. Two providers for the same type is an error.

Named Providers

For multiple instances of the same type (primary vs replica pool):

do.ProvideNamed(injector, "primary", func(i *do.Injector) (*pgxpool.Pool, error) { ... })
do.ProvideNamed(injector, "replica", func(i *do.Injector) (*pgxpool.Pool, error) { ... })

primary := do.MustInvokeNamed[*pgxpool.Pool](injector, "primary")

Use do.ProvideNamedValue(injector, "name", value) for pre-built values.

Scoped Injectors (v2)

Child injectors inherit providers, can override them. Use for request-scoped services or multi-tenant:

root := do.New()
do.Provide(root, newLogger)

reqScope := root.Scope("request-42")
do.ProvideValue(reqScope, &TraceID{ID: "abc123"})

trace := do.MustInvoke[*TraceID](reqScope)  // scope-local
log := do.MustInvoke[*Logger](reqScope)     // inherited
reqScope.Shutdown()                         // root untouched

Don't create a scope per request if there are no scope-local providers — pure overhead.

Read the full file on GitHub · 159 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 159 lines · 65 tokens per session scan A 42f01dfeb7ae

Subscribe to this mod's changes

go-samber-do is a skill published in the GitHub repository RaNDoM6913/claude-code-superkit (3 stars, last pushed 9d ago), licensed MIT. It adds 65 tokens to every session and 1,376 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

go-backend-microservices

Go backend development best practices for microservices with clean architecture, observability, and production-ready patterns.

Mindrally/skills · 26 tokens

agent-go-expert

Specialist subagent: Go concurrency, error handling, stdlib patterns, Chi/Echo web frameworks specialist. Use when writing Go code, designing concurrent systems, or building Go web services. Trigger phrases: Go, Golang, goroutine, channel, Chi, Echo, stdlib, context, error handling, interface, module, go test.

travisjneuman/.claude · 75 tokens

api-development

Guidelines for building clean, scalable APIs with Go standard library and NestJS TypeScript, covering security, validation, and modular architecture.

Mindrally/skills · 30 tokens

go-api-development

Go API development guidelines using the standard library (1.22+) with best practices for RESTful API design, error handling, and security.

Mindrally/skills · 31 tokens

chi

Chi lightweight Go HTTP router. Covers routing, middleware, context, and patterns. Use for idiomatic, stdlib-compatible Go APIs. USE WHEN: user mentions "chi", "go-chi", "lightweight go router", "stdlib go router", asks about "chi middleware", "chi router", "chi context", "idiomatic go api", "net/http compatible…

claude-dev-suite/claude-dev-suite · 119 tokens

echo

Echo Go web framework. Covers routing, middleware, binding, context, and WebSocket. Use for high-performance, minimalist Go APIs. USE WHEN: user mentions "echo", "labstack echo", "go echo framework", asks about "echo middleware", "echo context", "echo binding", "echo websocket", "high performance go api", "echo…

claude-dev-suite/claude-dev-suite · 112 tokens