What problem does it solve?
It helps you choose and implement idiomatic, production-ready Go design patterns without adding unnecessary complexity, especially around construction, error flow, resource lifecycle, graceful shutdown, resilience, and dependency injection.
Core Features & Use Cases
- Constructor and configuration design: Prefer functional options to evolve APIs safely, with validation errors surfaced at construction time.
- Error handling and control flow: Handle error cases first with early returns and use panic only for bugs/invariant violations.
- Resource lifecycle discipline: Enforce cleanup practices like deferring Close() immediately after opening and prefer runtime.AddCleanup over runtime.SetFinalizer.
- Architecture guidance with guardrails: Right-size architecture, keep domain logic pure, and push for explicitness over implicit behavior.
- Resilience and limits: Require timeouts on external calls, apply bounded resources, and implement retry logic that respects context cancellation.
- Data handling and performance: Use streaming/iterators for large data, avoid repeated allocations, and compile regexps once at package scope.
Quick Start
Use the golang-design-patterns skill to review your Go service design decisions and produce the smallest set of idiomatic patterns that match your specific problem and constraints.