Reviews Go project architecture: package structure, dependency direction, layering, separation of concerns, domain modeling, and module boundaries. Use when evaluating or designing Go project layout.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Good architecture makes the next change easy. Bad architecture makes every change scary.
Detailed reference material, loaded on demand:
references/layout-and-wiring.md — the full reference directory tree and
a composition-root main.go.Read a reference file only when the summary below is not enough.
Pick the mode that matches the request before starting:
Judge a codebase against the structure its problem needs, not the most elaborate one available. Over-architecture is a finding too.
| Situation | Fitting structure |
|---|---|
| CLI, small service, one data store, little business logic | Flat main + a few packages; no layers for their own sake |
| Typical service: HTTP/gRPC in front, a database behind | Handler → service → store, interfaces at the consumer (sections 1-2) |
| Several adapters (HTTP, gRPC, queue, CLI) over the same rules, or infrastructure expected to change | Ports and adapters: a pure core, adapters on the edge |
| Large domain, several teams, rules that differ by sub-domain | Bounded contexts as top-level packages, each layered inside, talking through explicit APIs or events |
Signs of too much: interfaces with one implementation per layer, mapping structs copied unchanged through three layers, a "domain" package with no behavior. Signs of too little: SQL in handlers, business rules spread across transport code, packages that import each other in both directions.
For repositories with many packages, build the dependency picture before judging it:
go list ./... for packages, then import statements
to trace dependency direction.file.go:line in every finding.The reference layout: cmd/<binary>/main.go per binary, project-private
code under internal/ (domain, service, store/<backend>,
handler, config), pkg/ only for genuinely reusable code, plus
api/ for OpenAPI/proto and migrations/. Full tree:
references/layout-and-wiring.md. For scaffolding a new project, the
go-project-layout skill owns the procedure.
internal/ enforces encapsulation at the compiler level. Use it aggressively.pkg/ is for genuinely reusable packages. When in doubt, use internal/.cmd/ main packages should be thin — wire dependencies and call Run().main.go per binary, minimal logic inside.Dependencies MUST flow inward. Domain core has zero external dependencies:
handlers → services → domain ← stores
↓ ↓ ↓
(net/http) (pure Go) (database/sql)
Rules:
domain/ imports NOTHING from the project. No store, no handler, no config.service/ depends on domain/ types and interfaces, NOT on concrete stores.handler/ depends on service/ interfaces.store/ implements interfaces defined in service/ or domain/.// ✅ Good — service defines the interface it needs
// internal/service/user.go
type UserStore interface {
GetByID(ctx context.Context, id string) (*domain.User, error)
Create(ctx context.Context, user *domain.User) error
}
type UserService struct {
store UserStore // depends on interface, not postgres.Store
}
// internal/store/postgres/user.go
type Store struct { db *sql.DB }
// Implements service.UserStore without importing the service package
func (s *Store) GetByID(ctx context.Context, id string) (*domain.User, error) { ... }
main.go is the composition root. Wire everything here:
Read config, build the logger, open connections, construct stores →
services → handlers in that order, mount routes, run the server. No
business logic. Example: references/layout-and-wiring.md.
Avoid dependency injection frameworks. Go's explicit wiring is a feature.
If wiring gets complex, use Google's wire for compile-time DI code generation.
// ✅ Good — clear purpose
package orderservice // business rules for orders
package postgres // PostgreSQL data access
package httphandler // HTTP transport layer
// ❌ Bad — grab-bag packages
package utils // what ISN'T a util?
package common // everything and nothing
package models // types without behavior
// ❌ Bad — package name repeated in type
package user
type UserService struct{} // user.UserService
// ✅ Good
package user
type Service struct{} // user.Service
A package with 20 related files is better than 20 packages with 1 file each. Split packages when they have distinct responsibilities, not when they get big.
type Config struct {
Addr string `env:"ADDR" envDefault:":8080"`
DatabaseURL string `env:"DATABASE_URL,required"`
LogLevel string `env:"LOG_LEVEL" envDefault:"info"`
Timeout time.Duration `env:"TIMEOUT" envDefault:"30s"`
}
Rules:
internal/config.Avoid init(). It runs implicitly, makes testing harder, and creates hidden dependencies.
// ❌ Bad — hidden side effects
func init() {
db, _ = sql.Open("postgres", os.Getenv("DB_URL"))
}
// ✅ Good — explicit initialization
func NewStore(dsn string) (*Store, error) {
db, err := sql.Open("postgres", dsn)
if err != nil {
return nil, fmt.Errorf("open db: %w", err)
}
return &Store{db: db}, nil
}
Exception: registering drivers or codecs is acceptable in init():
func init() {
sql.Register("custom", &CustomDriver{})
}
cmd/ main packagesinit() with side effects (DB connections, HTTP calls)internal/ used for project-private packagesutils/, common/, helpers/ packagesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
35 skills in this plugin
/git-commitStructured git commit messages following Conventional Commits format for Go projects. Generates well-scoped, atomic commits with clear descriptions. Use when committing changes, writing commit messages, preparing PRs, or reviewing commit history quality. Trigger examples: "commit these changes", "create commit", "commit message", "prepare PR", "squash commits". Not for: code review (go-code-review), changelog generation.
/go-api-designHTTP/REST API design for Go services: handlers, ServeMux routing, middleware, request validation, pagination, idempotency, health checks, error responses, and graceful shutdown. Use when designing APIs, writing HTTP handlers, implementing middleware, or structuring REST endpoints. Trigger examples: "design API", "REST endpoints", "HTTP handler", "middleware pattern", "graceful shutdown", "API versioning". Not for: gRPC services (go-grpc), spec-first OpenAPI work (go-openapi), general architecture (go-architecture-review), concurrency in handlers (go-concurrency-review).
/go-binary-sizeReduce the size of compiled Go binaries and container images: linker flags, inlining budget, CGO and build tags, embedded assets, dependency weight, and measuring what actually costs bytes. Use when a binary or image is too large, when shrinking a CLI for distribution, or when auditing what a dependency adds to the build. Trigger examples: "binary is too big", "shrink the binary", "reduce image size", "strip symbols", "what is making my binary large", "ldflags -s -w". Not for: runtime speed and allocations (go-performance-review), CI setup (go-ci), release pipelines and signing (go-build-release), dependency CVEs (go-dependency-audit).
/go-agent-skills:go-architecture-reviewfrom go-agent-skills
Claude never picks this skill on its own
Claude Code cannot parse its frontmatter, so it ignores every field there: the description on this page is for you to read, but Claude never sees it. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /go-agent-skills:go-architecture-review still runs it.
npx claudepluginhub eduardo-sl/go-agent-skills --plugin go-agent-skillsOther plugins' skills for the same job