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.

89

1.00x
Quality

86%

Does it follow best practices?

Impact

100%

1.00x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

SKILL.md
Quality
Evals
Security

Evaluation results

100%

Inventory Service Refactor

Refactor globals to constructor injection

Criteria
Without context
With context

No package-level DB var

100%

100%

No package-level logger var

100%

100%

No init() for service setup

100%

100%

Constructor injection

100%

100%

Wiring in main()

100%

100%

Infrastructure-first order

100%

100%

Interface at consumer

100%

100%

No global registry

100%

100%

Struct holds dependencies

100%

100%

Refactor notes present

100%

100%

100%

Notification Service: Integration Tests

samber/do testing with clone override

Criteria
Without context
With context

Uses samber/do

100%

100%

Container not in service

100%

100%

Override/clone for mocking

100%

100%

Mock at interface boundary

100%

100%

No real transport in tests

100%

100%

Production wiring in main

100%

100%

Singleton for stateful deps

100%

100%

Tests cover email path

100%

100%

Tests cover push path

100%

100%

No code generation

100%

100%

100%

Order Processing Backend: Wiring with uber-go/fx

fx lifecycle hooks and module grouping

Criteria
Without context
With context

fx.Lifecycle for DB

100%

100%

OnStart hook present

100%

100%

OnStop hook present

100%

100%

fx.Module grouping

100%

100%

fx.New in main

100%

100%

app.Run() usage

100%

100%

No container as dependency

100%

100%

Lifecycle ctx parameter

100%

100%

Infrastructure module

100%

100%

No global service vars

100%

100%

Wiring notes present

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.