/gomega:overviewfrom gomega
Teaches the Gomega matcher/assertion library mental model: Expect/Ω notation, matchers-as-values, multi-return error idiom, synchronous vs async (Eventually/Consistently), and maps all sub-libraries.
Ships in gomega. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Gomega is a matcher/assertion library for Go. It pairs best with the Ginkgo test framework but works with any Go test. The canonical narrative docs at https://onsi.github.io/gomega/ are the source of truth; this skill is the orientation and the other skills go deep.
Conventionally you dot-import Gomega so Expect, Equal, Eventually, etc. are unqualified:
import (
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" // if using Ginkgo
)
Expect(ACTUAL).To(MATCHER) // Expect(x).To(Equal(3))
Expect(ACTUAL).NotTo(MATCHER)
ACTUAL (left) is anything — the value under test.MATCHER (right) must satisfy the GomegaMatcher interface. Gomega's matchers (Equal(3), HaveLen(2), …) are just functions that return a matcher value — so you can store, pass, and compose them. → gomega:matchers, gomega:composing-matchers.Ω(ACTUAL).Should(MATCHER) / .ShouldNot(...) is the exact equivalent in the Ω notation (⌥z on macOS). To/Should and NotTo/ToNot/ShouldNot are interchangeable syntactic sugar — pick one notation and stay consistent.1. The multi-return error idiom. Expect/Ω accept multiple arguments; the match runs against the first, and fails unless all later arguments are nil/zero. This collapses Go's (value, error) pattern:
Expect(DoSomethingHard()).To(Equal("foo")) // passes only if return is ("foo", nil)
Expect(DoSomethingSimple()).To(Succeed()) // for funcs returning only error
Use .Error() to assert on the trailing error of a multi-return func while ignoring the rest. → gomega:assertions.
2. Failures go through a fail handler. Gomega calls a registered handler on failure. With Ginkgo, RegisterFailHandler(Fail) (auto-generated by ginkgo bootstrap). With plain testing, use g := NewWithT(t) and call g.Expect(...). → gomega:assertions.
3. Synchronous vs asynchronous. Expect asserts now. Eventually/Consistently poll a value, function, or g Gomega callback until a matcher passes (or keeps passing). Async is its own world with timeouts, contexts, and bail-out signals. → gomega:async.
The single biggest quality lever: prefer the matcher that says what you mean. Expect(err).To(MatchError(...)) over Expect(err.Error()).To(Equal(...)); Expect(xs).To(ConsistOf(...)) over Expect(len(xs)).To(Equal(3)). Specific matchers produce far better failure messages. Browse the full catalog before reaching for Equal — Gomega has a deep, expressive matcher library. → gomega:matchers.
Core mechanics
Expect/Ω, error handling, Succeed/HaveOccurred, negation, annotations, output tuning, asserting inside helpers → gomega:assertionsEventually/Consistently, polling functions & g Gomega callbacks, contexts, timeouts, StopTrying/TryAgainAfter → gomega:asyncMatchers
gomega:matchersAnd/Or/Not, SatisfyAll/SatisfyAny, WithTransform, HaveField, HaveValue → gomega:composing-matchersGomegaMatcher interface and gcustom → gomega:custom-matchersSub-libraries (each its own import; reach for them by task)
gstruct — deep, partial matching of nested structs, slices, and maps → gomega:gstructghttp — a test server for asserting on and stubbing HTTP clients → gomega:ghttpgexec — build, run, signal, and assert on external processes → gomega:gexecgbytes — assert on streaming io buffers with the Say matcher → gomega:gbytesgleak — detect leaked goroutines → gomega:gleakgmeasure — benchmark and measure code → gomega:gmeasureWhat SKILL.md sets; muted values are Claude Code's defaults
12 skills in this plugin
/assertionsWrite 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, annotating assertions (format-string and func()string), tuning failure output via the format subpackage (MaxLength/MaxDepth/UseStringerRepresentation/GomegaStringer/TruncatedDiff/RegisterCustomFormatter/format.Object), and asserting inside helper functions with GinkgoHelper/WithOffset/ExpectWithOffset, NewWithT(t) for plain testing, and the g Gomega callback. Use when writing or reviewing synchronous (non-polling) Gomega assertions./asyncPolling 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"./composing-matchersBuild 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 predicate, HaveValue to dereference pointers/interfaces, HaveField for struct fields and method results, HaveEach for every element, plus the matchers-as-arguments idiom that lets you nest matchers inside ContainElement/ConsistOf/HaveKeyWithValue/Receive. Use when one Expect needs several requirements at once, or you want to assert deep into a value without writing a custom matcher.npx claudepluginhub onsi/gomega --plugin gomegaOther plugins' skills for the same job