Skip to content
Back to skills

Failure To Guardrail

ASecurity

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.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentsrustgobashexpressapisecurity

Works with

  • terminal
  • api

Security analysis

A100/100

Scanned December 2, 2026

npx -y skills add alptugince/claude-code-ai-harness-kit --skill failure-to-guardrail --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Failure To Guardrail?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Failure To Guardrail
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alptugince-failure-to-guardrail/badge)](https://www.skillsdirectory.com/skills/alptugince-failure-to-guardrail)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.