fail-closed-case-matching

fail-closed-case-matching is a skill for Claude Code, Codex from Kevin-Liu-01/Agent-Machines. It costs 46 tokens per session (884 once invoked), scanned A, original, MIT.

A coding guide for writing conditional logic with every possible case named explicitly and no catch-all fallback. It recommends rejecting requests when the correct case cannot be proved.

In plain words
What is it for?
Use it when writing or reviewing branches that choose strategies, operating modes, or error-recovery paths.
Why use it?
Fallback branches can silently choose a weaker or incorrect behavior for new failure situations. Explicit cases make unexpected states fail visibly.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when writing or reviewing branches that choose strategies, operating modes, or error-recovery paths.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevin-liu-01/agent-machines/fail-closed-case-matching
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 Kevin-Liu-01/Agent-Machines --skill fail-closed-case-matching
Clone the repo
git clone --depth 1 https://github.com/Kevin-Liu-01/Agent-Machines

Made for: Claude Code, Codex.

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 fail-closed-case-matching

README.md
[![agentmods](https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/fail-closed-case-matching/github.svg)](https://agentmods.dev/skills/kevin-liu-01/agent-machines/fail-closed-case-matching)
Your own site
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/fail-closed-case-matching"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/fail-closed-case-matching/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 fail-closed-case-matching

Your own site · 80×15
<a href="https://agentmods.dev/skills/kevin-liu-01/agent-machines/fail-closed-case-matching"><img src="https://agentmods.dev/badge/skills/kevin-liu-01/agent-machines/fail-closed-case-matching.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 884 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.00046 $0.00884
Opus 5 $0.00023 $0.00442
Sonnet 5 $0.00009 $0.00177
Haiku 4.5 $0.00005 $0.00088

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

Security

Grade A, and why

fail-closed-case-matching 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 11d 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.

knowledge/skills/fail-closed-case-matching/SKILL.md · 114 lines

How it starts

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

Fail Closed, Case Match, Never Fall Back

The Rule

Every branch in conditional logic must be an explicit, named case. There are no fallbacks. There are no degraded modes. If the system cannot prove which case applies, it rejects the request.

Why

A fallback is a silent lie. It tells the caller "everything is fine" when the system actually failed to satisfy the original intent. That hides broken infrastructure, creates invisible state drift, and makes debugging harder because the failure never surfaces.

A case match is an explicit contract. Each branch has a name, a reason, and a test. If a new situation arises that does not match any case, the code fails loudly instead of silently routing to a weaker path.

What This Means In Practice

Do: name every branch

if fitsHotplug && fitsHost {
    return Hotplug
}
return LiveMigration

Do not: use else as a catch-all degraded path

// BAD: silent fallback
if canHotplug {
    hotplug()
} else {
    sleepAndRestart() // "just in case"
}

The second branch is not a case match. It is a bucket for "everything else," which means any new failure mode silently routes to sleepAndRestart without anyone noticing.

Do: treat the safe path as its own named case, not a fallback

ColdMigration (sleep, reconfigure, wake) is not a degraded fallback. It is the path the system takes when a primary path encounters an error mid-execution. Everything is pre-allocated before the swap, so the interruption is bounded and deterministic.

It has its own tests, its own invariants, and its own reason code. It is not "what happens when we give up."

Do: return typed errors instead of routing to a weaker mode

// GOOD: fail closed
match action {
    ResizeAction::Hotplug => hotplug(spec),
    ResizeAction::LiveMigration => Err(ResizeError::NotImplemented),
    ResizeAction::ColdMigration => Err(ResizeError::NotImplemented),
}

// BAD: silent fallback
if let Err(_) = hotplug(spec) {
    cold_migrate(spec) // hides the hotplug failure
}

Read the full file on GitHub · 114 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. 11d ago First seen · 114 lines · 46 tokens per session scan A a2976604f916

Subscribe to this mod's changes

fail-closed-case-matching is a skill published in the GitHub repository Kevin-Liu-01/Agent-Machines (29 stars, last pushed yesterday), licensed MIT. It adds 46 tokens to every session and 884 once invoked, about $0.0002 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