defensive

defensive is a skill for Claude Code, Codex from rainmanjam/poka-yoke. It costs 70 tokens per session (2,105 once invoked), scanned A, original, MIT.

A coding approach that treats every input and external result as potentially missing, malformed, or wrong. It validates values, handles errors, and defines safe fallback behaviour.

In plain words
What is it for?
Use it when making code more resistant to invalid requests, missing values, failed services, and other runtime problems.
Why use it?
Unexpected data or service failures can otherwise crash software or expose users to unclear errors.

Skill for Claude CodeCodex

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

Good fit Use it when making code more resistant to invalid requests, missing values, failed services, and other runtime problems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rainmanjam/poka-yoke/defensive
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 rainmanjam/poka-yoke --skill defensive
Clone the repo
git clone --depth 1 https://github.com/rainmanjam/poka-yoke

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 defensive

README.md
[![agentmods](https://agentmods.dev/badge/skills/rainmanjam/poka-yoke/defensive/github.svg)](https://agentmods.dev/skills/rainmanjam/poka-yoke/defensive)
Your own site
<a href="https://agentmods.dev/skills/rainmanjam/poka-yoke/defensive"><img src="https://agentmods.dev/badge/skills/rainmanjam/poka-yoke/defensive/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 defensive

Your own site · 80×15
<a href="https://agentmods.dev/skills/rainmanjam/poka-yoke/defensive"><img src="https://agentmods.dev/badge/skills/rainmanjam/poka-yoke/defensive.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,105 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 warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Memory Poisoning · line 186
    Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
    Fix: Protect agent memory and state from modification by untrusted content. Use read-only memory for critical instructions and validate all state changes.
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.00070 $0.02105
Opus 5 $0.00035 $0.01052
Sonnet 5 $0.00014 $0.00421
Haiku 4.5 $0.00007 $0.00211

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

Security

Grade A, and why

defensive 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 9d 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.

benchmarks/controls/defensive/skills/defensive/SKILL.md · 191 lines

How it starts

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

Defensive Programming: Never Trust the Input

Software fails because something arrived that the code did not expect. A null where an object was assumed, a string where a number was assumed, a value outside the range the arithmetic relies on, a service that returned an error instead of a payload.

The defensive discipline is to assume none of it. Every function treats its callers as unreliable, every boundary is checked, every external call is wrapped, and every failure path has a defined behaviour rather than an exception escaping into the user's face.

The line that does most of the work:

An unhandled failure is a defect you shipped to the user. A handled failure is one you chose the behaviour for. Wherever your code touches something it did not construct, decide now what happens when that thing is wrong, because the alternative is finding out in production.

The five disciplines

Validate at every boundary. Any value crossing into your code from elsewhere is untrusted: HTTP requests, config files, environment variables, database rows, other modules' return values. Check type, range, shape and required fields before use. Validation duplicated at several layers is not waste; it is depth, and it means one missed check does not become a defect.

Guard against absence. Null, undefined, empty string, empty list, missing key and zero are all values a caller can hand you. Check for them explicitly before dereferencing, and decide what absence means here: an error, a skip, or a default.

Supply safe fallbacks. When a value is missing or invalid, prefer continuing with a sensible default over aborting. A report that renders with a zero in one cell serves the user better than a stack trace. Choose the default that fails toward the least harm.

Catch, log, continue. Wrap operations that can throw. Log enough context to diagnose it later: the inputs, the operation, the error. Then decide whether this frame can proceed. An exception that escapes several frames loses the context that would have explained it.

Read the full file on GitHub · 191 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. 9d ago First seen · 191 lines · 70 tokens per session scan A 4b3773d55938

Subscribe to this mod's changes

defensive is a skill published in the GitHub repository rainmanjam/poka-yoke (22 stars, last pushed 7d ago), licensed MIT. It adds 70 tokens to every session and 2,105 once invoked, about $0.0003 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

Nullability Contract Review

Detect null/undefined/empty handling gaps where callers or consumers may receive unexpected nullish values.

s977043/river-review · 24 tokens

skill-audit

Audit codebases for quality, consistency, and broken patterns — use for pre-release or tech debt review.

nyldn/claude-octopus · 24 tokens

brooks-sweep

Full-sweep mode: runs a unified analysis across all quality dimensions — code decay, architecture, tech debt, and test quality — then applies fixes directly to the codebase. Safe changes are auto-applied; risky changes are confirmed before execution. Drawing on twelve classic engineering books. Triggers when: user…

hyhmrright/brooks-lint · 178 tokens

critical-code-reviewer

Rigorously review code or pull requests for correctness, security, accessibility, maintainability, tests, and edge cases. Use when users request a critical code review, want a guided walkthrough of findings, need implementer-facing feedback, or want to prepare, create, or submit a GitHub pull request review.

posit-dev/skills · 67 tokens

second-pass-review

Independent audit of sanitized specs in workspace/output/. Three parallel LLM-based reviewer roles check structural leakage, content contamination, and behavioral completeness. Run AFTER Layer 5 sanitization, BEFORE implementation handoff.

prime-radiant-inc/greenfield · 44 tokens

check-pr

Read-only inspection of a single GitHub PR lifecycle — checks CI, review threads, description sync, and mergeability, and returns PASS or FAIL with per-gate findings. Never invokes the merge button. Use when verifying a PR is ready to merge, polling lifecycle progress, checking mergeability, or babysitting a GitHub PR…

doodledood/manifest-dev · 74 tokens