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.

87

1.01x
Quality

82%

Does it follow best practices?

Impact

100%

1.01x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

SKILL.md
Quality
Evals
Security

Evaluation results

100%

3%

Modernizing a Legacy Go Service

Refactor global-state Go service to constructor injection

Criteria
Without context
With context

No global service vars

100%

100%

No init() for setup

100%

100%

Constructor injection

100%

100%

Interface at consumer

70%

100%

Infrastructure first in main

100%

100%

No cross-service globals

100%

100%

DB not hidden inside service

100%

100%

Concrete struct returned

100%

100%

Refactoring notes present

100%

100%

Notes mention testability

100%

100%

100%

Wiring a Content Pipeline Service

google/wire provider sets and injector setup

Criteria
Without context
With context

wireinject build constraint

100%

100%

wire.Build call

100%

100%

wire.NewSet grouping

100%

100%

wire.Bind for interfaces

100%

100%

Injector returns App

100%

100%

No manual wire_gen edit

100%

100%

Build constraint explained

100%

100%

wire_gen.go commit guidance

100%

100%

No lifecycle management claimed

100%

100%

Providers return concrete types

100%

100%

100%

Building a Multi-Domain Booking API with uber-go/fx

uber-go/fx lifecycle hooks and domain module organization

Criteria
Without context
With context

fx.Lifecycle OnStart hook

100%

100%

fx.Lifecycle OnStop hook

100%

100%

Lifecycle hook context param

100%

100%

fx.Module for infra

100%

100%

fx.Module for domains

100%

100%

Modules composed in main

100%

100%

No container as dependency

100%

100%

fx.Invoke for startup

100%

100%

Lifecycle hooks explained

100%

100%

Container not passed explained

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.