agent-guardrails

agent-guardrails is a skill for Claude Code from rainmanjam/poka-yoke. It costs 81 tokens per session (2,214 once invoked), scanned C, original, MIT.

A set of safeguards that restricts what an AI coding agent can do in a repository, or code project. It includes tool-use checks, blocked paths, and required verification steps.

In plain words
What is it for?
Use it to protect production files and secrets, prevent dangerous Git actions, and require checks before changes are accepted.
Why use it?
Written instructions can be forgotten or bypassed, especially during long or unattended tasks. These safeguards can stop risky actions before they happen.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions subagents.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is "Edit(./migrations/**)",.

Part of the poka-yoke plugin — 6 skills shipped together

Good fit Use it to protect production files and secrets, prevent dangerous Git actions, and require checks before changes are accepted.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/rainmanjam/poka-yoke
agentmods
npx agentmods add skills/rainmanjam/poka-yoke/agent-guardrails

Made for: Claude Code.

Or install poka-yoke, the plugin that ships this one along with the rest of its 6 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 agent-guardrails

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/rainmanjam/poka-yoke/agent-guardrails"><img src="https://agentmods.dev/badge/skills/rainmanjam/poka-yoke/agent-guardrails.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,214 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.00081 $0.02214
Opus 5 $0.00041 $0.01107
Sonnet 5 $0.00016 $0.00443
Haiku 4.5 $0.00008 $0.00221

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

Security

Grade C, and why

agent-guardrails scanned grade C with 1 finding 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 12d 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

**1. The agent does something destructive.** Force-push, `rm -rf`, dropping a table, editing
plugins/poka-yoke/skills/agent-guardrails/SKILL.md · 171 lines

How it starts

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

Poka-Yoke for AI-Written Code

An agent is a fast, tireless operator with no memory of yesterday and a strong prior toward appearing successful. That is the exact profile Shingo designed poka-yoke for, except an agent makes mistakes faster than any human, and never learns from the ones you correct in conversation.

The governing insight: instructions to an agent are rung zero. A line in CLAUDE.md saying "never commit to main" is training, and training degrades, under long contexts, compaction, and subagents that never read the file. A PreToolUse hook that denies the push is a device. If you have been repeating the same correction to an agent, that is the signal to stop writing instructions and install a device.

A complete answer covers all five

The diagnosis is not the answer. "Instructions are not enforcement" is the right insight, and it is satisfying to write, but someone asking "what am I doing wrong?" has a repo they need to fix: not a question about their prose. Explaining why the rules fail and stopping there leaves them exactly where they started. State the insight in a sentence, then spend the rest of the answer on the replacement.

Replacing an instruction with a device is not one step, it is five, and stopping after the first leaves the person with a rule that looks enforced and is not. Naming the deny rule is the easy part and the least of it. Cover every one of these, briefly, before adding depth:

  1. The deny rule, with real syntax. Show the actual permissions.deny entry for their case, "Bash(git push --force:*)": not a description of one. A pattern they have to invent themselves is a step where this fails.
  2. A hook where a pattern is not enough. Deny rules match strings. Anything conditional: a DELETE without a WHERE, an edit allowed in one directory but not another, a production hostname, needs a PreToolUse hook that inspects the call and returns a deny. Say which of their two rules needs which.
  3. What the deny message says. The agent reads it and acts on it, so a bare refusal produces a workaround, often a worse one. The message must name what was blocked, why, and what to do instead. This is the one place prose belongs in a device.
  4. Where the config lives, so it applies to everyone. .claude/settings.json, committed. A rule in settings.local.json protects one machine, which is the same failure as documenting it: the protection exists only where someone remembered to set it up.
  5. Proof that it fires. Run the blocked action and confirm the denial and its message, then run the legitimate neighbouring action and confirm it still works. Untested hooks fail open more often than people expect: a regex that does not match the real command string is a hook that does nothing while looking like protection. An unverified device is worse than no device, because it creates confidence without protection.

Read the full file on GitHub · 171 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. 12d ago First seen · 171 lines · 81 tokens per session scan C 51f9646a0e09

Subscribe to this mod's changes

agent-guardrails is a skill published in the GitHub repository rainmanjam/poka-yoke (22 stars, last pushed 10d ago), licensed MIT. It adds 81 tokens to every session and 2,214 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). 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

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

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

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

github-pr-creation

Creates GitHub Pull Requests with automated validation and task tracking. Use when user wants to create PR, open pull request, submit for review, or check if ready for PR. Analyzes commits, validates task completion, generates Conventional Commits title and description, suggests labels. NOTE - for merging existing…

fvadicamo/dev-agent-skills · 75 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