Engineering GoConcurrencyGoroutines

Golang Pro

Go development patterns: goroutines, channels, context propagation, interfaces, error handling, testing, modules, and high-performance service design.

A production Go expert focused on idiomatic concurrency patterns, error wrapping with fmt.Errorf, interface-driven design, and building observable HTTP services with net/http. Covers goroutine lifecycle management, context cancellation, sync primitives (Mutex, WaitGroup, sync.Map), and the table-driven testing pattern with testify.

Added Mar 20, 2026

$npx skills add johnefemer/skillfish --skill golang-pro

What This Skill Can Do

Concrete capabilities you get when you install this skill.

Design goroutine pipelines with fan-out/fan-in and bounded concurrency

Implement context propagation for cancellation and deadline handling

Write idiomatic error wrapping with sentinel errors and fmt.Errorf %w

Design small, composable interfaces and dependency injection patterns

Profile CPU and memory with pprof and identify goroutine leaks

Structure Go modules and packages for maintainability at scale

Real Conversations

See how the Golang Pro skill responds to actual requests. These are representative examples of what your AI agent will produce.

You

I need to process 10,000 files concurrently but not spawn 10,000 goroutines at once. How do I implement a worker pool in Go?

Agent

Use a buffered channel as a semaphore to bound concurrency:

func processFiles(paths []string, maxWorkers int) error {
    sem := make(chan struct{}, maxWorkers) // semaphore
    var wg sync.WaitGroup
    errs := make(chan error, len(paths))

    for _, path := range paths {
        wg.Add(1)
        sem <- struct{}{} // acquire slot (blocks when at maxWorkers)
        go func(p string) {
            defer wg.Done()
            defer func() { <-sem }() // release slot
            if err := processFile(p); err != nil {
                errs <- fmt.Errorf("processing %s: %w", p, err)
            }
        }(path)
    }

    wg.Wait()
    close(errs)

    var combined []error
    for err := range errs {
        combined = append(combined, err)
    }
    return errors.Join(combined...)
}

For maxWorkers, start with runtime.NumCPU() for CPU-bound work or 50–100 for I/O-bound work (file reads).

If you need early cancellation on first error, add a context.WithCancel and check ctx.Err() at the top of each goroutine. The errgroup package (golang.org/x/sync/errgroup) wraps this entire pattern and is worth using for new code.

Get Started

How to install and use this skill in your preferred environment.

Skills are designed for AI coding agents (Claude Code, Cursor, Windsurf) and IDE-based workflows where the agent can read files, run scripts, and act on your codebase.

Models & Context

Which AI models and context windows work best with this skill.

Recommended Models

Claude Sonnet 4 or GPT-4o produce idiomatic Go; avoid models that suggest Java-style patterns. Gemini 2.5 Pro handles concurrent code reasoning well.

Context Window

SKILL.md ~5KB. Fits in 32K context; for large service refactors, 64K+ keeps full package trees visible.

Pro tips for best results

1

Be specific

Include numbers — users, budget, RPS — so the skill can size the architecture.

2

Share constraints

Compliance needs, team size, and existing stack all improve the output.

3

Iterate

Start with a high-level design, then ask follow-ups for IaC, cost analysis, or security review.

4

Combine skills

Pair with companion skills below for end-to-end coverage.

Works Great With

These skills complement Golang Pro for end-to-end coverage. Install them together for better results.

$ skillfish add johnefemer/skillfish --all # install all skills at once

Ready to try Golang Pro?

Install the skill and start getting expert-level guidance in your workflow — any agent, any IDE.

$npx skills add johnefemer/skillfish --skill golang-pro
← Browse all skills