golang-concurrency-safety
Skill15 starsChanged 9 months agoMITView on GitHub
Go concurrency safety review. Use when checking goroutines, channels, race conditions, or synchronization. Detects goroutine leaks, deadlocks, race conditions, and unsafe channel operations.
In this repository9 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
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 21
Use this skill when:
- Distinctive: line 65
Check against rules in priority order (Critical first)
- Distinctive: line 117
When reviewing code, use this format:
- Distinctive: line 145
Channels are for communication: - Use for passing ownership
- Distinctive: line 146
Mutexes are for state: - Use for protecting shared memory
- Distinctive: line 147
Always have exit conditions: - Every goroutine must be able to stop
- Distinctive: line 148
Context is the standard: - Use context.Context for cancellation
- Distinctive: line 158
All examples are tested and production-ready
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Golang Concurrency Safety
Expert-level concurrency safety review for Go applications. Detects common concurrency bugs that cause production failures, race conditions, deadlocks, and resource leaks.
When to Apply
Use this skill when:
- Reviewing code with goroutines or channels
- Debugging race conditions or deadlocks
- Auditing concurrent data access
- Investigating goroutine leaks or memory issues
- Writing new concurrent code
- Preparing concurrent code for production
Rule Categories by Priority
| Priority | Count | Focus |
| Critical | 5 | Prevents crashes, leaks, deadlocks |
| High | 4 | Correctness and reliability |
| Medium | 3 | Code quality and idioms |
Rules Covered (12 total)
Critical Issues (5)
critical-goroutine-leak- Goroutines must have exit conditionscritical-race-condition- Protect shared state with mutex/channelscritical-channel-deadlock- Ensure paired send/receive operationscritical-close-panic- Sender closes channel, not receivercritical-defer-in-loop- Avoid defer in loops (resource leaks)
High-Impact Patterns (4)
high-goroutine-unbounded- Limit concurrent goroutines (worker pool)high-channel-not-closed- Always close channels when donehigh-loop-variable-capture- Avoid closure over loop variableshigh-waitgroup-mismatch- Match Add() and Done() calls
Medium Improvements (3)
medium-directional-channels- Use send/receive-only channelsmedium-buffered-channel-size- Choose appropriate buffer sizemedium-select-default- Avoid busy-wait with select
How to Use
For Code Review
- Scan code for goroutine launches and channel operations
- Check against rules in priority order (Critical first)
- For each violation found, reference the specific rule file
- Provide exact line numbers and explanation
- Show corrected code example
Accessing Detailed Rules
Each rule file in rules/ contains:
- Brief explanation of why it matters
- Detection criteria (how to spot the issue)
- Incorrect code example (❌ BAD)
- Correct code example (✅ GOOD)
- Impact assessment
- References
Example:
rules/critical-goroutine-leak.md
rules/high-channel-not-closed.mdTrigger Phrases
This skill activates when you say:
- "Check for race conditions"
- "Review concurrency"
- "Find goroutine leaks"
- "Check for deadlocks"
- "Review channel usage"
- "Audit goroutine safety"
- "Check synchronization"
- "Review concurrent code"
Common Patterns
Goroutine leak detection:
Check this code for goroutine leaksRace condition audit:
Verify this concurrent code is safeChannel safety review:
Review channel usage for deadlocksOutput Format
When reviewing code, use this format:
## Critical Concurrency Issues: X
### [Rule Name] (Line Y)
**Issue**: Brief description
**Impact**: Race condition / Deadlock / Goroutine leak
**Fix**: Suggested correction
**Example**:
```go
// Corrected code hereHigh-Impact Patterns: X
[Similar format for high priority items]
Medium Improvements: X
[Similar format for medium priority items]
## Philosophy
Based on Katherine Cox-Buday's "Concurrency in Go":
- **Concurrency is not parallelism** - Design for coordination, not just speed
- **Channels are for communication** - Use for passing ownership
- **Mutexes are for state** - Use for protecting shared memory
- **Always have exit conditions** - Every goroutine must be able to stop
- **Context is the standard** - Use context.Context for cancellation
## Related Skills
- [golang-error-handling](../error-handling/SKILL.md) - For context propagation patterns
- [golang-clean-architecture](../clean-architecture/SKILL.md) - For usecase/repository concurrency patterns
## Notes
- Rules are evidence-based from authoritative Go concurrency books
- All examples are tested and production-ready
- Detection patterns help identify issues systematically
- Focused exclusively on concurrency safety (not general Go patterns)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.

