xxxryan

go-concurrency-audit

1
0
# Install this skill:
npx skills add xxxryan/agent-skills --skill "go-concurrency-audit"

Install specific skill from multi-skill repository

# Description

Audit Go code for concurrency bugs: data races, goroutine leaks, deadlocks, channel misuse, and context leaks. Use when the user mentions goroutines, worker pools, timeouts, stuck requests, high CPU, or race detector failures.

# SKILL.md


name: go-concurrency-audit
description: "Audit Go code for concurrency bugs: data races, goroutine leaks, deadlocks, channel misuse, and context leaks. Use when the user mentions goroutines, worker pools, timeouts, stuck requests, high CPU, or race detector failures."
compatibility: Best with local repo access and ability to run go test -race. Can also operate on pasted code/diff.
metadata:
short-description: Find Go concurrency bugs
allowed-tools: "Bash(go:) Bash(git:) Read"


Go Concurrency Audit

What to look for

  • Data races (shared state without sync)
  • Goroutine leaks (missing cancel/close, infinite loops)
  • Deadlocks (lock ordering, blocking sends/receives)
  • Channel ownership confusion (who closes)
  • Unbounded concurrency (fan-out without limits)
  • Context misuse (not passed, not honored, missing deadlines)

Workflow

  1. Identify concurrency surfaces
  2. goroutines, channels, mutexes, atomics, waitgroups, errgroup, pools

  3. Static audit (from code)

  4. Map lifecycle: who creates, who cancels, who waits
  5. Ensure every goroutine has an exit path
  6. Check select loops: default cases, timers, tickers are stopped
  7. Verify lock ordering and minimal critical sections

  8. Dynamic checks (if available)

  9. Run targeted tests with race detector:
    • go test ./... -race
  10. Suggest reproducer / stress tests if missing

Output format

Findings (with severity)

  • Blocker: ...
  • High: ...
  • Medium: ...
  • Low: ...

Suggested fixes

  • ...
  • ...

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.