affaan-m avatar

Golang Patterns

This one's a solid reference for writing Go the way the language designers intended. It covers the fundamentals like making zero values useful, accepting interfaces but returning structs, and proper error wrapping with fmt.Errorf. The concurrency section is especially practical, showing worker pools, errgroup usage, and how to avoid goroutine leaks with buffered channels and context. What I like is it doesn't just tell you the rules, it shows bad examples alongside good ones so you can see why idiomatic Go matters. Activate this when you're writing new Go code or reviewing pull requests and want to keep things simple and maintainable instead of clever.

skills.sh installs
6.3K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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()
}

Sponsors

Details

Repository
github.com/affaan-m/ecc
Category
Go
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263

Recommended

More Go
1manutej avatargolang-backend-developmentmanutej/luxor-claude-marketplaceComplete guide for Go backend development including concurrency patterns, web servers, database integration, microservices, and production deployment1.4Kskills.sh installs
2mindrally avatargo-backend-microservicesmindrally/skillsGo backend development best practices for microservices with clean architecture, observability, and production-ready patterns855skills.sh installs
3sickn33 avatargolang-prosickn33/antigravity-awesome-skillsgolang pro455skills.sh installs
4bobmatnyc avatargolang-concurrency-patternsbobmatnyc/claude-mpm-skillsGo concurrency patterns for production services: context cancellation, errgroup, worker pools, bounded parallelism, fan-in/fan-out, and common race/deadlock pit420skills.sh installs
5sickn33 avatargo-concurrency-patternssickn33/antigravity-awesome-skillsgo concurrency patterns263skills.sh installs
6samber avatargolang-code-stylesamber/cc-skills-golangGolang code style conventions — line length and breaking, variable declarations, control flow clarity, when comments help vs hurt. Use when writing or reviewing46.1Kskills.sh installs