custom-matchers

custom-matchers is a skill for Claude Code from onsi/gomega. It costs 96 tokens per session (2,305 once invoked), scanned A, original, MIT.

Guidance for creating custom checks in Gomega when its built-in checks do not describe what a test needs.

In plain words
What is it for?
Use it to write and test custom Gomega matchers, including checks used with waiting or consistency assertions.
Why use it?
It helps turn application-specific test conditions into reusable checks with useful failure messages.

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 Use it to write and test custom Gomega matchers, including checks used with waiting or consistency assertions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/onsi/gomega/custom-matchers
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 custom-matchers
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 custom-matchers

README.md
[![agentmods](https://agentmods.dev/badge/skills/onsi/gomega/custom-matchers/github.svg)](https://agentmods.dev/skills/onsi/gomega/custom-matchers)
Your own site
<a href="https://agentmods.dev/skills/onsi/gomega/custom-matchers"><img src="https://agentmods.dev/badge/skills/onsi/gomega/custom-matchers/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for custom-matchers

Your own site · 80×15
<a href="https://agentmods.dev/skills/onsi/gomega/custom-matchers"><img src="https://agentmods.dev/badge/skills/onsi/gomega/custom-matchers.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,305 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.00096 $0.02305
Opus 5 $0.00048 $0.01153
Sonnet 5 $0.00019 $0.00461
Haiku 4.5 $0.00010 $0.00231

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

Security

Grade A, and why

custom-matchers 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 10d 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/custom-matchers/SKILL.md · 195 lines

How it starts

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

Writing your own matchers

When no built-in matcher fits and composition (And/Or/WithTransform/SatisfyAll — see gomega:composing-matchers) can't express it cleanly, write a custom matcher. Reach for gcustom.MakeMatcher first — it's the modern, low-boilerplate path. Drop to a hand-written type only when you need full control. Docs: https://onsi.github.io/gomega/#adding-your-own-matchers.

gcustom.MakeMatcher(matchFunc, ...) builds a full types.GomegaMatcher from one function. The match function must be func(actual T) (bool, error):

import (
	"github.com/onsi/gomega/gcustom"
	"github.com/onsi/gomega/types"

	"encoding/json"
	"fmt"
	"net/http"
	"reflect"
)

func RepresentJSONifiedObject(expected any) types.GomegaMatcher {
	return gcustom.MakeMatcher(func(response *http.Response) (bool, error) {
		ptr := reflect.New(reflect.TypeOf(expected)).Interface()
		if err := json.NewDecoder(response.Body).Decode(ptr); err != nil {
			return false, fmt.Errorf("failed to decode JSON: %w", err)
		}
		decoded := reflect.ValueOf(ptr).Elem().Interface()
		return reflect.DeepEqual(decoded, expected), nil
	}).WithTemplate("Expected:\n{{.FormattedActual}}\n{{.To}} contain the JSON representation of\n{{format .Data 1}}").WithTemplateData(expected)
}

Then Expect(resp).To(RepresentJSONifiedObject(book)) just works.

Typed match funcs get free type-checking. Because the func takes *http.Response, gcustom rejects any other actual with a clear error before calling your code. Use func(actual any) (bool, error) only if you want to handle multiple types or do your own type checks.

Return (false, err) for bad input, not a panic. A non-nil error fails the assertion in both the To and NotTo directions — you can't accidentally pass a negated assertion by feeding garbage.

Messages: WithMessage vs WithTemplate

  • .WithMessage("contain the JSON representation") — simplest. Renders Expected:\n<actual>\nto contain the JSON representation (and not to when negated).
  • .WithTemplate(tmpl, optionalData) — full control. WithTemplate(tmpl, data) is shorthand for .WithTemplate(tmpl).WithTemplateData(data).
  • Omit both and you get a generic Custom matcher failed for:\n<actual> message.

Read the full file on GitHub · 195 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. 10d ago First seen · 195 lines · 96 tokens per session scan A 94e480d4f1ce

Subscribe to this mod's changes

custom-matchers is a skill published in the GitHub repository onsi/gomega (2,355 stars, last pushed 13d ago), licensed MIT. It adds 96 tokens to every session and 2,305 once invoked, about $0.0005 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.