CtrlK
BlogDocsLog inGet started
Tessl Logo

golang-dependency-injection

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.

82

1.00x
Quality

86%

Does it follow best practices?

Impact

100%

1.00x

Average score across 2 eval scenarios

SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

Evaluation results

100%

Dependency Injection Migration Plan

DI migration plan for tightly coupled Go codebase

Criteria
Without this skill
With this skill

Global DB var identified

100%

100%

init() DB setup identified

100%

100%

Global mailer var identified

100%

100%

Constructor injection proposed for globals

100%

100%

Concrete store dependency identified

100%

100%

Concrete mailer dependency identified

100%

100%

Interface defined at consumer

100%

100%

Service-locator identified

100%

100%

Service-locator replacement proposed

100%

100%

DI library recommendation present

100%

100%

Small project → manual or lightweight library

100%

100%

refactoring-steps.md produced

100%

100%

Three sections present

100%

100%

100%

E-Commerce Service Setup with uber-go/fx

uber-go/fx domain modules and lifecycle hooks

The agent wrote 999 files outside the evaluated workspace (Without this skill)

These are not visible to scoring or included in the download.

/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/list

/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.lock

/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.mod

/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.zip

/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.ziphash

The agent wrote 3156 files outside the evaluated workspace (With this skill)

These are not visible to scoring or included in the download.

/home/agent/go/pkg/mod/cache/download/github.com/cespare/xxhash/v2/@v/list

/home/agent/go/pkg/mod/cache/download/github.com/cespare/xxhash/v2/@v/v2.1.2.info

/home/agent/go/pkg/mod/cache/download/github.com/cespare/xxhash/v2/@v/v2.1.2.lock

/home/agent/go/pkg/mod/cache/download/github.com/cespare/xxhash/v2/@v/v2.1.2.mod

/home/agent/go/pkg/mod/cache/download/github.com/cespare/xxhash/v2/@v/v2.1.2.zip

Criteria
Without this skill
With this skill

Infra module grouping

100%

100%

User domain module

100%

100%

Order domain module

100%

100%

Multiple modules used

100%

100%

No flat wiring

100%

100%

Lifecycle parameter

100%

100%

Hook registration

100%

100%

OnStart hook

100%

100%

OnStop hook

100%

100%

Stateful resource lifecycle

100%

100%

Repository
samber/cc-skills-golang
Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.