gleak

gleak is a skill for Claude Code from onsi/gomega. It costs 126 tokens per session (1,562 once invoked), scanned A, original, MIT.

A Go testing package that checks whether unexpected goroutines remain running after a test. A goroutine is a lightweight concurrent task in Go.

In plain words
What is it for?
It helps record allowed goroutines before a test and assert afterward that no additional goroutines were left behind.
Why use it?
It detects background tasks that a test started but failed to stop, which can cause flaky tests and resource leaks.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the gomega plugin — 12 skills shipped together

Good fit It helps record allowed goroutines before a test and assert afterward that no additional goroutines were left behind.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/onsi/gomega/gleak
About the project

Gomega is a Go library for writing test assertions with matchers, including support for asynchronous checks and several specialized testing sub-libraries. It is used by Go developers, especially alongside the Ginkgo behavior-driven testing framework, to express and evaluate test expectations. The catalogue entries are Claude Code skills and a plugin that help agents use Gomega's matchers and testing idioms.

onsi/gomega · 2,355 stars · on GitHub · onsi.github.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add onsi/gomega --skill gleak
Clone the repo
git clone --depth 1 https://github.com/onsi/gomega

Made for: Claude Code.

Or install gomega, the plugin that ships this one along with the rest of its 12 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gleak

README.md
[![agentmods](https://agentmods.dev/badge/skills/onsi/gomega/gleak.svg)](https://agentmods.dev/skills/onsi/gomega/gleak)
Your own site
<a href="https://agentmods.dev/skills/onsi/gomega/gleak"><img src="https://agentmods.dev/badge/skills/onsi/gomega/gleak.svg" alt="Measured on agentmods" height="20"></a>
Per session 126 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,562 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00126 $0.01562
Opus 5 $0.00063 $0.00781
Sonnet 5 $0.00025 $0.00312
Haiku 4.5 $0.00013 $0.00156

Measured 9d ago against content hash f11994bce38d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

gleak scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/gomega/skills/gleak/SKILL.md · 115 lines

How it starts

The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.

gleak: detecting leaked goroutines

gleak discovers all running goroutines and fails a test if any "leaked" — i.e. are still running after the test that aren't well-known framework/runtime goroutines and aren't on your ignore list. Docs: https://onsi.github.io/gomega/#gleak-finding-leaked-goroutines. Cross-refs: gomega:async, gomega:matchers.

gleak is an experimental Gomega package.

Import

import (
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/gleak" // often dot-imported too, for HaveLeaked/Goroutines/Ignoring*
)

The canonical pattern

Capture a baseline snapshot before the test; assert no leak after. The cleanup runs Eventually(Goroutines).ShouldNot(HaveLeaked(snapshot)):

BeforeEach(func() {
	goods := gleak.Goroutines()          // snapshot of "good" goroutines, taken now
	DeferCleanup(func() {
		Eventually(gleak.Goroutines).ShouldNot(gleak.HaveLeaked(goods))
	})
})

Equivalent BeforeEach/AfterEach form (carry the snapshot in a closure variable):

var goods []gleak.Goroutine
BeforeEach(func() { goods = gleak.Goroutines() })
AfterEach(func()  { Eventually(gleak.Goroutines).ShouldNot(gleak.HaveLeaked(goods)) })

Simplest possible form — no snapshot, relies only on the built-in well-known list:

AfterEach(func() {
	Eventually(gleak.Goroutines).ShouldNot(gleak.HaveLeaked())
})

Gotchas

ALWAYS use Eventually, never Expect. Goroutines wind down asynchronously; a synchronous Expect races their shutdown and produces false positives. Eventually re-polls until they terminate or it times out (default 1s / 10ms poll — see gomega:async to tune).

Pass Goroutines, not Goroutines(). Note the missing (). Eventually must call it repeatedly on each poll. Writing Eventually(gleak.Goroutines()) snapshots once and defeats the retry. (Calling gleak.Goroutines() with parens is correct only when taking a baseline snapshot to pass into HaveLeaked.)

Capture the baseline at the right time — in BeforeEach, before the test spins anything up, so genuinely pre-existing goroutines are filtered out.

Read the full file on GitHub · 115 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 115 lines · 126 tokens per session scan A f11994bce38d

Subscribe to this mod's changes

gleak is a skill published in the GitHub repository onsi/gomega (2,355 stars, last pushed 12d ago), licensed MIT. It adds 126 tokens to every session and 1,562 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

golang-testing

Production-ready Golang tests — table-driven tests, testify suites and mocks, parallel tests, fuzzing, fixtures, goroutine leak detection with goleak, snapshot testing, code coverage, integration tests, idiomatic test naming. Use when writing or reviewing Go tests, choosing a testing approach, setting up Go test CI…

samber/cc-skills-golang · 115 tokens

golang-stretchr-testify

Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use when writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Covers testify assertions, mock expectations, argument matchers, call verification…

samber/cc-skills-golang · 97 tokens

setup

Wire Ginkgo into a Go package — install the ginkgo CLI and Ginkgo+Gomega, ginkgo bootstrap to generate the suitetest.go (TestXxx/RegisterFailHandler(Fail)/RunSpecs), the package xxxtest convention, dot-import alternatives (aliased import, dsl/ subpackages, --nodot), ginkgo generate, and testing.T interop via…

onsi/ginkgo · 118 tokens

go-testing

Go testing patterns for Gentleman.Dots, including Bubbletea TUI testing. Trigger: When writing Go tests, using teatest, or adding test coverage.

Gentleman-Programming/Gentleman.Dots · 34 tokens

overview

The Ginkgo mental model for writing Go tests — the one idea that explains everything (Ginkgo builds a spec tree at construction time, then runs it) and its consequences for how you write specs, plus spec independence and the node taxonomy. Use this first when you start working with Ginkgo in a project, or to decide…

onsi/ginkgo · 84 tokens

golang-testing

Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices.

ufy2024/AuC · 35 tokens