concurrency-patterns-go

concurrency-patterns-go is a skill for Claude Code from VersoXBT/claude-initial-setup. It costs 60 tokens per session (1,755 once invoked), scanned A, original, MIT.

A guide to writing concurrent Go programs with goroutines, channels, synchronization tools, and cancellation contexts. It covers ways for multiple tasks to run and coordinate safely.

In plain words
What is it for?
Use it for worker pools, concurrent HTTP or file operations, timeouts, cancellation, and fan-in or fan-out pipelines.
Why use it?
It helps prevent race conditions, uncontrolled parallel work, missed errors, and tasks that keep running after they should stop.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-initial-setup plugin — 75 skills, 15 commands, 14 agents, 2 hooks shipped together

Good fit Use it for worker pools, concurrent HTTP or file operations, timeouts, cancellation, and fan-in or fan-out pipelines.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/versoxbt/claude-initial-setup/concurrency-patterns-go
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add VersoXBT/claude-initial-setup --skill concurrency-patterns-go
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup

Made for: Claude Code.

Or install claude-initial-setup, the plugin that ships this one along with the rest of its 75 skills, 15 commands, 14 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for concurrency-patterns-go

README.md
[![agentmods](https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/concurrency-patterns-go.svg)](https://agentmods.dev/skills/versoxbt/claude-initial-setup/concurrency-patterns-go)
Your own site
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/concurrency-patterns-go"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/concurrency-patterns-go.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,755 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.01755
Opus 5 $0.00030 $0.00877
Sonnet 5 $0.00012 $0.00351
Haiku 4.5 $0.00006 $0.00176

Measured 4d ago against content hash 373aceaacc23, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

concurrency-patterns-go scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/go/concurrency-patterns-go/SKILL.md · 306 lines

How it starts

The opening of the file, as written. The whole thing — 306 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go Concurrency Patterns

Write safe, efficient concurrent Go code using goroutines, channels, sync primitives, and context-based cancellation.

When to Use

  • Processing items concurrently (HTTP requests, file I/O, computations)
  • Building worker pools for bounded concurrency
  • Coordinating multiple goroutines with channels or sync primitives
  • Implementing timeouts and cancellation with context.Context
  • Designing fan-in/fan-out data pipelines

Core Patterns

Pattern 1: Goroutines with sync.WaitGroup

Spawn goroutines and wait for all to complete.

func processItems(items []Item) error {
    var (
        wg   sync.WaitGroup
        mu   sync.Mutex
        errs []error
    )

    for _, item := range items {
        wg.Add(1)
        go func() {
            defer wg.Done()
            if err := process(item); err != nil {
                mu.Lock()
                errs = append(errs, fmt.Errorf("item %s: %w", item.ID, err))
                mu.Unlock()
            }
        }()
    }

    wg.Wait()
    return errors.Join(errs...)
}

Pattern 2: Worker Pool with Bounded Concurrency

Limit concurrent work to avoid overwhelming resources.

func workerPool(ctx context.Context, jobs <-chan Job, workers int) <-chan Result {
    results := make(chan Result, workers)

    var wg sync.WaitGroup
    for range workers {
        wg.Add(1)
        go func() {
            defer wg.Done()
            for job := range jobs {
                select {
                case <-ctx.Done():
                    return
                default:
                    result, err := processJob(ctx, job)
                    if err != nil {
                        results <- Result{Err: err}
                        continue
                    }
                    results <- Result{Data: result}
                }
            }
        }()
    }

    go func() {
        wg.Wait()
        close(results)
    }()

    return results
}

// Usage
func run(ctx context.Context) error {
    jobs := make(chan Job, 100)

    go func() {
        defer close(jobs)
        for _, j := range allJobs {
            select {
            case jobs <- j:
            case <-ctx.Done():
                return
            }
        }
    }()

    for result := range workerPool(ctx, jobs, 10) {
        if result.Err != nil {
            slog.Error("job failed", "error", result.Err)
            continue
        }
        handleResult(result.Data)
    }
    return nil
}

Read the full file on GitHub · 306 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 306 lines · 60 tokens per session scan A 373aceaacc23

Subscribe to this mod's changes

concurrency-patterns-go is a skill published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 4mo ago), licensed MIT. It adds 60 tokens to every session and 1,755 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

golang-dependency-injection

Comprehensive guide for dependency injection (DI) in Golang. Covers why DI matters (testability, loose coupling, separation of concerns, lifecycle management), manual constructor injection, and DI library comparison (google/wire, uber-go/dig, uber-go/fx, samber/do). Use this skill when designing service architecture…

yzfly/skills · 110 tokens

golang-graphql

Implements GraphQL APIs in Golang using gqlgen or graphql-go. Apply when building GraphQL servers, designing schemas, writing resolvers, handling subscriptions, or integrating GraphQL with existing Go HTTP services. Also apply when the codebase imports github.com/99designs/gqlgen or github.com/graph-gophers/graphql-go.

yzfly/skills · 77 tokens

golang-grpc

Provides gRPC usage guidelines, protobuf organization, and production-ready patterns for Golang microservices. Use when implementing, reviewing, or debugging gRPC servers/clients, writing proto files, setting up interceptors, handling gRPC errors with status codes, configuring TLS/mTLS, testing with bufconn, or…

yzfly/skills · 72 tokens

golang-swagger

Golang OpenAPI/Swagger documentation with swaggo/swag — annotation comments (@Summary, @Param, @Success, @Router, @Security), swag init code generation, framework integrations (gin, echo, fiber, chi, net/http), security definitions (Bearer/JWT, OAuth2, API key), and struct tags (swaggertype, enums, example…

yzfly/skills · 146 tokens

claudehut-workflow

Use at the start of every session and whenever beginning a coding task in a Java/Spring backend - establishes the ClaudeHut 7-phase agentic workflow, the complexity-tier routing that lets small tasks skip deliberation phases, and the laws that govern which skills and rules must fire. Injected at session start; also…

taipt1504/claudehut · 86 tokens

fastapi-templates

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

wshobson/agents · 37 tokens