golang

Expert Go language development including idiomatic patterns, concurrency, performance optimization, and ecosystem best practices

15 stars

Best use case

golang is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Expert Go language development including idiomatic patterns, concurrency, performance optimization, and ecosystem best practices

Teams using golang should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/golang/SKILL.md --create-dirs "https://raw.githubusercontent.com/re-cinq/wave/main/.claude/skills/golang/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/golang/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How golang Compares

Feature / AgentgolangStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Expert Go language development including idiomatic patterns, concurrency, performance optimization, and ecosystem best practices

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

## User Input

```text
$ARGUMENTS
```

You **MUST** consider the user input before proceeding (if not empty).

## Outline

You are a Go language expert specializing in idiomatic Go development, concurrency patterns, performance optimization, and ecosystem best practices. Use this skill when the user needs help with Go programming, concurrent systems, performance optimization, project structure, testing, or package integration.

## Core Go Expertise

### 1. Language Fundamentals
- **Idiomatic Go**: Follow Go conventions and idioms
- **Error handling**: Proper use of error wrapping and handling patterns
- **Interface design**: Design clear, composable interfaces
- **Package structure**: Organize code following Go conventions
- **Naming conventions**: CamelCase for exported, camelCase for unexported

### 2. Concurrency Patterns
- **Goroutines**: Proper lifecycle management and cancellation
- **Channels**: Buffered vs unbuffered, select statements
- **Sync primitives**: Mutex, RWMutex, WaitGroup, Once
- **Context**: Context propagation for cancellation and deadlines
- **Worker pools**: Fan-in/Fan-out patterns

### 3. Performance Optimization
- **Profiling**: Use pprof for CPU and memory profiling
- **Memory management**: Reduce allocations, use object pools
- **Benchmarking**: Write proper benchmarks with testing.B
- **Escape analysis**: Understand stack vs heap allocation

### 4. Ecosystem and Tooling
- **Go modules**: Module management and versioning
- **Testing**: Table-driven tests, benchmarks, race detection
- **Linting**: golangci-lint with proper configuration

## Key Patterns

### Error Handling
```go
func processFile(filename string) error {
    data, err := os.ReadFile(filename)
    if err != nil {
        return fmt.Errorf("failed to read file %s: %w", filename, err)
    }
    return nil
}
```

### Worker Pool
```go
func workerPool(jobs <-chan Job, results chan<- Result, workerCount int) {
    var wg sync.WaitGroup
    for i := 0; i < workerCount; i++ {
        wg.Add(1)
        go func() {
            defer wg.Done()
            for job := range jobs {
                results <- processJob(job)
            }
        }()
    }
    wg.Wait()
    close(results)
}
```

### Interface Composition
```go
type ReadWriter interface {
    Reader
    Writer
}
func ProcessData(w io.Writer, data []byte) error {
    _, err := w.Write(data)
    return err
}
```

## Essential Commands
```bash
go mod tidy          # tidy dependencies
go test ./...        # run all tests
go test -race ./...  # race detection
go test -bench=. -benchmem  # benchmarks
go test -cover ./... # coverage
golangci-lint run    # lint
go tool pprof http://localhost:6060/debug/pprof/profile
```

## Table-Driven Tests
```go
func TestAdd(t *testing.T) {
    tests := []struct{ name string; a, b, expected int }{
        {"positive", 2, 3, 5},
        {"negative", -2, -3, -5},
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            if got := Add(tt.a, tt.b); got != tt.expected {
                t.Errorf("Add(%d, %d) = %d; want %d", tt.a, tt.b, got, tt.expected)
            }
        })
    }
}
```

## Approach

1. Provide idiomatic Go solutions using standard library first
2. Prioritize simplicity, readability, proper error handling
3. Include tests; consider efficiency and memory usage
4. Follow Go conventions and community standards

## Complete Reference

For exhaustive patterns, examples, and advanced usage see:

**[`references/full-reference.md`](references/full-reference.md)**

Related Skills

We are still matching the closest adjacent skills for this page. In the meantime, continue through the full directory.