Agent skill
Concurrency
Standards for safe concurrent programming using Goroutines, Channels, and Context.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/concurrency-hoangnguyen0403-agent-skills-standar-2
Metadata
Additional technical details for this skill
- labels
-
golang concurrency goroutines channels context sync
- triggers
-
{ "files": [ "**/*.go" ], "keywords": [ "goroutine", "go keyword", "channel", "mutex", "waitgroup", "context" ] }
SKILL.md
Golang Concurrency Standards
Priority: P0 (CRITICAL)
Principles
- Share Memory by Communicating: Don't communicate by sharing memory. Use channels.
- Context is King: Always pass
ctxto 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
selectto handle multiple channels or timeouts.
References
- Concurrency Patterns
- Context Usage
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?