golang-design-patterns
Select or review idiomatic Go patterns for constructors, configuration, lifecycle, resilience, streaming, data flow, and package boundaries.
Skill by reagin
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/reagin-golang-design-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, data, writing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/golang-design-patterns
What's inside
- Skill name
golang-design-patterns- Description
- Select or review idiomatic Go patterns for constructors, configuration, lifecycle, resilience, streaming, data flow, and package boundaries. Use when an implementation needs an explicit design trade-off rather than a routine local edit.
- License
- MIT
- Instructions
- 69 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- architecture.md · references/
- data-handling.md · references/
- resource-management.md · references/
SKILL.md (first lines)
# Go Design Patterns
Use the smallest pattern that resolves a demonstrated pressure. Go APIs benefit more from explicit ownership and stable contracts than from naming every familiar object-oriented pattern.
## Understand the existing design
Before proposing or implementing a pattern:
1. Read repository instructions, `go.mod`, package layout, constructors, public APIs, and tests.
2. Identify the actual pressure: optional configuration, lifecycle ownership, boundary isolation, multiple implementations, unbounded work, or data volume.
3. Record compatibility constraints and real callers. Do not redesign the package around a hypothetical future use.
4. Prefer the repository's established pattern when it already handles the requirement cleanly.
5. Keep review and implementation scope separate, and report broader design opportunities independently from the requested change.
## Construction and configuration
| Shape | Use when | Avoid when |
| --- | --- | --- |
| Direct arguments | Few required values with clear meaning | Several adjacent values are easy to swap or evolve together |
| Config struct | Configuration is cohesive, validated together, or loaded externally | It obscures a tiny stable API |
| Functional options | A public constructor has genuinely optional, orthogonal settings and compatibility matters | Options hide required dependencies or permit invalid intermediate state |
| Builder | Construction is staged and the intermediate choices need validation or fluent domain language | It adds ceremony to ordinary initialization |
Functional options are one choice, not the default for every constructor. Keep required dependencies explicit. If applying an option can fail, return that failure during construction and leave no partially initialized object.
```go
type Option func(*Server) error
func NewServer(store Store, opts ...Option) (*Server, error) {
s := &Server{store: store, timeout: defaultTimeout}
for _, apply := range opts {
if err := apply(s); err != nil {
return nil, fmt.Errorf("applying server option: %w", err)
}
}
if err := s.validate(); err != nil {
return nil, err
}
return s, nil
}
```
Do not introduce an options abstraction solely to avoid changing unexported call sites.
## Explicit lifecycle and boundaries
- Prefer explicit construction and wiring over mutable globals or side-effectful `init` functions when initialization can fail, depends on environment, or needs test substitution.
- Make ownership of files, bodies, rows, goroutines, queues, and servers visible. Acquire and release at the same lifecycle level where possible.
- Put time and capacity limits at boundaries that own the policy. A timeout in every layer can accidentally consume or contradict one shared budget.
- Retry only operations whose semantics make retry safe, within a bounded attempt/time policy, with cancellation and backoff. Do not retry permanent validation failures or duplicate a higher layer's retry loop.
- Design idempotency explicitly when repeating a side effect can create duplicates.
For close behavior, graceful shutdown, and cleanup, read [resource management](references/resource-management.md).
## Data flow
Use streaming or iterators when materializing the full dataset creates a demonstrated memory or latency problem and the downstream protocol supports partial progress. Define error timing, cancellation, ordering, and ownership before changing a slice-returning API. See [data handling](references/data-handling.md).
## Architecture
Keep a flat or package-oriented design until independent domain rules, adapters, deployment boundaries, or team ownership make stronger separation valuable. When a formal architecture is warranted, choose it from dependency direction and change boundaries—not repository size or trend. Read [architecture choices](references/architecture.md).
Interfaces usually belong near the consumer and should contain only the behavior that consumer requires. Do not create an interface only to mock a concrete type; a small fakeable boundary may emerge from the actual caller.
## Verification
Verify observable contracts: defaults, invalid configuration, lifecycle closure, timeout and cancellation, retry safety, partial results, and compatibility. Explain why the selected pattern is simpler for the current pressure than direct code, and note any intentionally deferred complexity.From reagin/agent-skills, MIT.
More from reagin/agent-skills
- 0.565score
frontend-apple-design
reagin
Design or review Apple-inspired web interfaces with clear hierarchy, consistent typography and materials, restrained motion, and accessible interactions.
SkillAFreshness: AClaude Code +9 - 0.565score
golang-continuous-integration
reagin
Create, improve, or simplify GitHub Actions for a Go repository, including tests, linting, caching, matrices, and release gates.
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-react-file-structure
reagin
Use for React TypeScript file-structure work involving ownership or folders for new or moved files, multi-file components with narrow public entries, page and…
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-ui-refinement
reagin
Refine existing web interfaces and simplify their behavioral tests.
SkillAFreshness: AClaude Code +9 - 0.529score
golang-concurrency
reagin
Design or review concurrent Go code involving goroutines, channels, locks, atomics, worker pools, or race and leak symptoms.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-context
reagin
Design or repair context propagation, cancellation, deadlines, and request-scoped values in Go APIs.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-benchmark
reagin
Design, run, and interpret Go benchmarks, profiles, traces, and compiler diagnostics.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-cli
reagin
Design or review the framework-independent behavior and architecture of Go command-line applications: command UX, flags, configuration, output and exit…
SkillBFreshness: BClaude Code +9 - 0.529score
golang-error-handling
reagin
Design or review Go error creation, wrapping, inspection, aggregation, logging boundaries, transport mapping, and panic recovery.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-gopls
reagin
Use gopls through an available host LSP integration, MCP surface, or CLI for semantic Go navigation, references, implementations, call hierarchy, diagnostics…
SkillBFreshness: BClaude Code +9 - 0.526score
golang-graphql
reagin
Build, review, or debug Go GraphQL APIs using `github.com/99designs/gqlgen` or `github.com/graph-gophers/graphql-go`.
SkillBFreshness: BClaude Code +9 - 0.526score
golang-data-structures
reagin
Choose or review Go collections and memory representations when access patterns, ownership, copying, allocation, or generic APIs matter.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 25, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/reagin/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from reagin
- 0.565score
frontend-apple-design
reagin
Design or review Apple-inspired web interfaces with clear hierarchy, consistent typography and materials, restrained motion, and accessible interactions.
SkillAFreshness: AClaude Code +9 - 0.565score
golang-continuous-integration
reagin
Create, improve, or simplify GitHub Actions for a Go repository, including tests, linting, caching, matrices, and release gates.
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-react-file-structure
reagin
Use for React TypeScript file-structure work involving ownership or folders for new or moved files, multi-file components with narrow public entries, page and…
SkillAFreshness: AClaude Code +9 - 0.559score
frontend-ui-refinement
reagin
Refine existing web interfaces and simplify their behavioral tests.
SkillAFreshness: AClaude Code +9 - 0.529score
golang-context
reagin
Design or repair context propagation, cancellation, deadlines, and request-scoped values in Go APIs.
SkillBFreshness: BClaude Code +9 - 0.529score
golang-concurrency
reagin
Design or review concurrent Go code involving goroutines, channels, locks, atomics, worker pools, or race and leak symptoms.
SkillBFreshness: BClaude Code +9
Cite this page
golang-design-patterns skill. Agent Mart. https://agentmart.dev/skills/reagin-golang-design-patterns (last updated 2026-10-24)