kessoku-di✓ Pass

Kessoku compile-time DI with parallel initialization for Go. Use when writing or debugging kessoku providers/injectors, enabling async dependencies, migrating from google/wire, or fixing go:generate/codegen issues in Go services.

69out of 100
118
★ stars
0
↓ downloads
19
◉ views

// Install Skill

Install Skill

Skills are third-party code from public GitHub repositories. SkillHub scans for known malicious patterns but cannot guarantee safety. Review the source code before installing.

Install globally (user-level):

npx skillhub install mazrean/kessoku/kessoku-di

Install in current project:

npx skillhub install mazrean/kessoku/kessoku-di --project

Use this for Hermes or another runtime. The skill is written to <directory>/<skill-name>/.

npx skillhub install mazrean/kessoku/kessoku-di --target-dir /path/to/skills

Suggested path: ~/.claude/skills/kessoku-di/

AI Review

69
out of 100
Instruction Quality72
Description Precision68
Usefulness64
Technical Soundness72

Well-organized library skill with an API table, concrete patterns, a wire migration guide with mapping tables, and a troubleshooting reference. Held back by niche applicability (Go + kessoku only), no negative triggers in the description, and mostly reference-style content rather than an automated workflow.

betamoderatego-backend-devsgo-dependency-injectionwire-migrationparallel-initializationcodegen-troubleshooting
Reviewed by reviewer-service(hybrid:claude-sonnet-5-5) on 11/2/2026

SKILL.md Content

---
name: kessoku-di
description: Kessoku compile-time DI with parallel initialization for Go. Use when writing or debugging kessoku providers/injectors, enabling async dependencies, migrating from google/wire, or fixing go:generate/codegen issues in Go services.
---

# Kessoku: Parallel DI for Go

Kessoku is a compile-time dependency injection library that speeds up Go application startup through **parallel initialization**. Unlike google/wire (sequential), kessoku runs independent providers concurrently.

**Use this skill when** you are building or debugging kessoku injectors/providers, wiring async dependencies, migrating from google/wire, or troubleshooting `go tool kessoku` generation problems.

**Supporting files:** [PATTERNS.md](references/PATTERNS.md) for examples, [MIGRATION.md](references/MIGRATION.md) for wire migration, [TROUBLESHOOTING.md](references/TROUBLESHOOTING.md) for common errors.

## When to Use Kessoku

- **Slow startup**: Multiple DB connections, API clients, or cache initialization
- **Cold start optimization**: Serverless/Lambda functions timing out
- **google/wire alternative**: Want compile-time DI with parallel execution

## Quick Start

```go
//go:generate go tool kessoku $GOFILE

package main

import "github.com/mazrean/kessoku"

var _ = kessoku.Inject[*App](
    "InitializeApp",
    kessoku.Async(kessoku.Provide(NewDB)),     // Parallel
    kessoku.Async(kessoku.Provide(NewCache)),  // Parallel
    kessoku.Provide(NewApp),                   // Waits for deps
)
```

Run: `go generate ./...` → generates `*_band.go`

## API Reference

| API | Syntax | Purpose |
|-----|--------|---------|
| **Inject** | `var _ = kessoku.Inject[T]("Name", ...)` | Define injector function |
| **Provide** | `kessoku.Provide(NewFn)` | Wrap provider function |
| **Async** | `kessoku.Async(kessoku.Provide(...))` | Enable parallel execution |
| **Bind** | `kessoku.Bind[Interface](provider)` | Interface→implementation |
| **Value** | `kessoku.Value(v)` | Inject constant value |
| **Set** | `kessoku.Set(providers...)` | Group providers |
| **Struct** | `kessoku.Struct[T]()` | Expand struct fields as deps |

## Common Patterns

### Basic Injector

```go
var _ = kessoku.Inject[*App](
    "InitializeApp",
    kessoku.Provide(NewConfig),
    kessoku.Provide(NewDB),
    kessoku.Provide(NewApp),
)
// Generates: func InitializeApp() *App
```

### Parallel Initialization (Async)

```go
var _ = kessoku.Inject[*App](
    "InitializeApp",
    kessoku.Async(kessoku.Provide(NewDB)),      // }
    kessoku.Async(kessoku.Provide(NewCache)),   // } Run in parallel
    kessoku.Async(kessoku.Provide(NewClient)),  // }
    kessoku.Provide(NewApp),
)
// Generates: func InitializeApp(ctx context.Context) (*App, error)
```

### Interface Binding

```go
var _ = kessoku.Inject[*App](
    "InitializeApp",
    kessoku.Bind[Repository](kessoku.Provide(NewPostgresRepo)),
    kessoku.Provide(NewApp),  // Receives Repository interface
)
```

### Provider Sets (Reusability)

```go
var DatabaseSet = kessoku.Set(
    kessoku.Provide(NewConfig),
    kessoku.Async(kessoku.Provide(NewDB)),
)

var _ = kessoku.Inject[*App]("InitializeApp",
    DatabaseSet,
    kessoku.Provide(NewApp),
)
```

### Struct Field Expansion

```go
var _ = kessoku.Inject[*DB](
    "InitializeDB",
    kessoku.Provide(NewConfig),   // Returns *Config{Host, Port}
    kessoku.Struct[*Config](),    // Expands to Host, Port fields
    kessoku.Provide(NewDB),       // Receives Host, Port separately
)
```

## Key Points

- **No build tag needed**: Unlike wire's `//go:build wireinject`
- **Async requires context**: Generated function gets `context.Context` parameter
- **Error propagation**: Providers returning `error` make injector return `error`
- **Cleanup functions**: Providers can return `func()` for cleanup

## Support Files

For detailed information, see:
- [PATTERNS.md](references/PATTERNS.md) - Detailed patterns, examples, best practices
- [MIGRATION.md](references/MIGRATION.md) - Wire migration guide
- [TROUBLESHOOTING.md](references/TROUBLESHOOTING.md) - Common errors and solutions

## Resources

- Repository: https://github.com/mazrean/kessoku
- Documentation: https://pkg.go.dev/github.com/mazrean/kessoku

License

Declared license: MIT

MIT License

Copyright (c) 2026 mazrean

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View the license in the source repository — the version published there is authoritative.