PlugWiki

golang-dependency-injection Skill for Claude Code: Go Dependency Injection

Makes Claude design and refactor dependency injection in Go, starting with plain constructors and adding a library only when needed.

Installs
40.3K
on skills.sh
Stars
3.7K
on GitHub
Files
5
besides SKILL.md
Updated
Nov 2026
last repo commit

golang-dependency-injection makes Claude pass dependencies through constructors and keep any container at the composition root. It compares manual wiring with google/wire, uber-go/dig and fx, and samber/do, and gives a rule of thumb: stay manual under 10 services and consider a library from 10 to 20.

It has two modes. Design mode recommends an approach and writes the wiring. Refactor mode can split the work across up to three sub-agents that look for globals, concrete dependencies and service-locator patterns. It bundles four reference files and no scripts.

Good for

  • Go developers structuring services with many connected parts
  • Teams refactoring code that uses globals and init() for setup
  • Anyone choosing between google/wire, uber-go dig and fx, and samber/do

Install golang-dependency-injection

Claude Code

  1. 1

    Copy this prompt.

    Install the golang-dependency-injection skill in Claude Code. Run this command:
    
    /plugin marketplace add samber/cc
    /plugin install cc-skills-golang@samber
    
    Then check that it loaded and tell me how to use it.
  2. 2

    Paste it into Claude Code. It shows the change and asks before running it.

Pick one route, not several. The README says the skills cross-reference each other and a subset gives a partial and potentially inconsistent view, so the plugin or the whole-set CLI command is the better choice. The plugin installs the repo's 46 skill folders; its manifest declares no hooks, commands or MCP servers. Claude Code names plugin skills /plugin-name:skill-name, so after the plugin install the full name is /cc-skills-golang:golang-dependency-injection. The samber/cc marketplace lists seven plugins; the second command installs only cc-skills-golang.

From the project README. Source.

What's in the skill

When it loads

Comprehensive guide for dependency injection (DI) in Golang. Covers why DI matters (testability, loose coupling, separation of concerns, lifecycle management), manual constructor injection, and DI library comparison (google/wire, uber-go/dig, uber-go/fx, samber/do). Use this skill when designing service architecture, setting up dependency injection, refactoring tightly coupled code, managing singletons or service factories, or when the user asks about inversion of control, service containers, or wiring dependencies in Go. For a specific DI library, → See `samber/cc-skills-golang@golang-google-wire`, `samber/cc-skills-golang@golang-uber-dig`, `samber/cc-skills-golang@golang-uber-fx`, or `samber/cc-skills-golang@golang-samber-do` skills.

Sections in SKILL.md

  1. Best Practices Summary
  2. Why Dependency Injection?
  3. Manual Constructor Injection (No Library)
  4. DI Library Comparison
  5. Decision Table
  6. Quick Comparison: Wiring Style
  7. Testing with DI
  8. Testing with samber/do — Clone and Override
  9. When to Adopt a DI Library
  10. Common Mistakes
  11. Cross-References
  12. References

Key facts

Installs on skills.sh
40,289 as of 2026-11-02
Last repo commit
2026-11-01

What it includes

  • Assess the dependency graph, pick manual DI or a library, generate the wiring

    For a new project, a new service or a service added to an existing DI setup.

    Write · Design mode

  • Up to 3 sub-agents find globals, concrete types and service locators

    Agent 1 finds globals and init() setup, Agent 2 maps concrete dependencies to turn into interfaces, Agent 3 finds containers passed as arguments. Then one migration plan.

    Runs code · Refactor mode

  • Ten rules, such as constructors only and container only in main()

    Includes never using global registries and never passing the container as a dependency.

    Read · Best practices summary

  • Manual vs google/wire vs uber-go dig and fx vs samber/do

    Compares project size, type safety, code generation, reflection, lifecycle support, debugging and learning curve.

    Read · Decision table

  • Worked examples for manual DI, google/wire, dig and fx, and samber/do

    Four files: manual-di.md, google-wire.md, uber-dig-fx.md and samber-do.md.

    Read · references/

  • Inject mocks, or clone a samber/do container and override one service

    Shows how DI makes testing simple.

    Write · Testing with DI

From the official docs

Permissions

Low risk

Claude can edit your Go files and run go and git commands while this skill is active. Work on a branch and read the diff before you commit.

What it can do

  • Read your data
  • Create and change things
  • Delete things
  • Read-only mode

Watch out for

  • It edits files and runs commands in your project

    The frontmatter lists Edit, Write and these shell commands: go:*, golangci-lint:*, git:*. Work on a branch and read the diff before you commit. github.com

  • Claude may fetch web pages

    The frontmatter lists WebFetch. Page text it reads goes into the conversation with your AI provider. github.com

  • The recommended plugin route installs the whole repo

    The plugin route and the --all skills CLI command add all 46 skill folders in the repo, not only this one. The plugin manifest (.claude-plugin/plugin.json, version 2.0.1) declares a name, description, author, license and keywords, and lists no hooks, commands or MCP servers. The skills CLI docs say --all installs every skill into every agent it supports without prompts. github.com

Technical details
Talks toWeb fetch/search through your assistant (WebFetch)
Sign-in and keysSKILL.md names no account or API key.
Scopes
  • Reads and edits files in your Go project

  • Runs the shell commands listed in the allowed-tools field: go:*, golangci-lint:*, git:*

  • Frontmatter also allows MCP tools: mcp__context7__resolve-library-id, mcp__context7__query-docs

Questions

What does golang-dependency-injection do?

It makes Claude set up dependency injection in Go: constructor injection by default, and a comparison of google/wire, uber-go dig and fx, and samber/do for bigger projects. It can also plan a refactor away from globals and init().

How do I install golang-dependency-injection?

Install the whole golang set, not only this skill. The README calls the skills atomic, cross-referencing units and says a partial install gives a potentially inconsistent view. The install box lists the Claude Code plugin (/plugin marketplace add samber/cc, then /plugin install cc-skills-golang@samber), the skills CLI for the whole set or for this skill alone, and the README's Codex, Gemini CLI, Cursor and OpenCode routes. The README documents no Claude app route, so none is listed.

Do I need the other golang skills with golang-dependency-injection?

Installing the set is the safer choice. SKILL.md hands neighboring topics to other skills: golang-samber-do, golang-structs-interfaces, golang-testing, golang-project-layout. The README says to install the general-purpose skills together, and the whole-set install does that.

What does golang-dependency-injection need on my machine?

The frontmatter names these programs: go. SKILL.md names no API key or account.

Is golang-dependency-injection safe?

It is instruction text and reference files, and the folder bundles no scripts. When you use it, Claude can edit files and run go, golangci-lint and git commands in your project, as its frontmatter allows. The frontmatter also lists WebFetch, so pages Claude opens are read into your conversation. Work on a branch, read the diff and approve commands you do not recognize.

golang-dependency-injection vs golang-samber-do?

This skill is the overall guide and library comparison. SKILL.md sends detailed samber/do usage to the golang-samber-do skill.

Does golang-dependency-injection work in Codex, Cursor or the Claude app?

The SKILL.md compatibility field says it is designed for Claude Code, Codex or a similar harness, and the README says the skills are built for Claude Code, Codex, Gemini, Copilot, Antigravity and Cursor. The install box covers Claude Code, Codex, Gemini CLI, Cursor, OpenCode and the skills CLI. The README documents no Claude app route.

Information

updated Nov 2, 2026

Folder
skills/golang-dependency-injection

samber/cc-skills-golangskills.sh

Sources

Docs, issue trackers and discussions this page is built from.

Show all 6
  1. cc-skills-golang README · github.com
  2. skills CLI commands · github.com
  3. cc-skills-golang plugin.json · github.com
  4. samber/cc marketplace.json · github.com
  5. Claude Code skills · code.claude.com
  6. golang-dependency-injection SKILL.md · github.com

Updated Nov 2, 2026.