test-with-examples

test-with-examples is a skill for Claude Code from jimmc414/claude-code-plugin-marketplace. It costs 23 tokens per session (890 once invoked), scanned A, original, MIT.

A testing pattern that describes behavior with concrete input-and-output examples. Each example states what a function should return for a particular input.

In plain words
What is it for?
Use it to specify functions, document behavior through tests, teach how code works, and check discrete input/output cases.
Why use it?
Examples make expected behavior easy to understand and provide focused regression tests when later code changes might break it.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the norvig-patterns plugin — 54 skills shipped together

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/jimmc414/claude-code-plugin-marketplace/test-with-examples
Any agent
npx skills add jimmc414/claude-code-plugin-marketplace --skill test-with-examples
Clone the repo
git clone --depth 1 https://github.com/jimmc414/claude-code-plugin-marketplace

Made for: Claude Code.

Or install norvig-patterns, the plugin that ships this one along with the rest of its 54 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 test-with-examples

README.md
[![agentmods](https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/test-with-examples.svg)](https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/test-with-examples)
Your own site
<a href="https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/test-with-examples"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/test-with-examples.svg" alt="Measured on agentmods" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 890 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.1 $0.00023 $0.00890
Opus 5 $0.00012 $0.00445
Sonnet 5 $0.00005 $0.00178
Haiku 4.5 $0.00002 $0.00089

Measured 2d ago against content hash 034156e82624, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

test-with-examples 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.

plugins/norvig-patterns/skills/test-with-examples/SKILL.md · 85 lines

How it starts

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

test-with-examples

When to Use

  • Clear, discrete input/output relationships
  • Examples serve as specification
  • Teaching or documenting behavior
  • Regression testing

When NOT to Use

  • Behavior too complex for examples
  • Need property-based testing
  • Examples would be exhaustive

The Pattern

Write tests as lists of (input, expected_output) pairs.

# Test cases as data
tests = [
    (input1, expected1),
    (input2, expected2),
    (input3, expected3),
]

def run_tests(func, tests):
    """Run function on test cases."""
    for inp, expected in tests:
        result = func(inp)
        assert result == expected, f"{func.__name__}({inp}) = {result}, expected {expected}"
    print(f"All {len(tests)} tests pass.")

Example (from pytudes)

# lispytest.py - comprehensive test examples
lis_tests = [
    ("(quote (testing 1 (2.0) -3.14e159))", ['testing', 1, [2.0], -3.14e159]),
    ("(+ 2 2)", 4),
    ("(+ (* 2 100) (* 1 10))", 210),
    ("(if (> 6 5) (+ 1 1) (+ 2 2))", 2),
    ("(if (< 6 5) (+ 1 1) (+ 2 2))", 4),
    ("(define x 3)", None),
    ("x", 3),
    ("(+ x x)", 6),
    ("((lambda (x) (+ x x)) 5)", 10),
    ("(define fact (lambda (n) (if (<= n 1) 1 (* n (fact (- n 1))))))", None),
    ("(fact 10)", 3628800),
    ("(fact 50)", 30414093201713378043612608166064768844377641568960512000000000000),
]

# DocstringFixpoint.ipynb - rainfall tests
def test_rainfall():
    assert 0/2 == rainfall([0, 0]),                "no rain"
    assert 5/1 == rainfall([5]),                   "one day"
    assert 6/3 == rainfall([1, 2, 3]),             "mean of several days"
    assert 6/4 == rainfall([0, 1, 2, 3]),          "non-integer mean"
    assert 9/3 == rainfall([1, 2, -9, -100, 6]),   "negative values ignored"
    assert 7/5 == rainfall([1, 0, 2, 0, 4]),       "zeros not ignored"
    assert 8/3 == rainfall([1, 2, 5, -999, 404]),  "values after -999 ignored"
    return True

# Cryptarithmetic.ipynb - solver test examples
for solver in (solve, faster_solve):
    assert "1 + 2 = 3" in set(solver("A + B = C"))
    assert not set(solver("A + B = CDE"))  # No solution
    assert set(solver("A * B = CA")) == {
        '5 * 3 = 15', '5 * 7 = 35', '4 * 6 = 24',
        '8 * 6 = 48', '2 * 6 = 12', '5 * 9 = 45'
    }

Read the full file on GitHub · 85 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 · 85 lines · 23 tokens per session scan A 034156e82624

Subscribe to this mod's changes

test-with-examples is a skill published in the GitHub repository jimmc414/claude-code-plugin-marketplace (4 stars, last pushed yesterday), licensed MIT. It adds 23 tokens to every session and 890 once invoked, about $0.0001 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-09-04.

Related

Other skills, from other repositories

phpunit-test-team-reviewing

Use this skill when the user asks for a team-based, consensus, multi-reviewer, or red-team review of Shopware PHPUnit tests — trigger phrases like "team review these tests", "consensus review the tests in PR.

shopwareLabs/ai-coding-tools · 52 tokens

phpunit-unit-test-reviewing

Internal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.

shopwareLabs/ai-coding-tools · 31 tokens

phpunit-integration-to-unit-migrating

Use this skill ONLY when the user explicitly requests an audit, migration, or evaluation of whether a Shopware integration test belongs in the unit suite — trigger phrases like "audit integration tests", "migrate integration tests to unit", "is this an integration test or a unit test", "evaluate integration tests for…

shopwareLabs/ai-coding-tools · 152 tokens

phpunit-unit-test-writing

Use this skill when the user asks to write, generate, create, or add PHPUnit unit tests for a Shopware 6 source class — phrases like "write unit tests for X", "generate tests for ClassName", "create PHPUnit tests", "add test coverage", "test this class", "cover this with tests", "I need tests for", "unit test this"…

shopwareLabs/ai-coding-tools · 187 tokens

phpunit-unit-test-generation

Internal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.

shopwareLabs/ai-coding-tools · 30 tokens

phpunit-test-reconciling

Internal sub-skill. Do not auto-activate. Use only when explicitly invoked by name by another skill or agent.

shopwareLabs/ai-coding-tools · 32 tokens