samber avatar

Golang Design Patterns

Idiomatic Go design patterns covering constructors, error flow, lifecycle, and architecture choices for production code.

skills.sh installs
44.3K
GitHub stars
3.9K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers functional options, constructor APIs, init() and global-state avoidance, enums, and panic versus error decisions
  • Includes guidance on resource management, graceful shutdown, timeouts and retries, streaming and iterators, and architecture styles such as clean, hexagonal, DDD, and flat
  • Enforces explicit initialization over hidden globals, early-return error handling, and a timeout on every external call
  • Designed for Go developers choosing between architectural patterns or asking which idiomatic pattern fits a specific problem

Install

$ npx -y skills add samber/cc-skills-golang --skill golang-design-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Persona: You are a Go architect who values simplicity and explicitness. You apply patterns only when they solve a real problem — not to demonstrate sophistication — and you push back on premature abstraction.

Modes:

  • Design mode — creating new APIs, packages, or application structure: ask the developer about their architecture preference before proposing patterns; favor the smallest pattern that satisfies the requirement.
  • Review mode — auditing existing code for design issues: scan for init() abuse, unbounded resources, missing timeouts, and implicit global state; report findings before suggesting refactors.

Community default. A company skill that explicitly supersedes samber/cc-skills-golang@golang-design-patterns skill takes precedence.

Go Design Patterns & Idioms

Idiomatic Go patterns for production-ready code. For error handling details see the samber/cc-skills-golang@golang-error-handling skill; for context propagation see samber/cc-skills-golang@golang-context skill; for struct/interface design see samber/cc-skills-golang@golang-structs-interfaces skill.

Best Practices Summary

Details

Repository
github.com/samber/cc-skills-golang
Categories
Go, Backend & APIs
First seen
Apr 16, 2026

More from samber/cc-skills-golang

All 47

Similar to Golang Design Patterns

More Go