samber avatar

Golang Design Patterns

This is the reference card you want open when building Go services at scale. It covers functional options (the right way to write constructors), graceful shutdown, resource lifecycle, retry patterns, and when to use strings vs byte slices. The persona pushes back on premature abstraction, which is refreshing. It assumes you already know Go syntax and focuses on the production patterns that separate a working service from one that leaks goroutines or hangs on deploy. Strong opinions on avoiding init() and starting enums at 1. Cross-references other skills in the same collection for error handling and context propagation, so it stays focused on architecture without retreading basics.

skills.sh installs
43.8K
GitHub stars
3.8K
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/samber/cc-skills-golang
Categories
Code Review & Quality, Debugging, Go, Design & UI/UX
First seen
Apr 16, 2026

More from samber/cc-skills-golang

All 47
1addyosmani avatarconstraint-driven-developmentaddyosmani/agent-skillsEstablishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane de42.4Kskills.sh installs
2samber avatargolang-modernizesamber/cc-skills-golangModernize Golang code to use recent language features, standard library improvements, and idiomatic patterns. Trigger proactively when writing or reviewing Go c42Kskills.sh installs
3neondatabase avatarneon-functionsneondatabase/agent-skillsLong-running, serverless Node.js HTTP functions deployed onto your Neon branch, with DATABASE_URL injected automatically and compute that runs next to your data40.1Kskills.sh installs
4samber avatargolang-samber-losamber/cc-skills-golangFunctional programming helpers for Golang using samber/lo — 500+ type-safe generic functions for slices, maps, channels, strings, math, tuples, and concurrency 40Kskills.sh installs
5samber avatargolang-samber-dosamber/cc-skills-golangDependency injection in Golang using samber/do — service containers, lifecycle management, scopes, health checks, graceful shutdown, and module organization. Ap39.8Kskills.sh installs
6samber avatargolang-spf13-cobrasamber/cc-skills-golangGolang CLI command tree library using spf13/cobra — cobra.Command, RunE vs Run, PersistentPreRunE hook chain, Args validators (NoArgs, ExactArgs, MatchAll, cust38.6Kskills.sh installs