Agent skill

Async

by onsi in onsi/gomega

Polling assertions in Gomega — Eventually (poll until it passes) and Consistently (must keep passing), the func(g Gomega) callback idiom, WithTimeout/WithPolling/Within/ProbeEvery, WithContext and…

MITAuto-check passedDevelopment

Install Async

skills CLI
$ npx skills add onsi/gomega --skill async -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install onsi/gomega async --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/onsi/gomega.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/gomega/skills/async .claude/skills/async && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
async
GitHub stars
2.4k
Token cost
~2.2k tokens
SKILL.md length
716 words
Files
1
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Polling assertions in Gomega — Eventually (poll until it passes) and Consistently (must keep passing), the func(g Gomega) callback idiom, WithTimeout/WithPolling/Within/ProbeEvery, WithContext and…

  • An assertion cant be true synchronously — anything involving goroutines
  • SKILL.md covers The three things you can poll, Configuring timeout & polling, Contexts & cancellation and Bailing out early: StopTrying…, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Eventual consistency

What it does

Async is an agent skill from onsi/gomega. Polling assertions in Gomega — Eventually (poll until it passes) and Consistently (must keep passing), the func(g Gomega) callback idiom, WithTimeout/WithPolling/Within/ProbeEvery, WithContext and Ginkgo SpecContext, StopTrying/TryAgainAfter bail-outs, MustPassRepeatedly, and default-interval tuning. Use when an assertion can't be true synchronously — anything involving goroutines, channels, network calls, eventual consistency, or "wait until / stays true".

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Async programming. The repository describes itself as: Ginkgo's Preferred Matcher Library. The licence is MIT.

When your agent uses it

  • An assertion cant be true synchronously — anything involving goroutines
  • Eventual consistency
  • Wait until / stays true

Example prompts

  • “wait until / stays true”
  • “/async”

What it can do on your machine

Read from SKILL.md and the folder at commit 37fa900. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are go).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • onsi.github.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Async loads about 2.2k tokens when it runs. Until then it costs about 117 tokens; SKILL.md has 716 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~117
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from onsi/gomega at commit 37fa900, republished under its MIT licence (© onsi). 716 words, ~2,151 tokens.

Download SKILL.mdSave it as .claude/skills/async/SKILL.md (or your agent's skills folder).
name
async
description
Polling assertions in Gomega — Eventually (poll until it passes) and Consistently (must keep passing), the func(g Gomega) callback idiom, WithTimeout/WithPolling/Within/ProbeEvery, WithContext and Ginkgo SpecContext, StopTrying/TryAgainAfter bail-outs, MustPassRepeatedly, and default-interval tuning. Use when an assertion can't be true synchronously — anything involving goroutines, channels, network calls, eventual consistency, or "wait until / stays true".

Asynchronous assertions: Eventually & Consistently

Expect asserts now. When the thing under test settles over time, poll it. See gomega:overview for the mental model and gomega:assertions for the synchronous side. Dot-import assumed; with plain testing use g := NewWithT(t) and call g.Eventually(...). Docs: https://onsi.github.io/gomega/#making-asynchronous-assertions.

  • Eventually — polls until the matcher passes or the timeout elapses. Default: poll every 10ms for up to 1s.
  • Consistently — polls for the whole duration and fails if the matcher ever fails. Default: poll every 10ms for 100ms. Use it to assert something "does not eventually" happen.
go
Eventually(client.FetchCount).Should(BeNumerically(">=", 17))
Consistently(channel).ShouldNot(Receive())   // nothing ever arrives

The three things you can poll

1. A bare value — rarely what you want. Gomega passes the value to the matcher every poll, but nothing re-reads it.

go
Eventually(c, "50ms").Should(BeClosed())   // works: matcher re-inspects the channel

This is only correct for values whose matcher re-inspects live state (channels, *gexec.Session, *gbytes.Buffer). Gotcha: Eventually(s).Should(Equal("changed")) or Eventually(slice).Should(HaveLen(3)) will not see updates — the value is captured once, and racing a goroutine over it trips the race detector. Pass a function instead.

2. A function returning at least one value. Polled repeatedly; the first return value goes to the matcher.

go
Eventually(func() int { return client.FetchCount() }).Should(BeNumerically(">=", 17))

The multi-return error idiom applies: extra return values must all be zero, so a (value, error) function fails the poll while err != nil and matches value once it's nil.

go
func FetchFromDB() (string, error)
Eventually(FetchFromDB).Should(Equal("got it"))   // passes when err==nil AND string matches

Pass arguments with .WithArguments(...) (supports variadic):

go
Eventually(FetchFullName).WithArguments(1138).Should(Equal("Wookie"))

3. A func(g Gomega) callback — the recommended powerful form. The function makes its own assertions against the passed-in g; the whole block is retried until every assertion passes. Return zero values and match with Succeed, or return values to also match the result.

go
Eventually(func(g Gomega) {
    model, err := client.Find(1138)
    g.Expect(err).NotTo(HaveOccurred())
    g.Expect(model.Reticulate()).To(Succeed())
    g.Expect(model.IsReticulated()).To(BeTrue())
}).Should(Succeed())

Eventually(func(g Gomega) (Widget, error) {
    ids, err := client.FetchIDs()
    g.Expect(err).NotTo(HaveOccurred())
    g.Expect(ids).To(ContainElement(1138))
    return client.FetchWidget(1138)
}).Should(Equal(expectedWidget))

Gotcha: inside the callback you must use the passed-in g, not the global Expect. Global assertions aren't intercepted by Eventually and will fail the test on the first miss instead of being retried.

Configuring timeout & polling

Optional positional args (after ACTUAL): timeout, then polling interval, then context.Context. Each duration may be a time.Duration, a parseable string ("100ms"), or a float64 (interpreted as seconds).

go
Eventually(ACTUAL, "2s", "50ms").Should(MATCHER)
Consistently(ACTUAL, 500*time.Millisecond).Should(MATCHER)

Equivalently — and more readable — chain. Within/ProbeEvery are aliases for WithTimeout/WithPolling:

go
Eventually(ACTUAL).WithTimeout(2 * time.Second).WithPolling(50 * time.Millisecond).Should(MATCHER)
Eventually(ACTUAL).Within(2 * time.Second).ProbeEvery(50 * time.Millisecond).Should(MATCHER)

For Consistently the first duration is the window it must hold for, not a timeout.

Contexts & cancellation

.WithContext(ctx) (or passing ctx positionally, even first: Eventually(ctx, ACTUAL)) lets a cancelled context stop the poll.

go
Eventually(ACTUAL).WithTimeout(t).WithPolling(p).WithContext(ctx).Should(MATCHER)

Timeout × context interaction (Eventually):

  • Context and explicit timeout → stops at whichever comes first.
  • Context and no explicit timeout → no timeout applied; polls until the context is cancelled. This is intentional so one ctx can govern a batch of Eventuallys. Opt out with EnforceDefaultTimeoutsWhenUsingContexts().
  • Consistently always uses its DURATION; a cancelled context makes it bail out early as a failure, never as the duration controller.

Ginkgo SpecContext plugs straight in, and Gomega auto-injects the context as the polled function's first arg (after g Gomega, if present):

go
It("fetches the count", func(ctx SpecContext) {
    Eventually(client.FetchCount).WithContext(ctx).WithArguments("/users").Should(BeNumerically(">=", 17))
}, SpecTimeout(time.Second))

The polled function runs synchronously — Eventually cannot kill a slow function, so thread the context into it (e.g. client.FetchCount(ctx, ...)) to make it interruptible. With SpecContext, Ginkgo's Progress Reports also surface which Eventually was running and its latest failure on timeout.

Show full SKILL.md (233 more words)Show less

Bailing out early: StopTrying / TryAgainAfter

Both signals work whether returned as an error or thrown via .Now() (a panic the poller catches). They also work from inside func(g Gomega) callbacks and from matchers.

StopTrying(msg) — stop polling immediately. Always a failure for Eventually.

go
Eventually(func() (string, error) {
    if playerIndex == numPlayers {
        return "", StopTrying("no more players left")   // as error
    }
    name := client.FetchPlayer(playerIndex); playerIndex++
    return name, nil
}).Should(Equal("Patrick Mahomes"))

Eventually(func() []string {
    names, err := client.FetchAllPlayers()
    if err == client.IRRECOVERABLE_ERROR {
        StopTrying("irrecoverable error").Now()          // panic form
    }
    return names
}).Should(ContainElement("Patrick Mahomes"))

For Consistently only, StopTrying(msg).Successfully() ends the window early without failing (e.g. the monitored goroutine has finished). Not valid with Eventually, which always treats StopTrying as failure.

Enrich the message with .Wrap(err) (renders <message>: <err>) and .Attach(description, obj) (formats obj through Gomega's formatter; repeatable).

TryAgainAfter(duration) — same return/.Now() mechanics, but instead of stopping it waits duration before the next poll. Use it to back off when a service reports "unavailable, retry later." If the overall timeout elapses during that wait, both Eventually and Consistently fail and print the message (also supports .Wrap/.Attach).

MustPassRepeatedly

Require N consecutive passes before Eventually succeeds — useful when a single transient pass isn't enough:

go
Eventually(ACTUAL).MustPassRepeatedly(3).Should(MATCHER)

Matchers can stop the poll

A matcher's Match returning StopTrying (or calling .Now()) halts polling and fails — same always-a-failure rule. Separately, a matcher implementing MatchMayChangeInTheFuture(actual) bool returning false signals out-of-band that no further change is possible, so Eventually/Consistently can stop without that being inherently a failure (e.g. Receive on a closed channel). See gomega:custom-matchers for both mechanisms.

Modifying default intervals

Suite-wide, set in a BeforeSuite/TestMain:

go
SetDefaultEventuallyTimeout(t time.Duration)
SetDefaultEventuallyPollingInterval(t time.Duration)
SetDefaultConsistentlyDuration(t time.Duration)
SetDefaultConsistentlyPollingInterval(t time.Duration)

Or via env vars (lower precedence than the SetDefault… calls), all parseable duration strings: GOMEGA_DEFAULT_EVENTUALLY_TIMEOUT, GOMEGA_DEFAULT_EVENTUALLY_POLLING_INTERVAL, GOMEGA_DEFAULT_CONSISTENTLY_DURATION, GOMEGA_DEFAULT_CONSISTENTLY_POLLING_INTERVAL, and GOMEGA_ENFORCE_DEFAULT_TIMEOUTS_WHEN_USING_CONTEXTS.

© onsi, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/gomega/skills/async of onsi/gomega.

Open the folder on GitHubat commit 37fa900

Compare with similar skills

Async next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Async compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Async this skillonsi/gomega2.4k—~2.2kAutomated safety check: PassMIT
YugabyteDB ASH Instrumentationyugabyte/yugabyte-db11k—~4.5kAutomated safety check: PassCustom licence
Mirage VFS Adapter Authoringstrukto-ai/mirage3.7k—~2.4kAutomated safety check: PassApache-2.0
Golang Patternsantoniopaya22/go-rest-template1729 repos~3.5kAutomated safety check: PassNone
Rust Async Patternsdiodeme/Gold-Band1439 repos~3.1kAutomated safety check: PassAGPL-3.0
Swift Concurrencyhenrypldev/react-native-nitro-mlx1003 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • YugabyteDB ASH Instrumentation

    yugabyte/yugabyte-db

    Procedure for adding or changing YugabyteDB Active Session History wait states in TServer and DocDB C++ code, including the macro to use for sync and async paths.

    11k GitHub stars~4.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Builds or extends a custom Mirage virtual filesystem adapter for an API, database, object store or app data, with a working mount configuration and filesystem tests.

    3.7k GitHub stars~2.4k tokensUpdated today
    DevelopmentAuto-check passed
  • Golang Patterns

    antoniopaya22/go-rest-template

    Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.

    172 GitHub starsUsed in 9 repos~3.5k tokens
    DevelopmentAuto-check passed
  • Rust Async Patterns

    diodeme/Gold-Band

    Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns.

    143 GitHub starsUsed in 9 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Swift Concurrency

    henrypldev/react-native-nitro-mlx

    Diagnose Swift Concurrency issues, refactor callback-based code to async/await, and guide Swift 6 migration when working with tasks, actors, @MainActor, Sendable, data races, thread safety, or…

    100 GitHub starsUsed in 3 repos~3.1k tokens
    DevelopmentAuto-check passed
  • Rust Engineer

    farm-fe/farm

    Writes, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions.

    5.6k GitHub starsUsed in 1 repo~1.5k tokens
    DevelopmentAuto-check passed

More from onsi/gomega

All 12 skills in this repo
  • Assertions

    onsi/gomega

    Write correct synchronous Gomega assertions — Expect/Ω notation, the To/NotTo/ToNot/Should/ShouldNot equivalences, the multi-return error idiom, Succeed vs HaveOccurred, the .Error() chaining form…

    2.4k GitHub stars~2.1k tokensUpdated 13 days ago
    Auto-check passed
  • Build compound Gomega assertions by combining matchers — And/SatisfyAll (all pass), Or/SatisfyAny (any pass), Not (negate), WithTransform to map the actual before matching, Satisfy for an ad-hoc…

    2.4k GitHub stars~1.5k tokensUpdated 13 days ago
    Auto-check passed
  • Custom Matchers

    onsi/gomega

    Writing your own Gomega matchers — the GomegaMatcher interface (Match/FailureMessage/NegatedFailureMessage), gcustom.MakeMatcher with message templates and template data, the format package helpers…

    2.4k GitHub stars~2.4k tokensUpdated 13 days ago
    Auto-check passed
  • Gbytes

    onsi/gomega

    Testing streaming io buffers with gbytes — gbytes.NewBuffer() (an io.Writer also returned by gexec sessions), the Say(regexp) matcher that forward-scans from a moving read cursor, the canonical…

    2.4k GitHub stars~1.5k tokensUpdated 13 days ago
    Auto-check passed
  • Gexec

    onsi/gomega

    Testing external processes with gexec — compile binaries with Build/BuildWithEnvironment/BuildIn and CleanupBuildArtifacts, start them with Start returning a Session, await exit with the Exit…

    2.4k GitHub stars~1.3k tokensUpdated 13 days ago
    Auto-check passed
  • Ghttp

    onsi/gomega

    The ghttp test HTTP server for testing HTTP clients — NewServer/NewTLSServer, AppendHandlers, the Verify assertions (VerifyRequest/VerifyHeader/VerifyHeaderKV/VerifyJSON/VerifyForm/VerifyBasicAuth/Ve…

    2.4k GitHub stars~2.2k tokensUpdated 13 days ago
    Auto-check passed

Categories

Questions about Async

What does Async do?

Polling assertions in Gomega — Eventually (poll until it passes) and Consistently (must keep passing), the func(g Gomega) callback idiom, WithTimeout/WithPolling/Within/ProbeEvery, WithContext and…. Async is an agent skill from onsi/gomega. Polling assertions in Gomega — Eventually (poll until it passes) and Consistently (must keep passing), the func(g Gomega) callback idiom, WithTimeout/WithPolling/Within/ProbeEvery, WithContext and Ginkgo SpecContext, StopTrying/TryAgainAfter bail-outs, MustPassRepeatedly, and default-interval tuning.

When should I use Async?

Async fits situations like: an assertion cant be true synchronously — anything involving goroutines; eventual consistency; wait until / stays true.

How do I install Async in Claude Code?

Run `npx skills add onsi/gomega --skill async -a claude-code`. Or copy the skill folder (plugins/gomega/skills/async in onsi/gomega) into .claude/skills/async in your project. Claude Code loads it when a task matches its description.

How do I install Async in Codex?

Run `npx skills add onsi/gomega --skill async -a codex`. Or copy the skill folder (plugins/gomega/skills/async in onsi/gomega) into .agents/skills/async in your project. Codex loads it when a task matches its description.

Can I use Async in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add onsi/gomega --skill async -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/async, .gemini/skills/async, .github/skills/async and .opencode/skills/async in your project.

What does Async need to run?

SKILL.md names no scripts, command-line tools or credentials: Async is instructions for the agent only.

Does Async access the network?

SKILL.md names 1 domain. As links in the text: onsi.github.io. This is read from the text; nothing was executed.

Is Async safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Async use?

Async is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Async use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Async?

Skills that share tags, products or a category with Async: YugabyteDB ASH Instrumentation (yugabyte/yugabyte-db, 11k stars), Mirage VFS Adapter Authoring (strukto-ai/mirage, 3.7k stars), Golang Patterns (antoniopaya22/go-rest-template, 172 stars) and Rust Async Patterns (diodeme/Gold-Band, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Async?

onsi (a GitHub user) maintains it in onsi/gomega, which has 2,357 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on September 24, 2026.

Source: onsi/gomega on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.