Skip to content
affaan-m avatar

Golang Patterns

Idiomatic Go patterns covering error handling, concurrency, and interface design for maintainable applications.

CCM score
65 of 100
skills.sh installs
18.1K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers core principles, error wrapping, concurrency with worker pools and context, and interface design for Go code
  • Includes runnable examples such as errors.Is/errors.As checks, errgroup coordination, and goroutine-leak-safe channel sends
  • Enforces rules like never ignoring errors, accepting interfaces while returning structs, and defining interfaces where they are used
  • Designed for developers writing, reviewing, or refactoring Go code when idiomatic structure or conventions are in question

Install

$ npx -y skills add affaan-m/ecc --skill golang-patterns -y

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

Files

Go Development Patterns

Idiomatic Go patterns and best practices for building robust, efficient, and maintainable applications.

When to Activate

  • Writing new Go code
  • Reviewing Go code
  • Refactoring existing Go code
  • Designing Go packages/modules

Core Principles

1. Simplicity and Clarity

Go favors simplicity over cleverness. Code should be obvious and easy to read.

// Good: Clear and direct
func GetUser(id string) (*User, error) {
    user, err := db.FindUser(id)
    if err != nil {
        return nil, fmt.Errorf("get user %s: %w", id, err)
    }
    return user, nil
}

// Bad: Overly clever
func GetUser(id string) (*User, error) {
    return func() (*User, error) {
        if u, e := db.FindUser(id); e == nil {
            return u, nil
        } else {
            return nil, e
        }
    }()
}

2. Make the Zero Value Useful

Design types so their zero value is immediately usable without initialization.

// Good: Zero value is useful
type Counter struct {
    mu    sync.Mutex
    count int // zero value is 0, ready to use
}

func (c *Counter) Inc() {
    c.mu.Lock()
    c.count++
    c.mu.Unlock()
}

Details

Repository
github.com/affaan-m/ecc
Categories
Go, Code Review & Quality
First seen
Jul 14, 2026

Questions

What are the Go patterns and conventions that the golang-patterns skill teaches?

The golang-patterns skill covers idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications. It guides simplicity and clarity, useful zero values, accepting interfaces while returning structs, error wrapping, concurrency with worker pools and context, and interface design.

How do I install the golang-patterns skill?

Run npx -y skills add affaan-m/ecc --skill golang-patterns -y in your project to install it. Once installed, the agent can apply these Go patterns when you write, review, or refactor Go code and package structure.

Where does golang-patterns rank in the Go category on Claude Marketplaces?

The golang-patterns skill ranks in the top 50 of the Go category on Claude Marketplaces. Its own focus is broad Go idioms, covering structure and conventions alongside error handling and concurrency topics.

When should I use the golang-patterns skill?

Use it when writing new Go code, reviewing Go code, refactoring existing Go code, or designing Go packages and modules. It is most useful when idiomatic structure or conventions are in question.

More from affaan-m/ecc

All 257

Similar to Golang Patterns

More Go