agentsclimarketplace

Golang concurrency

Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/golang-concurrency

Standards for safe concurrent programming using Goroutines, Channels, and Context. Use when implementing concurrency with Goroutines, Channels, or Context in Go. (triggers: goroutine, go keyword, channel, mutex, waitgroup, context, errgroup, race condition)From its SKILL.md

Install
npx -y skills add ComeOnOliver/skillshub --skill golang-concurrency

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.7 KB, 319 tokens by cl100k_base, as published. Nobody here has run it

Golang Concurrency Standards

Priority: P0 (CRITICAL)

Principles

  • Share Memory by Communicating: Don't communicate by sharing memory. Use channels.
  • Context is King: Always pass ctx to efficient manage cancellation/timeouts.
  • Prevent Leaks: Never start a goroutine without knowing how it will stop.
  • Race Detection: Always run tests with go test -race.

Primitives

  • Goroutines: Lightweight threads. go func() { ... }()
  • Channels: For data passing + synchronization.
  • WaitGroup: Wait for a group of goroutines to finish.
  • ErrGroup: WaitGroup + Error propagation (Preferred).
  • Mutex: Protect shared state (simpler than channels for just state).

Guidelines

  • Buffered vs Unbuffered: Use unbuffered channels for strict synchronization. Use buffered only if you specifically need async decoupling/burst handling.
  • Closed Channels: Panic if writing to closed. Reading from closed returns zero-value immediately.
  • Select: Use select to handle multiple channels or timeouts.

References

Anti-Patterns

  • No goroutine leaks: Every goroutine needs a known exit path.
  • No global state mutation across goroutines: Use channels or sync primitives.
  • No bare goroutines without lifecycle: Use errgroup or WaitGroup.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.