add-test-matcher

A guided command for designing new Vitest matchers. Matchers are checks used with test assertions, such as verifying that a value is a valid address.

In plain words
What is it for?
Use it when planning a matcher for the @tevm/test-matchers package, including synchronous or asynchronous and chainable behavior.
Why use it?
It gathers the name, behavior, arguments, chaining, and examples needed before implementing a matcher.

Command for Claude Code

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 commands/evmts/tevm/add-test-matcher
Clone the repo
git clone --depth 1 https://github.com/evmts/tevm

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,879 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.00000 $0.02879
Opus 5 $0.00000 $0.01439
Sonnet 5 $0.00000 $0.00576
Haiku 4.5 $0.00000 $0.00288

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

Security

Grade A, and why

add-test-matcher 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 2d 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.

.claude/commands/add-test-matcher.md · 355 lines

How it starts

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

Add Test Matcher

This command helps you create new Vitest matchers for the @tevm/test-matchers package. The workflow combines user requirement gathering with comprehensive implementation guidance.

Step 1: Gather Requirements

Before implementing a new test matcher, I need to understand what you want to create. Please provide the following information:

A. Matcher Details

  • Primary Matcher Name: What should the main matcher be called? (e.g., toBeValidUser, toHaveLength)
  • Category: What category does this matcher belong to? (e.g., user, collection, database)
  • Chained Matchers: If this is a chainable matcher, what secondary matchers should be available? (e.g., withRole, withProperty)

B. Behavior Description

  • Synchronicity: Is this matcher synchronous or asynchronous?
  • Chainability: Is this a simple matcher or a chainable matcher?
  • Functionality: What should the matcher do? Be specific about arguments, expected behavior, and what constitutes pass/fail conditions.

C. Example Usage

Provide examples of how you envision using the matcher:

// Example:
expect(userId).toBeValidUser()
expect(userId).toBeValidUser().withRole('admin')

Step 2: Implementation Guide

Once you provide the requirements above, I'll implement the matcher following the architectural patterns below.

Core Architecture

The matcher system is built on a modular, category-based structure that plugs into vitest's expect API.

Key Directories & Files
  • src/index.ts: The central entry point for registering matchers with vitest
  • src/common/: Contains shared TypeScript types across matcher categories
  • src/chainable/: Core engine for chainable assertions (DO NOT modify)
  • src/matchers/: Root directory for all matcher implementations
  • src/matchers/<category>/: Each subdirectory represents a logical grouping of related matchers
  • src/matchers/<category>/index.ts: Entry point for a category, exports all public matchers and interfaces

Read the full file on GitHub · 355 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. 2d ago First seen · 355 lines · 0 tokens per session scan A a5488a32e2a9

Subscribe to this mod's changes

add-test-matcher is a command published in the GitHub repository evmts/tevm (446 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,879 tokens. 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-31.