go-goroutine-auditor

Audit Go goroutine launches for missing cancellation and panic recovery.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-goroutine-auditor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-goroutine-auditor
Source: https://github.com/saddam-eng-tech/ai-agent-skills/tree/main/go-goroutine-auditor
Command: npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-goroutine-auditor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires errgroup, goleak, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the common and hard-to-debug issue of goroutine leaks in Go applications, which can lead to memory exhaustion and application instability.

Core Features & Use Cases

  • Goroutine Analysis: Scans Go source files to identify all goroutine launches.
  • Risk Assessment: Assigns a risk score (LOW/MEDIUM/HIGH) to each goroutine based on potential issues like missing context cancellation or panic recovery.
  • Refactoring Suggestions: Provides improved code examples using errgroup or sync.WaitGroup for better lifecycle management.
  • Testing Integration: Generates goleak test setups to catch leaks in CI/CD pipelines.

Quick Start

Audit all goroutines in the provided Go source files for potential leaks and suggest refactored code.

Frequently Asked Questions about go-goroutine-auditor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect goroutine leaks in Go source files?

Goroutine leak detection in Go source files is performed by parsing the code to identify `go func()` patterns and evaluating them for missing context cancellation and panic recovery. The audit assigns a risk score to each detected goroutine.

What causes a goroutine leak in Go applications?

Goroutine leaks in Go applications are typically caused by missing context cancellation, absent panic recovery, and poor lifecycle management. These issues prevent goroutines from terminating properly, which can lead to memory exhaustion and application instability.

How do I refactor Go code to use errgroup for concurrency safety?

Refactoring Go code to use errgroup for concurrency safety involves replacing vulnerable `go func()` patterns with structured errgroup implementations. This provides built-in error handling and lifecycle management for concurrent operations.

Can I use goleak to catch goroutine leaks in a CI CD pipeline?

Yes, you can use goleak to catch goroutine leaks in a CI CD pipeline by integrating generated goleak test setups. The audit provides these test configurations to automatically detect leaked goroutines during test execution.

What is the best way to audit Go goroutines for missing panic recovery?

The best way to audit Go goroutines for missing panic recovery is to scan the source files for `go func()` launches and assess their risk level. The analysis identifies missing mechanisms and provides refactored code suggestions.

Does this goroutine auditing process work with sync WaitGroup?

Yes, the goroutine auditing process evaluates existing concurrency code and suggests refactoring using either `errgroup` or `sync.WaitGroup`. This ensures proper lifecycle management regardless of the synchronization primitive used.