plugins/go-expert/skills/go-concurrency/SKILL.md
Use when: writing or reviewing Go concurrency — goroutines, channels, golang.org/x/sync/errgroup, context propagation and cancellation, sync.WaitGroup vs channels, the -race detector, or diagnosing goroutine leaks (incl. the 1.26 goroutineleak profile). Do NOT use for: sequential error handling / slog / generics / interface style (use go-core-idioms), non-Go languages, framework-specific code.
npx skillsauth add fusengine/agents go-concurrencyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Goroutines, channels, context, and errgroup for Go 1.26 — plus the number-one
documented pitfall: leaking goroutines on an unbuffered channel + early return.
Before ANY implementation, use TeamCreate to spawn 3 agents:
golang.org/x/sync/errgroup signaturesAfter implementation, run fuse-ai-pilot:sniper for validation, and run tests
with go test -race ./....
| Feature | Description |
|---------|-------------|
| Goroutines & channels | Lightweight concurrency + typed communication |
| errgroup | Parallelism + error aggregation + context cancellation |
| context | First param, propagated strictly, carries cancellation/deadline |
| WaitGroup vs channels | Counting-only vs result/error passing |
| Race detector | -race in tests/CI to catch data races |
| Leak profile (1.26) | GOEXPERIMENT=goroutineleakprofile / /debug/pprof/goroutineleak |
context.Context is the first parameter - named ctx, never stored in a structerrgroup for fan-out with errors - it handles wait + first error + cancel-race - a passing test without -race proves nothing about racesinternal/
├── fetch/
│ ├── fetch.go # errgroup.WithContext fan-out, bounded by SetLimit
│ └── worker.go # worker pool: fixed goroutines drain a jobs channel
└── pipeline/
└── stage.go # ctx-cancellable stages, buffered hand-off channels
→ See errgroup-patterns.md for full example
| Topic | Reference | When to Consult | |-------|-----------|-----------------| | Goroutines & channels | goroutines-channels.md | Buffered vs not, select, WaitGroup vs channels | | errgroup | errgroup.md | Fan-out, error aggregation, SetLimit, TryGo | | context | context-propagation.md | Cancellation, deadlines, propagation rules | | Goroutine leaks | goroutine-leaks.md | The #1 pitfall + the 1.26 leak profile |
| Template | When to Use | |----------|-------------| | errgroup-patterns.md | Bounded parallel work with error handling | | worker-pool.md | Fixed workers draining a job queue |
g, ctx := errgroup.WithContext(ctx)
g.SetLimit(8) // bound concurrency
for _, u := range urls {
g.Go(func() error { return fetch(ctx, u) })
}
if err := g.Wait(); err != nil { // first non-nil error; cancels ctx
return err
}
→ See errgroup.md
ch := make(chan result, len(items)) // buffered → early return can't strand senders
→ See goroutine-leaks.md
ctx first and thread it through every blocking callerrgroup before hand-rolling WaitGroup + error channelsgo test -race; try GOEXPERIMENT=goroutineleakprofile in CI (1.26)context.Context in a struct fieldsync.WaitGroup when goroutines return errors (use errgroup)-race flagtesting
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.