golang-concurrency
Golang concurrency patterns. Use when writing or reviewing concurrent Go code involving goroutines, channels, select, locks, sync primitives, errgroup, singleflight, worker pools, or fan-out/fan-in pipelines. Also triggers when you detect goroutine leaks, race conditions, channel
Profil de l’actif
Agents de code et de développement
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scénario
Agents de code
I need a coding agent that can understand a repository, edit code, and review pull requests.
Adéquation Agent
Claude Code + OpenAI Agents + CLI
Compatible avec Codex, Claude Code, Cursor, CLI ou des Agents personnalisés.
Installer
Prêt
npx skills add samber/cc-skills-golang --skill golang-concurrency
Maintenance
À jour
2 jours depuis le dernier push
Risque
Sûr à essayer
Quality score needs review
Qualité GitHub
3.0K
82/100 Qualité · 81/100 Confiance
Tags de couverture
Notes de revue
Quality score needs review
Carte d’adoption Agent
Confiance, audit et préparation à l’installation en un coup d’œil
Ces scores combinent les métadonnées publiques du dépôt, les signaux de revue OpenAgentSkill, la fraîcheur de maintenance et la préparation à l’installation. Ils servent à présélectionner et ne remplacent pas la revue humaine.
Qualité
SolideSolid option that is likely worth shortlisting for production workflows.
Confiance
Sandbox uniquementCandidate utile avec des signaux de confiance incomplets ou mixtes. Gardez-la dans un espace isolé jusqu’à ce que la boucle de résultats confirme son adéquation.
Audit
Sûr à essayerRevue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.
Trust Score OpenAgentSkill v5
Revue humaine avant installation
Exécutez uniquement dans un sandbox et comparez les alternatives proches avant usage réel.
Stars
3.0K stars GitHub
Activité du dépôt
3.0K stars et 197 forks
Maintenance
2 jours depuis le dernier push
Licence
MIT
Installer
npx skills add samber/cc-skills-golang --skill golang-concurrency
Sécurité d’installation
Chemin d’installation standard de package ou runtime
Surface de permissions
shell or command execution, network or browser access
Résultats Agent
Pas encore de données de résultats Agent
Documentation
Contexte README/SKILL.md solide
Résumé des risques
Revoir avant production
- Quality score needs review
Préparation à l’installation
Chemin d’installation disponible
- Le chemin d’installation est disponible
- La preuve du dépôt est disponible
- La licence est déclarée
- Pas encore de preuve de résultat Agent-Proven
Métadonnées lisibles par Agent
Données de décision lisibles par machine pour ce skill.
Utilisez ce bloc ou le JSON intégré pour décider si un Agent doit installer ce skill, choisir une alternative ou demander d’abord une revue humaine.
Tâches adaptées
- workflows Agents de code
- Équipes Claude Code
- Équipes qui valorisent les signaux d’adoption GitHub
- Inspect source files
Agents adaptés
Décision d’installation
- Commande
- npx skills add samber/cc-skills-golang --skill golang-concurrency
- Politique
- Revoir
- Revue humaine
- Oui
Confiance et risque
- Confiance
- 73/100
- Audit
- 85/100
- Niveau de risque
- Sûr à essayer
Boucle de résultat
- Endpoint
- /api/agent/outcome
- ID d’événement
- resolve
- Résultats
- 5
Commande d’installation
npx skills add samber/cc-skills-golang --skill golang-concurrencyNe pas utiliser quand
- Équipes qui nécessitent un SLA soutenu par le fournisseur
- Environnements fortement conformes sans revue interne de sécurité
- No major risk signals from current metadata
- Indices de permissions à haut risque : exécution shell ou de commande
- Quality score needs review
Skill alternatif
Code Review
168.6K Stars
npx skills add mattpocock/skills --skill code-review
Skill alternatif
Grill With Docs
164.7K Stars
npx skills add mattpocock/skills --skill grill-with-docs
Skill alternatif
To Spec
164.7K Stars
npx skills add mattpocock/skills --skill to-spec
Skill alternatif
To Tickets
176.7K Stars
npx skills add mattpocock/skills --skill to-tickets
Sécurité Agent v2
61/100 · Revoir avant installation
Candidat utilisable, mais l’Agent doit afficher les notes de permissions et d’audit avant l’installation.
Une approbation humaine est requise avant l’installation dans un espace de travail réel.
Élevé
Exécution shell ou de commande
Les métadonnées de la skill font référence à des workflows de terminal, CLI, shell, sous-processus ou exécution de commande.
Moyen
Accès réseau
La skill récupère probablement des pages distantes, API, dépôts ou services externes.
- Indices de permissions à haut risque : exécution shell ou de commande
- Quality score needs review
Cibles d’installation
Installer ce skill dans votre workflow Agent
Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.
OpenAgentSkill CLI
Resolve policy, run the source installer safely, and report a verified install receipt.
$ npx --yes https://github.com/Leon-Drq/openagentskill/releases/download/cli-v0.2.1/openagentskill-0.2.1.tgz install samber-golang-concurrencyPlan de résolution Agent
Laissez un Agent vérifier la pertinence avant l’installation.
L’API Resolve renvoie la skill sélectionnée, des alternatives, la politique de sécurité, les notes d’audit, la cible d’installation et un prompt prêt à l’emploi.
Ouvrir JSON
/api/agent/resolve?task=Use%20golang-concurrency%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Texte Resolve
/api/agent/resolve?task=Use%20golang-concurrency%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Relais d’installation
/api/skills/samber-golang-concurrency/install
L’Agent doit vérifier
- Task fit and alternatives from Resolve API.
- Audit score, trust score, and safety policy warnings.
- Install target compatibility for Codex, Claude Code, Cursor, or CLI.
Copier le prompt
Task: Use golang-concurrency in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20golang-concurrency%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/samber-golang-concurrency/install
Install command: npx skills add samber/cc-skills-golang --skill golang-concurrency
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Relais Agent
Donnez à l’Agent le chemin d’installation, pas un autre annuaire.
Utilisez le point de terminaison public pour récupérer la commande, la checklist, les prompts et les liens canoniques.
Relais d’installation
/api/skills/samber-golang-concurrency/install
Format texte LLM
/api/skills/samber-golang-concurrency/install?format=text
Trouver des alternatives
/api/skills/search?q=golang-concurrency&limit=3
Prompt Agent
Use golang-concurrency for this task. Review https://www.openagentskill.com/api/skills/samber-golang-concurrency/install, then install with: npx skills add samber/cc-skills-golang --skill golang-concurrencyMétadonnées Registry
Profil lisible par Agent pour la sélection automatique de skills.
L’API Registry fournit les signaux de décision, confiance, audit, cas d’usage et installation sans analyser l’interface.
Manifest
/api/registry/manifest/samber-golang-concurrency
Texte LLM
/api/registry/manifest/samber-golang-concurrency?format=text
Alias d’installation
/api/registry/install/samber-golang-concurrency
Recommander
/api/registry/recommend?task=Use%20golang-concurrency%20in%20an%20agent%20workflow&limit=3
Adéquation Agent
Agents de code
Tags de cas d’usage
Plateformes
Claude Code, OpenAI Agents
Rapport d’audit
Sûr à essayer · 85/100
Revue lisible par machine de la préparation à l’installation, des métadonnées de sécurité, de la maintenance et du risque d’adoption.
Panneau de décision Agent
Choix principal pour Agents de code
Use this as a leading candidate, then validate the README and install path in your own agent stack.
Rôle dans la pile
Choix principal
Pertinence principale
Agents de code
Libellé de confiance
Prêt pour la production
Chemin d’installation
Commande prête
À utiliser lorsque
- workflows Agents de code
- Équipes Claude Code
- Équipes qui valorisent les signaux d’adoption GitHub
Preuves
- 3,010 stars GitHub
- recent repository activity
- install command or GitHub repo available
- profil qualité 82/100
- 6 événements OpenAgentSkill
revoir d’abord
- No major risk signals from current metadata
Chemin d’implémentation
- 1Installez-le dans un Agent en sandbox et exécutez une tâche de Agents de code de bout en bout.
- 2Compare output quality, latency, and failure behavior against at least one alternative.
- 3Promote it into production only after reviewing repository permissions, license, and maintenance signals.
Profil de confiance
Sandbox uniquement
Candidate utile avec des signaux de confiance incomplets ou mixtes. Gardez-la dans un espace isolé jusqu’à ce que la boucle de résultats confirme son adéquation.
Adoption GitHub
Validé3.0K stars GitHub
Activité stars/forks
Info3.0K stars et 197 forks; l’activité des issues n’est pas disponible dans les métadonnées actuelles
Maintenance récente
Validé2 jours depuis le dernier push
Clarté de licence
ValidéMIT
Signaux positifs
- Revue IA approuvée
- Le chemin d’installation est disponible
- La preuve du dépôt est disponible
- Dépôt maintenu récemment
- Signal d’adoption GitHub significatif
- La commande d’installation ne présente aucun motif de haut risque évident
- La boucle de résultats est prête mais nécessite la première exécution réelle de l’Agent
Réviser avant installation
- Quality score needs review
- Pas encore de rapports de résultats Agent réels
- Une revue humaine est requise avant une installation sans surveillance
Action recommandée
Exécutez uniquement dans un sandbox et comparez les alternatives proches avant usage réel.
Profil qualité
Solide candidat pour les workflows Agent
Solid option that is likely worth shortlisting for production workflows.
Adéquation au workflow
Utilisez cette skill dans ces scénarios
Build and ship code
Coding agents
I need a coding agent that can understand a repository, edit code, and review pull requests.
Manage repositories
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Operate web apps
Browser automation
I need my agent to control a browser, fill forms, and verify web app workflows.
Adéquation au workflow
Ajouter à un workflow complet
Inspect, patch, and verify code
Coding review agent
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Operate and verify web apps
Browser QA agent
A workflow for agents that navigate products, fill forms, take screenshots, and verify real user flows across web applications.
Find, compare, and synthesize
Research report agent
A workflow for agents that gather sources, compare claims, summarize long material, and draft useful research briefs.
Liste d’alternatives
Comparer avant installation
Similar skills that may fit this task.
Code Review
Review a branch or diff against repository standards and the originating spec in two independent analysis passes.
Grill With Docs
A relentless interview that pressure-tests a plan against the codebase, sharpens domain language, and updates CONTEXT.md and ADRs when decisions become durable.
To Spec
Turn the current conversation and codebase context into a structured implementation spec, then publish it to the configured project issue tracker.
To Tickets
Break a plan, spec, or conversation into independently actionable tracer-bullet tickets with explicit blocking relationships.
Vue d’ensemble
--- name: golang-concurrency description: "Golang concurrency patterns. Use when writing or reviewing concurrent Go code involving goroutines, channels, select, locks, sync primitives, errgroup, singleflight, worker pools, or fan-out/fan-in pipelines. Also triggers when you detect goroutine leaks, race conditions, channel ownership issues, or need to choose between channels and mutexes." user-invocable: true license: MIT compatibility: Designed for Claude Code, Codex or similar harness, and for projects using Golang. metadata: author: samber version: "1.2.0" openclaw: emoji: "⚡" homepage: https://github.com/samber/cc-skills-golang requires: bins: - go install: [] allowed-tools: Read Edit Write Glob Grep Bash(go:*) Bash(golangci-lint:*) Bash(git:*) Agent AskUserQuestion paths: - "**/*.go" ---
**Persona:** You are a Go concurrency engineer. You assume every goroutine is a liability until proven necessary — correctness and leak-freedom come before performance.
**Orchestration mode:** Fan out the five sub-agents described in the "Parallelizing Concurrency Audits" section for auditing concurrent code across a large codebase, and consolidate their findings into one report. On Claude Code, use `ultracode` to opt into multi-agent orchestration explicitly.
**Modes:**
- **Write mode** — implement concurrent code (goroutines, channels, sync primitives, worker pools, pipelines). Follow the sequential instructions below. - **Review mode** — reviewing a PR's concurrent code changes. Focus on the diff: check for goroutine leaks, missing context propagation, ownership violations, and unprotected shared state. Sequential. - **Audit mode** — auditing existing concurrent code across a codebase. Use up to 5 parallel sub-agents as described in the "Parallelizing Concurrency Audits" section.
> **Community default.** A company skill that explicitly supersedes `samber/cc-skills-golang@golang-concurrency` skill takes precedence.
# Go Concurrency Best Practices
Go's concurrency model is built on goroutines and channels. Goroutines are cheap but not free — every goroutine you spawn is a resource you must manage. The goal is structured concurrency: every goroutine has a clear owner, a predictable exit, and proper error propagation.
## Core Principles
1. **Every goroutine must have a clear exit** — without a shutdown mechanism (context, done channel, WaitGroup), they leak and accumulate until the process crashes 2. **Share memory by communicating** — channels transfer ownership explicitly; mutexes protect shared state but make ownership implicit 3. **Send copies, not pointers** on channels — sending pointers creates invisible shared memory, defeating the purpose of channels 4. **Only the sender closes a channel** — closing from the receiver side panics if the sender writes after close 5. **Specify channel direction** (`chan<-`, `<-chan`) — the compiler prevents misuse at build time 6. **Default to unbuffered channels** — larger buffers mask backpressure; use them only with measured justification 7. **Always include `ctx.Done()` in select** — without it, goroutines leak after caller cancellation 8. **Avoid repeated `time.After` in hot loops** — each call allocates a timer and creates unnecessary churn; use `time.NewTimer` + `Reset` for long-running loops 9. **Track goroutine leaks in tests** with `go.uber.org/goleak`
For detailed channel/select code examples, see [Channels and Select Patterns](references/channels-and-select.md).
## Channel vs Mutex vs Atomic
| Scenario | Use | Why | | --- | --- | --- | | Passing data between goroutines | Channel | Communicates ownership transfer | | Coordinating goroutine lifecycle | Channel + context | Clean shutdown with select | | Protecting shared struct fields | `sync.Mutex` / `sync.RWMutex` | Simple critical sections | | Simple counters, flags | `sync/atomic` | Lock-free, lower overhead | | Many readers, few writers on a map | `sync.Map` | Optimized for read-heavy workloads. **Concurrent map read/write causes a hard crash** | | Caching expensive computations | `sync.Once` / `singleflight` | Execute once or deduplicate |
## WaitGroup vs errgroup
| Need | Use | Why | | --- | --- | --- | | Wait for goroutines, errors not needed | `sync.WaitGroup` | Fire-and-forget | | Wait + collect first error | `errgroup.Group` | Error propagation | | Wait + cancel siblings on first error | `errgroup.WithContext` | Context cancellation on error | | Wait + limit concurrency | `errgroup.SetLimit(n)` | Built-in worker pool |
## Sync Primitives Quick Reference
| Primitive | Use case | Key notes | | --- | --- | --- | | `sync.Mutex` | Protect shared state | Keep critical sections short; never hold across I/O | | `sync.RWMutex` | Many readers, few writers | Never upgrade RLock to Lock (deadlock) | | `sync/atomic` | Simple counters, flags | Prefer typed atomics (Go 1.19+): `atomic.Int64`, `atomic.Bool` | | `sync.Map` | Concurrent map, read-heavy | No explicit locking; use `RWMutex`+map when writes dominate | | `sync.Pool` | Reuse temporary objects | Always `Reset()` before `Put()`; reduces GC pressure | | `sync.Once` | One-time initialization | Go 1.21+: `OnceFunc`, `OnceValue`, `OnceValues` | | `sync.WaitGroup` | Waiting for simple goroutines | Go 1.25+: prefer `wg.Go(func(){ ... })` for fire-and-wait tasks that do not panic and do not need error propagation. For Go <1.25 use `Add`/`Done`. For errors/cancellation/limits, use `errgroup` with context. | | `x/sync/singleflight` | Deduplicate concurrent calls | Cache stampede prevention | | `x/sync/errgroup` | Goroutine group + errors | `SetLimit(n)` replaces hand-rolled worker pools |
For detailed examples and anti-patterns, see [Sync Primitives Deep Dive](references/sync-primitives.md).
## Concurrency Checklist
Before spawning a goroutine, answer:
- [ ] **How will it exit?** — context cancellation, channel close, or explicit signal - [ ] **Can I signal it to stop?** — pass `context.Context` or done channel - [ ] **Can I wait for it?** — `sync.WaitGroup` or `errgroup` - [ ] **Who owns the channels?** — creator/sender owns and closes - [ ] **Should this be synchronous instead?** — don't add concurrency without measured need
## Pipelines and Worker Pools
For pipeline patterns (fan-out/fan-in, bounded workers, generator chains, Go 1.23+ iterators, `samber/ro`), see [Pipelines and Worker Pools](references/pipelines.md).
## Parallelizing Concurrency Audits
When auditing concurrency across a large codebase, use up to 5 parallel sub-agents:
1. Find all goroutine spawns (`go func`, `go method`) and verify shutdown mechanisms 2. Search for mutable globals and shared state without synchronization 3. Audit channel usage — ownership, direction, closure, buffer sizes 4. Find `time.After` in loops, missing `ctx.Done()` in select, unbounded spawning 5. Check mutex usage, `sync.Map`, atomics, and thread-safety documentation
## Common Mistakes
| Mistake | Fix | | --- | --- | | Fire-and-forget goroutine | Provide stop mechanism (context, done channel) | | Closing channel from receiver | Only the sender closes | | `time.After` in hot loop | Reuse `time.NewTimer` + `Reset` | | Missing `ctx.Done()` in select | Always select on context to allow cancellation | | Unbounded goroutine spawning | Use `errgroup.SetLimit(n)` or semaphore | | Sharing pointer via channel | Send copies or immutable values | | `wg.Add` inside goroutine | Call `Add` before `go` — `Wait` may return early otherwise | | Forgetting `-race` in CI | Always run `go test -race ./...` | | Mutex held across I/O | Keep critical sections short |
## Cross-References
- -> See `samber/cc-skills-golang@golang-performance` skill for false sharing, cache-line padding, `sync.Pool` hot-path patterns - -> See `samber/cc-skills-golang@golang-context` skill for cancellation propagation and timeout patterns - -> See `samber/cc-skills-golang@golang-safety` skill for concurrent map access and race condition prevention - -> See `samber/cc-skills-golang@golang-troubleshooting` skill for debugging goroutine leaks and deadlocks - -> See `samber/cc-skills-golang@golang-design-patterns` skill for graceful shutdown patterns - -> See `samber/cc-skills-golang@golang-continuous-integration` skill for automated AI-driven code review in CI using these guidelines
### Go 1.26 experimental goroutine leak profile
For Go 1.26 diagnostics, there is an experimental goroutine leak profile. It is useful for production-oriented leak investigation, but is gated by `GOEXPERIMENT=goroutineleakprofile`; do not rely on it as default stable behavior.
Typical usage when the experiment is enabled:
```bash curl http://localhost:6060/debug/pprof/goroutineleak?debug=2 go tool pprof http://localhost:6060/debug/pprof/goroutineleak ```
Keep existing tools:
- tests: `go.uber.org/goleak` - runtime count: `runtime.NumGoroutine()` - stack dump: `/debug/pprof/goroutine?debug=2` - race checks: `go test -race ./...`
## References
- [Go Concurrency Patterns: Pipelines](https://go.dev/blog/pipelines) - [Effective Go: Concurrency](https://go.dev/doc/effective_go#concurrency)
Détails techniques
- Version
- 1.0.0
- Licence
- MIT
- Dernière mise à jour
- 20 août 2026
- Publié
- 20 août 2026
Instantané de décision
Choix principal
3,010 stars GitHub
Audit
Revue d’installation
Revue d’installation et d’adoption
- Sécurité
- 83/100
- Maintenance
- 100/100
- Installer
- 92/100
Preuves validées par Agent
Preuves validées par Agent
Rapports après resolve, revue, installation et une exécution limitée.
- Taux de réussite
- —
- Échec récent
- —
- Résultats
- 0
- Qualité de sortie
- —
- Échecs
- 0
- Non pertinent
- 0
- Installations
- 0
- Bloqué par le risque
- 0
- Configuration requise
- 0
- Production
- 0
Aucune donnée de résultat Agent pour l’instant. La première exécution peut signaler succès, besoin de configuration, blocage de risque, échec ou non-pertinence via /api/agent/outcome.
Installer
Ajouter au workflow Agent
Gratuit et open source. Examinez le rapport avant l’installation dans des Agents de production.
Boucle de croissance
Kit de partage
Brouillon guidé par scénario pour golang-concurrency, prêt pour une publication manuelle sur X.
golang-concurrency: Golang concurrency patterns. Use when writing or reviewing concurrent Go code involving gorou... 3.0K stars https://www.openagentskill.com/skills/samber-golang-concurrency?ref=x
Réponse facultative avec commande d’installation
Listing + install path for golang-concurrency: https://www.openagentskill.com/skills/samber-golang-concurrency?ref=x Install: npx skills add samber/cc-skills-golang --skill golang-concurrency
Source de la fiche
Indexé par Registry
Cette fiche a été indexée à partir de sources publiques et n’est pas marquée officielle tant qu’une revendication de mainteneur n’est pas approuvée.
- Créateur
- samber
- Source
- samber/cc-skills-golang
- Indexé par
- Index communautaire OpenAgentSkill
L’attribution renvoie au dépôt public ou au profil du créateur. Les créateurs peuvent revendiquer la fiche pour mettre à jour les signaux de propriété.
Revendiquer ce skillRevendication du propriétaire
Revendiquer cette fiche de skill
Cette fiche Indexé par Registry est attribuée à samber, mais n’est pas encore marquée officielle. Revendiquez-la pour ajouter un signal de propriétaire vérifié et rendre les futures mises à jour de lancement, d’installation et d’audit plus fiables.
Kit de backlinks créateur
Ajoutez les badges de preuve à votre README
Affichez la fiche canonique, les signaux actuels de confiance et d’audit, ainsi que de vraies preuves Agent-Proven là où les développeurs évaluent le dépôt.
[](https://www.openagentskill.com/skills/samber-golang-concurrency)
[](https://www.openagentskill.com/skills/samber-golang-concurrency)
[](https://www.openagentskill.com/skills/samber-golang-concurrency/audit)
[](https://www.openagentskill.com/skills/samber-golang-concurrency)Auteur
samber
@samber
Tags
Adéquation plateforme
Signaux de santé
- Stars GitHub
- 3.0K
- Score de qualité
- 48/100
- Dernier push GitHub
- 20 août 2026
- Indications de framework
- Inconnu
- Vues OpenAgentSkill
- 6
- Copies d’installation
- 0
- Clics sortants
- 0
Signal de communauté
Indiquez si ce skill semble utile à votre workflow Agent. Les retours agrégés améliorent le classement au fil du temps.
Confiance et sécurité
Sandbox uniquement
- Adoption GitHub3.0K stars GitHubValidé
- Activité stars/forks3.0K stars et 197 forks; l’activité des issues n’est pas disponible dans les métadonnées actuellesInfo
- Maintenance récente2 jours depuis le dernier pushValidé
- Clarté de licenceMITValidé
- Complétude README/SKILL.mdLes métadonnées incluent suffisamment de contexte d’usage et de workflowValidé
- Risque dépendances/runtimecommand execution surface, network or browser surfaceInfo
Skills associés
Code Review
Review a branch or diff against repository standards and the originating spec in two independent analysis passes.
168.6K StarsGrill With Docs
A relentless interview that pressure-tests a plan against the codebase, sharpens domain language, and updates CONTEXT.md and ADRs when decisions become durable.
164.7K StarsTo Spec
Turn the current conversation and codebase context into a structured implementation spec, then publish it to the configured project issue tracker.
164.7K StarsTo Tickets
Break a plan, spec, or conversation into independently actionable tracer-bullet tickets with explicit blocking relationships.
176.7K Stars