catch-expected-errors

catch-expected-errors is a skill for Claude Code, Codex from jimmc414/claude-code-plugin-marketplace. It costs 24 tokens per session (571 once invoked), scanned A, original, MIT.

A pattern for trying many candidate inputs while treating certain failures as expected. The code catches specified errors, skips the invalid candidate, and continues exploring.

In plain words
What is it for?
Use it when exploring possibilities, converting uncertain values, checking candidate formulas, or traversing states where some attempts are expected to fail.
Why use it?
Search and conversion tasks often encounter candidates that cannot be processed, such as division by zero or invalid input. Handling those known failures prevents one bad case from stopping the whole search.

Skill for Claude CodeCodex

Part of the norvig-patterns plugin — 33 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/catch-expected-errors
Any agent
npx skills add jimmc414/claude-code-plugin-marketplace --skill catch-expected-errors
Clone the repo
git clone --depth 1 https://github.com/jimmc414/claude-code-plugin-marketplace

Made for: Claude Code, Codex.

Or install norvig-patterns, the plugin that ships this one along with the rest of its 33 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 catch-expected-errors

README.md
[![agentmods](https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/catch-expected-errors.svg)](https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/catch-expected-errors)
Your own site
<a href="https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/catch-expected-errors"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/catch-expected-errors.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 571 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.00024 $0.00571
Opus 5 $0.00012 $0.00285
Sonnet 5 $0.00005 $0.00114
Haiku 4.5 $0.00002 $0.00057

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

Security

Grade A, and why

catch-expected-errors 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 4d 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/catch-expected-errors/SKILL.md · 90 lines

How it starts

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

catch-expected-errors

When to Use

  • Trying many possibilities where some fail
  • Division by zero might occur naturally
  • Type conversion might fail
  • Exploring invalid states in search

When NOT to Use

  • Errors indicate bugs (let them propagate)
  • All inputs should be valid
  • Exception overhead matters

The Pattern

Wrap potentially failing code in try/except, continue on expected errors.

for candidate in candidates:
    try:
        result = process(candidate)
        if is_valid(result):
            return result
    except (ValueError, ArithmeticError):
        continue  # Skip this candidate

return None  # None worked

Example (from pytudes)

# Cryptarithmetic solver (Cryptarithmetic.ipynb)
def faster_solve(formula):
    """Fill in digits to solve formula."""
    python_lambda, letters = translate_formula(formula)
    formula_fn = eval(python_lambda)

    for digits in permutations((1,2,3,4,5,6,7,8,9,0), len(letters)):
        try:
            if formula_fn(*digits) is True:
                yield format_solution(digits, letters, formula)
        except ArithmeticError:
            pass  # Division by zero - skip this combination

# Simple validator (Cryptarithmetic.ipynb)
def valid(pformula):
    """Valid iff no leading zero and evaluates to True."""
    try:
        return (not leading_zero(pformula)) and (eval(pformula) is True)
    except ArithmeticError:
        return False

# Type conversion cascade (lispy.py)
def atom(token):
    """Convert token to appropriate type."""
    if token == '#t': return True
    if token == '#f': return False
    if token[0] == '"': return token[1:-1]

    try:
        return int(token)
    except ValueError:
        try:
            return float(token)
        except ValueError:
            try:
                return complex(token.replace('i', 'j', 1))
            except ValueError:
                return Sym(token)

# Version compatibility (beal.py)
try:
    from math import gcd
except ImportError:
    from fractions import gcd

Read the full file on GitHub · 90 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. 4d ago First seen · 90 lines · 24 tokens per session scan A a79ebdd2fca0

Subscribe to this mod's changes

catch-expected-errors is a skill published in the GitHub repository jimmc414/claude-code-plugin-marketplace (4 stars, last pushed today), licensed MIT. It adds 24 tokens to every session and 571 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-08-31.

Related

Other skills, from other repositories

phpunit-migration-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 · 32 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

structuring-documentation

Use when writing, editing, auditing, splitting, or measuring Markdown documentation surfaces — README.md, AGENTS.md, CLAUDE.md, and docs/ siblings. Triggers include "is this doc too long", "split this README", "measure the docs", "where does this documentation belong", "audit the documentation", and any request to…

shopwareLabs/ai-coding-tools · 89 tokens

phpunit-integration-test-generation

Use this skill when the user asks to generate, write, or create integration tests for a Shopware 6 source class whose contract requires wired-up code — phrases like "generate integration tests for X", "write an integration test for this controller", "test this indexer", "create an integration test for the message…

shopwareLabs/ai-coding-tools · 184 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-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