agent-guardrails
Skill0 starsChanged 4 months agoMITView on GitHub
Define what an AI agent does when things go wrong — the failure taxonomy and the handling policy for each failure mode (retry, fallback, escalate to human, hard refuse). Use whenever the user wants to make the agent safe and predictable under failure: listing the ways a run can go wrong, deciding the response to each, specifying when the agent must stop and ask a human, or hardening against bad/malicious input. Trigger on "guardrails", "failure modes", "what happens when it breaks", "fallback", "refusal", "escalation policy", "prompt injection", even without those exact words. Distinct from evals: evals *measure* quality, guardrails *govern behavior under failure*. Part of the agent-dev-framework pipeline — runs alongside prompt-and-contract, before the build plan. Use it even if the user only asks about one failure mode.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- milad-ahmd/agent-skillstheir own version, first seen Nov 8, 2026
- wilbeibi/wilbeibi-skillstheir own version, first seen Nov 1, 2026
- vindreshsingh/engineering-skillstheir own version, first seen Oct 20, 2026
- guerrilla2799/ops-and-scale-ostheir own version, first seen Oct 13, 2026
- Sathvikar01/Agent-engineering-skillstheir own version, first seen Oct 5, 2026
- produckyou-design/agent-guardrailstheir own version, first seen Aug 18, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- jzOcb/agent-guardrails★ 15same name
- milad-ahmd/agent-skills★ 5same name
- Sathvikar01/Agent-engineering-skills★ 3same name
- wilbeibi/wilbeibi-skills★ 2same name
- guerrilla2799/ops-and-scale-os★ 1same name
- produckyou-design/agent-guardrails★ 1same name
- vindreshsingh/engineering-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- agent-altitudeSkill
- agent-brainstormSkill
- agent-build-planSkill
- agent-competitiveSkill
- agent-data-and-evalsSkill
- agent-failure-to-evalSkill
- agent-monitoringSkill
- agent-prd-gateSkill
- agent-prdSkill
- agent-prompt-and-contractSkill
- agent-security-and-constraintsSkill
- agent-system-designSkill
- agent-tech-specSkill
- agent-ux-specSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Follow _conventions.md (read-first order, docs/ vs artifacts/, don't-clobber guard, tone).
- Very specific: line 18
Read PROJECT.md, artifacts/system-design.md (its failure-modes section is the seed), and artifacts/prompt-and-contract.md (the tools, the …
- Very specific: line 65
Write artifacts/guardrails.md (apply the don't-clobber guard):
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Guardrails
Evals tell you how often the agent is right. Guardrails decide what happens the rest of the time. These are different jobs, and conflating them is why agents that "passed evals" still do dangerous things in production: the eval set never contained the timeout, the malformed model output, or the adversarial input. This step writes the policy that governs failure — deterministic rules that run regardless of what the model decides.
Conventions
Follow _conventions.md (read-first order, docs/ vs artifacts/, don't-clobber guard, tone).
Before you start
Read PROJECT.md, artifacts/system-design.md (its failure-modes section is the seed),
and artifacts/prompt-and-contract.md (the tools, the I/O contract, and the response shape
that must be able to carry an escalation or error — guardrails depend on it existing).
The core distinction to hold onto
A guardrail is a rule the system enforces, not a hope about how the model behaves. "The prompt asks the agent to escalate when unsure" is a behavior; "if confidence < threshold OR a rule fires, the run returns an escalation and does not act" is a guardrail. Prefer guardrails that don't depend on the model cooperating, especially for anything that spends, sends, or writes.
What to define
1. The failure taxonomy
Enumerate the ways a run can go wrong. Cover at least these families (cut any that don't apply, add domain-specific ones):
- Model failures — malformed/unparseable output, schema violation, refusal, low confidence, hallucinated content presented confidently.
- Tool failures — timeout, error response, empty result, rate limit, partial success.
- Input failures — missing required fields, out-of-scope request, ambiguous request, adversarial input / prompt injection.
- Loop failures — exceeds max steps, stuck/oscillating, runs over a cost or latency budget. Give each a short stable name; the data/eval and monitoring steps will reference these names.
2. The handling policy (one decision per failure mode)
For each failure in the taxonomy, specify the response. The vocabulary is small on purpose:
- Retry — and the bound (how many times, with what backoff). Unbounded retries burn money.
- Fallback — a cheaper/simpler path or a secondary model acting as a check. Say what's lost.
- Escalate — stop and return control to a human, via the escalation shape in the I/O contract. Define what the human sees — enough context to act, not a raw stack trace.
- Refuse — return a safe, explicit decline. Define the user-facing message shape.
- Degrade — return a partial/best-effort result clearly marked as such, never silently. The cardinal rule: never fabricate to cover a failure. A confident-looking wrong answer is worse than an honest escalation. If the product's whole thesis is escalation-over- fabrication, this table is where it becomes enforceable rather than aspirational.
3. Guardrails on state-changing actions
For every state-changing tool from the contract, specify the gate: confirmation step, dry-run, spend/rate ceiling, idempotency, and an allow/deny boundary on what the agent may never do unprompted. These are hard stops, not prompt suggestions.
4. Adversarial / abuse hardening
Name the realistic attempts to make the agent misbehave (injection via tool results or user input, jailbreak of the refusal rules, data-exfil prompts) and the concrete mitigation for each. Tie a few of these to seed cases the eval step should carry, so hardening is verifiable.
Output
Write artifacts/guardrails.md (apply the don't-clobber guard):
# Guardrails — [product]
## Failure taxonomy (named failure modes, grouped)
## Handling policy (a table: failure mode → response → bound/detail → what the human/user sees)
## State-changing action gates (per tool: the hard stop)
## Adversarial hardening (attempt → mitigation → seed case to verify)
## The never-do list (actions forbidden regardless of model output)
## Open questionsEnd by naming the single failure mode most likely to slip through silently in production — the one with no detection and no defined response yet — and the cheapest guardrail or trace signal that would catch it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

