assertions

Guidance for writing synchronous Gomega assertions in Go. Synchronous means the test checks a result immediately instead of waiting for it to change.

In plain words
What is it for?
Use it to check values and errors, choose matchers, write negative assertions, annotate failures, and control failure output.
Why use it?
It explains equivalent assertion forms and common error-handling patterns, reducing incorrect or unclear test checks.

Skill for Claude CodeCodex

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.

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

Made for: Claude Code, Codex.

Per session 145 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,066 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00145 $0.02066
Opus 5 $0.00072 $0.01033
Sonnet 5 $0.00029 $0.00413
Haiku 4.5 $0.00015 $0.00207

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

Security

Grade A, and why

assertions 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 3d 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/assertions/SKILL.md · 171 lines

How it starts

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

Synchronous assertions

The core mechanics of asserting now (vs. polling — see gomega:async). Assumes a dot-import (. "github.com/onsi/gomega"). Narrative docs: https://onsi.github.io/gomega/#making-assertions. For the big picture and skill map see gomega:overview.

The two notations are identical

Expect(ACTUAL).To(Equal(EXPECTED))      // Expect notation
Expect(ACTUAL).NotTo(Equal(EXPECTED))
Expect(ACTUAL).ToNot(Equal(EXPECTED))   // ToNot == NotTo

Ω(ACTUAL).Should(Equal(EXPECTED))       // Ω notation (⌥z on macOS)
Ω(ACTUAL).ShouldNot(Equal(EXPECTED))

To == Should, and NotTo == ToNot == ShouldNot — pure syntactic sugar. ACTUAL (left) is anything; the matcher (right) must satisfy GomegaMatcher. Pick one notation per codebase and stay consistent. Matchers are values — see gomega:matchers.

The multi-return error idiom

Expect/Ω accept multiple arguments. The matcher runs against the first; the assertion fails unless every trailing argument is nil or zero-valued. This collapses Go's (value, error) pattern:

// instead of:
result, err := DoSomethingHard()
Expect(err).NotTo(HaveOccurred())
Expect(result).To(Equal("foo"))

// write:
Expect(DoSomethingHard()).To(Equal("foo"))   // passes only if return is ("foo", nil)

Succeed and HaveOccurred

For a function returning only error, use Succeed:

Expect(DoSomethingSimple()).To(Succeed())     // func() error
Expect(DoSomethingSimple()).NotTo(Succeed())

For an error value you already hold, use HaveOccurred:

err := DoSomethingSimple()
Expect(err).NotTo(HaveOccurred())
Expect(err).To(HaveOccurred())

Use Succeed when calling the function inline; use HaveOccurred when you have an err variable. To assert on the error's content (not just its presence), reach for MatchError and friends in gomega:matchers.

Don't use Succeed with a multi-return function. The matcher only sees the first return value; the rest are consumed by the multi-return idiom above. Expect(DoSomethingHard()).To(Succeed()) matches against the string, not the error, and Expect(DoSomethingHard()).NotTo(Succeed()) can never pass.

Read the full file on GitHub · 171 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. 3d ago First seen · 171 lines · 145 tokens per session scan A b6d857403a6e

Subscribe to this mod's changes

assertions is a skill published in the GitHub repository onsi/gomega (2,355 stars, last pushed 6d ago), licensed MIT. It adds 145 tokens to every session and 2,066 once invoked, about $0.0007 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

gen-test

Generate idiomatic tests for Go packages and handlers in the Meshery project.

meshery/meshery · 18 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

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

go-testing

Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns.

Gentleman-Programming/gentle-ai · 26 tokens

add-go-test

Write or extend Go unit tests in this repo. Use when the user asks to add or update Go tests.

authgear/authgear-server · 26 tokens