Skip to content
Skill

Go design patterns

Guides Go code toward idiomatic design patterns like functional options and factories

Go design patterns is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
90
Last commit
License
MIT
Listing updated

Similar skills

About Go design patterns

This skill steers an agent toward Go-native design patterns instead of patterns ported from other languages. It covers how to build constructors with functional options or config structs, choose between returning interfaces from factories and concrete types, and compose HTTP middleware or decorators around interfaces. It also includes guidance on strategy implementations, returning values or errors, and defer-based cleanup.

The skill points the agent to a short summary for common choices and to reference files for longer examples on creation patterns, behavioral patterns, and resilience and type-safety patterns such as retries with jitter, circuit breakers, and parsing input into types with unexported fields. It also lists anti-patterns to avoid, such as god interfaces and premature abstractions, and a closing checklist for reviewing code.

It expects a Go project with the Go toolchain installed. The allowed tools include reading and editing files, searching with Glob and Grep, and running go and gofmt commands.

When your agent uses it

Idiomatic Go design patterns: functional options, builder, factory, strategy, middleware chain, pub/sub, and other patterns adapted for Go's type system. Use when: "design pattern", "functional options", "builder pattern", "factory pattern", "strategy pattern", "middleware chain", "option pattern", "how to structure this". Not for: interface design (go-interface-design), package layout (go-architecture-review), concurrency patterns (go-concurrency-review).

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 4 files (20 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

Download the skill folder from https://github.com/eduardo-sl/go-agent-skills and copy it into your agent's skills folder.

What it does

Functional options
Shows how to build constructors with optional settings using option functions and sensible defaults.
Factory and constructors
Guides constructors that validate dependencies and factories that return interfaces.
Middleware composition
Covers the func(http.Handler) http.Handler chain and stacking decorators around interfaces.
Resilience patterns
Covers deadlines, jittered retries at one layer, circuit breakers and bulkheads.
Type-safe design
Explains parsing input into types with unexported fields and replacing boolean clusters with status types.
Anti-pattern review
Lists common Go mistakes such as god interfaces, premature abstraction and inheritance simulation.

Good for

  • Add functional options to a Go constructor
  • Refactor a struct with many optional fields
  • Wrap an HTTP handler chain with middleware
  • Create a factory that picks a store implementation from config
  • Review Go code for over-abstracted interfaces

Go design patterns FAQ

What does the skill need to run?

It requires the Go toolchain and works with Claude Code or similar AI coding agents on Go projects.

Which tools can the skill use?

Read, Edit, Write, Glob, Grep, and Bash commands limited to go and gofmt.

Which skills handle related topics?

Interface design, package layout and concurrency patterns are handled by separate skills: go-interface-design, go-architecture-review and go-concurrency-review.

Does Go design patterns run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Go design patterns?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Go design patterns?

The closest alternatives to Go design patterns are Go interface design, Go test quality, Go API design, Go coding standards and Error handling.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from eduardo-sl/go-agent-skills

  1. Guides Go agents in designing HTTP REST APIs, handlers, middleware and shutdown

    • Open source
    • 90 GitHub stars
    • Developer tools
  2. Reviews Go project structure, dependency direction and module boundaries

    • Open source
    • 90 GitHub stars
    • Developer tools
  3. Guides an AI agent to build Go command-line tools with clean flags, streams and exit codes

    • Open source
    • 90 GitHub stars
    • Developer tools
  4. Guides Go code toward constructor injection, explicit wiring and no global state

    • Open source
    • 90 GitHub stars
    • Developer tools
  5. Guides building Go GraphQL servers with gqlgen, covering N+1 batching and query limits

    • Open source
    • 90 GitHub stars
    • Developer tools
  6. Guides an AI agent through production gRPC services in Go: protos, errors, streaming

    • Open source
    • 90 GitHub stars
    • Developer tools