Go Service Rules
by mochalatte
Enforce memory-safe concurrency, context propagation, and structured error handling in Go services.
Secure checkout via Stripe
Works with the AI tools you already use
See it in action
You say
Our sync service memory climbs until it gets OOM killed. It fans out to an API, one goroutine per order, results on a channel. If one fails, we return the error. How do I fix the leak?
Your agent does
Concurrency map
One goroutine per order, unbounded. One results channel with no buffer.
Findings
sync.go: Goroutine Lifetime rule 3. On error return, in-flight goroutines block forever on the unbuffered channel.
Patch
[Full code using errgroup.SetLimit and buffered channels...]
What you get
About this skill
The problem
Go makes concurrency easy to write but difficult to debug at scale. Silent goroutine leaks, unbuffered channel deadlocks, and missing context deadlines often pass unit tests only to crash services under production load.
What it does
- Analyzes goroutine lifetimes to ensure every routine has a defined exit path and cancellation listener.
- Identifies unsafe channel patterns, including receiver-side closes and unbuffered sends that lack select blocks.
- Audits context propagation to prevent disconnected cancellation chains and missing request deadlines.
- Refactors error handling to use structured wrapping with
errors.Isanderrors.Asinstead of bare returns. - Hardens
net/httpimplementations by enforcing timeouts and graceful shutdown sequences.
Frameworks & tools
Go 1.22+, errgroup, context, net/http, and the Go race detector.
Why this beats prompting it yourself
Generic LLMs often suggest code that compiles but leaks memory. This skill applies a strict "Starter owns the Stopper" ownership model and forces a Concurrency Map for every change, ensuring structural integrity that a standard prompt misses.
Use cases
- Fixing OOM kills caused by growing goroutine counts in long-running services.
- Implementing safe fan-out patterns using limited
errgroupconcurrency. - Adding graceful shutdown to HTTP servers to prevent dropped requests during deployments.
- Standardizing error wrapping across a microservice to improve observability.
Known limitations
This skill reviews and rewrites code in the editor but does not execute go test, the race detector, or profilers. Verification requires manual command execution.
How to install
Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 1 day ago
- 30-day refund guarantee
- One-time purchase, yours forever
- Secure checkout via Stripe
Frequently Asked Questions
Popular in AI Agents & LLM Ops
agentic-workflow
A risk-aware, evidence-based engineering lifecycle protocol for robust agentic task execution and safety.
designing-hybrid-context-layers
Architects the right retrieval strategy for every query — teaching your agent when to use RAG, a knowledge graph, or a temporal index instead of defaulting to vector search for everything.

prompt-engineer
Professional prompt engineering patterns for building robust, secure, and production-ready LLM applications.
skill-creator
The "Skill for building Skills": Automate creating, testing, and optimisation of custom workflows.