go-concurrency-patterns
Skill8 starsChanged 26 days agoMITView on GitHub
Master Go concurrency with goroutines, channels, sync primitives, and context. Use when building concurrent Go applications, implementing worker pools, or debugging race conditions.
11 other projects use a version of this, 9 of them edited.
Adopted by
Most recently taken up by
- chenwei791129/agent-skillsedited, first seen Oct 19, 2026
- xfstudio/skillsedited, first seen Oct 13, 2026
- Samueladewole/claude-skillsedited, first seen Oct 13, 2026
- carrot-hu23/dst-admin-goedited, first seen Oct 8, 2026
- narenaryan/agent-skillstheir own version, first seen Oct 7, 2026
- Ghosteken/agent-harnessedited, first seen Oct 1, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 9
- carrot-hu23/dst-admin-go★ 92019% same
- xfstudio/skills★ 944% same
- ai4brands-design/claude-skills★ 244% same
- CodeWithBehnam/cc-docs★ 219% same
- Ghosteken/agent-harness★ 232% same
- NorkzYT/claude-code-autopilot★ 219% same
- caijiatao/skills★ 125% same
- chenwei791129/agent-skills★ 019% same
- Samueladewole/claude-skills★ 019% same
Wrote their own version · 2
- codecharmhq/claude-code-skills★ 1same name
- narenaryan/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository99 other files it gives its agents.
- skills/react-hook-form-patterns/AGENTS.mdAGENTS.md
- skills/zod-schema-validation/AGENTS.mdAGENTS.md
- Add Admin API EndpointSkill
- add-malli-schemasSkill
- add-uint-supportSkill
- analytics-eventsSkill
- analyze-ciSkill
- asyncio-patternsSkill
- axum-web-patternsSkill
- bash-defensive-patternsSkill
- bats-shell-testingSkill
- bazel-build-optimizationSkill
- beautifulsoup-parsingSkill
- changelog-automationSkill
- cheerio-parsingSkill
- clap-cli-patternsSkill
- clojure-writeSkill
- cobra-cli-developmentSkill
- creating-financial-modelsSkill
- dbt-transformation-patternsSkill
- distributed-tracingSkill
- django-patternsSkill
- drizzle-orm-patternsSkill
- fastapi-patternsSkill
- fastify-patternsSkill
- fixSkill
- github-actions-templatesSkill
- gitlab-ci-patternsSkill
- gitops-workflowSkill
- go-cache-hotSkill
- go-errors-oopsSkill
- go-fx-diSkill
- go-monads-moSkill
- go-swagger-codegenSkill
- go-testify-patternsSkill
- grafana-dashboardsSkill
- graphql-schema-designSkill
- grpc-service-definitionSkill
- hono-patternsSkill
- implementing-agent-modesSkill
- implementing-jsc-classes-zigSkill
- istio-traffic-managementSkill
- jest-advanced-patternsSkill
- junit5-testingSkill
- k8s-manifest-generatorSkill
- kysely-query-builderSkill
- langsmith-fetchSkill
- linkerd-patternsSkill
- llm-evaluationSkill
- mcp-builderSkill
- mypy-type-checkingSkill
- networkx-graph-algorithmsSkill
- nx-workspace-patternsSkill
- pandas-dataframe-patternsSkill
- pillow-image-processingSkill
- polars-dataframeSkill
- prisma-schema-patternsSkill
- prometheus-configurationSkill
- prompt-engineering-patternsSkill
- pydicom-dicom-parsingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 98
Buffer channels: - When you know the count
- Distinctive: line 103
Don't leak goroutines: - Always have exit path
- Distinctive: line 106
Don't ignore context cancellation: - Check ctx.Done()
- Distinctive: line 107
Don't use time.Sleep for sync: - Use proper primitives
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Go Concurrency Patterns
Production patterns for Go concurrency including goroutines, channels, synchronization primitives, and context management.
When to Use This Skill
- Building concurrent Go applications
- Implementing worker pools and pipelines
- Managing goroutine lifecycles
- Using channels for communication
- Debugging race conditions
- Implementing graceful shutdown
Core Concepts
1. Go Concurrency Primitives
| Primitive | Purpose |
goroutine | Lightweight concurrent execution |
channel | Communication between goroutines |
select | Multiplex channel operations |
sync.Mutex | Mutual exclusion |
sync.WaitGroup | Wait for goroutines to complete |
context.Context | Cancellation and deadlines |
2. Go Concurrency Mantra
Don't communicate by sharing memory;
share memory by communicating.Quick Start
package main
import (
"context"
"fmt"
"sync"
"time"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
results := make(chan string, 10)
var wg sync.WaitGroup
// Spawn workers
for i := 0; i < 3; i++ {
wg.Add(1)
go worker(ctx, i, results, &wg)
}
// Close results when done
go func() {
wg.Wait()
close(results)
}()
// Collect results
for result := range results {
fmt.Println(result)
}
}
func worker(ctx context.Context, id int, results chan<- string, wg *sync.WaitGroup) {
defer wg.Done()
select {
case <-ctx.Done():
return
case results <- fmt.Sprintf("Worker %d done", id):
}
}Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
Do's
- Use context - For cancellation and deadlines
- Close channels - From sender side only
- Use errgroup - For concurrent operations with errors
- Buffer channels - When you know the count
- Prefer channels - Over mutexes when possible
Don'ts
- Don't leak goroutines - Always have exit path
- Don't close from receiver - Causes panic
- Don't use shared memory - Unless necessary
- Don't ignore context cancellation - Check ctx.Done()
- Don't use time.Sleep for sync - Use proper primitives
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

