Turn a repeated agent mistake, a recurring review comment or a repeated user correction into the strongest enforceable check (design, types, lint, gate check, hook) instead of a note.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Failure To Guardrail?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/alptugince-failure-to-guardrail)
---
name: failure-to-guardrail
description: Turn a repeated agent mistake, a recurring review comment or a repeated user correction into the strongest enforceable check (design, types, lint, gate check, hook) instead of a note.
---
# Failure to guardrail
Soft guidance (rules, skills, memory, style guides) is forgotten under load. Hard enforcement is not. Every time a human has to say the same thing twice, the harness is missing a check.
## 1. Name the failure
One sentence: what the agent did, why it is wrong, and the correct behaviour. Collect 2-3 concrete instances (file:line, transcript excerpt or review comment).
## 2. Pick the strongest level that can express it
From strongest to weakest:
1. **Make it impossible by design**: change architecture or APIs so the wrong thing cannot be written (typed wrappers, a single factory, co-located feature folders, removing the dangerous helper).
2. **Compiler / type system**: stricter types, sealed classes, non-nullable fields, `-D warnings`.
3. **Static analysis / lint rule**: an existing rule turned on, or a custom lint.
4. **Gate check**: a script in `.claude/gate.d/` (and CI) that fails on the pattern (grep/AST check, dependency-graph check, schema check, asset check). Print one `FINDING: <file> | <message>` line per problem (no line numbers in the message) and exit non-zero, so the gate's ratchet baseline can track each finding. Name it `security_<name>.py` or `.sh` when it guards security; those findings are never baselined.
5. **Hook**: a `PreToolUse` or `PostToolUse` check when the problem is about agent actions rather than code (dangerous commands, forbidden files, missing generation step). Extend the shipped lists (`bash_deny_patterns`, `bash_ask_patterns`, `forbidden_markers`) with `*_extra` lists in `~/.claude/harness/config.json` (all projects) or the project `.claude/harness.json`; never copy the full default lists there.
6. **Path-scoped rule** in `.claude/rules/` with a `paths:` glob.
7. **Skill** when it is a multi-step procedure rather than a constraint.
8. **Memory** only for facts and preferences that cannot be checked mechanically.
Choose the highest level that is practical; layering a lower level on top is fine.
## 3. Implement and prove it
- The check must fail on the collected bad instances and pass on the corrected code. Run it both ways and show both outputs.
- The failure message must tell the agent how to fix it, not just that it failed.
- Keep false positives near zero; add a narrow, documented escape hatch if one is unavoidable.
- A new or changed `.claude/gate.d/` script pauses the Stop gate until the user approves it again with `harness_trust.py approve` in their own terminal; tell them so.
## 4. Record it
Add one line to the project `CLAUDE.md` "Things that must never be done" section pointing to the check, so the reason is discoverable.