go-practices

star 127

Go service conventions: hexagonal architecture, snake_case files, error wrapping with fmt.Errorf, table-driven tests, and OpenTelemetry. Use when writing .go files or creating Go services.

eser By eser schedule Updated 3/9/2026

name: go-practices description: "Go service conventions: hexagonal architecture, snake_case files, error wrapping with fmt.Errorf, table-driven tests, and OpenTelemetry. Use when writing .go files or creating Go services."

Go Practices

Quick Start

  1. Follow hexagonal architecture: business logic in pkg/api/business/, adapters in pkg/api/adapters/
  2. Use snake_case for all Go files
  3. Wrap errors: fmt.Errorf("%w: %w", ErrSentinelError, err)
  4. Run tests with race detection: go test -race ./...

Key Principles

  • Business logic has NO external dependencies
  • All external interactions through interfaces
  • Composition via AppContext (composition root)
  • Table-driven tests with t.Parallel()
  • OpenTelemetry for observability

References

See rules.md for complete conventions.

Install via CLI
npx skills add https://github.com/eser/stack --skill go-practices
Repository Details
star Stars 127
call_split Forks 5
navigation Branch main
article Path SKILL.md
More from Creator