# Go design patterns

> Go design patterns is an open-source agent skill for developer tools. Guides Go code toward idiomatic design patterns like functional options and factories. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/eduardo-sl/go-agent-skills/tree/main/skills/(architecture)/go-design-patterns
- **Repository:** https://github.com/eduardo-sl/go-agent-skills
- **GitHub stars:** 90
- **License:** MIT
- **Skill name:** go-design-patterns
- **Collection:** https://github.com/eduardo-sl/go-agent-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

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).

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/eduardo-sl/go-agent-skills/tree/HEAD/skills/(architecture)/go-design-patterns)
- [Asks for: Read, Edit, Write, Glob, Grep, Bash(go:*), Bash(gofmt:*)](https://github.com/eduardo-sl/go-agent-skills/blob/HEAD/skills/(architecture)/go-design-patterns/SKILL.md)
- [License: MIT](https://github.com/eduardo-sl/go-agent-skills/tree/HEAD/skills/(architecture)/go-design-patterns)

## Features

- **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

## Install

### Any agent

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

## 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.

## Alternatives

- [Go interface design](https://ai-powered.com/skills/go-interface-design): Go interface design is an open-source agent skill for developer tools.
- [Go test quality](https://ai-powered.com/skills/go-test-quality): Go test quality is an open-source agent skill for developer tools.
- [Go API design](https://ai-powered.com/skills/go-api-design): Go API design is an open-source agent skill for developer tools.
- [Go coding standards](https://ai-powered.com/skills/go-coding-standards): Go coding standards is an open-source agent skill for developer tools.
- [Error handling](https://ai-powered.com/skills/error-handling): Error handling is an open-source agent skill for developer tools.
- [Go dependency injection](https://ai-powered.com/skills/go-dependency-injection): Go dependency injection is an open-source agent skill for developer tools.
- [Go GRPC](https://ai-powered.com/skills/go-grpc): Go GRPC is an open-source agent skill for developer tools.
- [Go performance review](https://ai-powered.com/skills/go-performance-review): Go performance review is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/go-design-patterns
