golang-architecture-patterns
Installation
SKILL.md
Go Architecture Patterns
Build Workflow
- Let the existing repo architecture lead. Preserve established package naming, dependency injection, and test style unless there is a concrete problem.
- Design boundaries around behavior and data ownership, not pattern names.
- Accept interfaces at the consumer boundary. Return concrete types unless hiding implementation is part of the API.
- Keep interfaces small. Prefer
io.Reader-style capability interfaces over broad service interfaces. - Keep domain/service packages independent of transport, database, CLI, logging, and framework details.
- Keep concurrency out of APIs when possible. Expose synchronous functions; let callers decide whether to run them in goroutines.
- Introduce repositories, ports/adapters, or functional options only when they remove real coupling or constructor complexity.
- Document tradeoffs in plans: dependency direction, concrete vs interface boundaries, test fakes, and simpler alternatives.