guardrails
Skill0 starsChanged 8 months agoMITView on GitHub
Safety hooks for Claude Code that protect against destructive operations, enforce write boundaries, and gate sensitive actions. Essential when running autonomous workers with --dangerously-skip-permissions. Use when: setting up a new Claude Code environment, configuring safety for dispatch/pipeline workers, or auditing existing hook coverage.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
15 other projects use a version of this.
Adopted by
Most recently taken up by
- the-inconvenience-store/skillstheir own version, first seen Nov 6, 2026
- meyverick/agentictheir own version, first seen Oct 30, 2026
- meaningfy-ws/skillerytheir own version, first seen Oct 27, 2026
- antrafa/skillstheir own version, first seen Oct 20, 2026
- irahardianto/awesome-agvtheir own version, first seen Oct 14, 2026
- adewale/guardrails-skilltheir own version, first seen Oct 13, 2026
Used with
Projects with it also use evaluation, prototype and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
NVIDIASkillevaluation
Evaluates accuracy of quantized or unquantized LLMs using NeMo Evaluator Launcher (NEL). Triggers on "evaluate model", "benchmark accuracy", "run MMLU", "evaluate quantized model", "run nel". Handles deployment, config generation, and evaluation execution. Always load when validating completed runs or reporting evaluation scores, including standalone launching-evals analysis. Not for quantizing models (use ptq), standalone serving (use deployment), or comparing completed baseline-vs-quantized results (use compare-results).
Also in 3 projects that use this
GoogleSkillprototype
Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.
Also in 3 projects that use this
GoogleSkillgrill-me
A relentless interview to sharpen a plan or design.
Also in 4 projects that use this
MicrosoftSkillhandoff
Compact the current conversation into a handoff document for another agent to pick up.
Also in 3 projects that use this
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 15
- ai-analyst-lab/ai-analyst★ 304same name
- irahardianto/awesome-agv★ 157same name
- googlicius/obsidian-steward★ 85same name
- bolasblack/claude-skills★ 4same name
- hajekim/agentic-design-patterns-skills★ 4same name
- dfrysinger/skills★ 3same name
- adewale/guardrails-skill★ 2same name
- Citadel-Cloud-Management/citadel-saas-factory★ 2same name
- meaningfy-ws/skillery★ 2same name
- antrafa/skills★ 1same name
5 more not listed
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 repository3 other files it gives its agents.
- autonomousSkill
- dispatch-dashboardSkill
- notifySkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 15 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
When using Dispatch or Pipeline to spawn autonomous workers, those workers run with --dangerously-skip-permissions because they're headless …
- Very specific: line 68
Add to your ~/.claude/settings.json:
“Common” is measured: kept by at least 6 in 10 of the 15 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
Guardrails
Safety hooks for Claude Code that act as the real enforcement layer when running autonomous workers with --dangerously-skip-permissions.
Why This Matters
When using Dispatch or Pipeline to spawn autonomous workers, those workers run with --dangerously-skip-permissions because they're headless (no terminal to prompt for approval). Without hooks, they can do anything -- force-push to main, delete files, write secrets, modify your Claude config.
Guardrails hooks are the safety net. They fire on every tool use regardless of permission mode, blocking or prompting for dangerous actions.
What's Included
Example Hooks
These are generalised, production-tested hooks. Copy them to ~/.claude/hooks/ and wire them into your settings.json.
| Hook | Type | Purpose |
bash-precheck.py | PreToolUse (Bash) | Blocks destructive commands, protects sensitive paths, gates commits, prevents credential reads |
write-boundary.py | PreToolUse (Edit/Write) | Restricts file writes to project directory + /tmp, extra restrictions for workers |
What They Block
Hard deny (always blocked):
git reset --hard,git push --force,git clean -f- Writes to
/etc/,/usr/,/System/,~/.ssh/,~/.aws/,~/.gnupg/ npm publish,pnpm publish,yarn publishDROP TABLE,TRUNCATE TABLElaunchctlservice modifications,crontabedits- Workers modifying Claude config (
~/.claude/hooks/,settings.json,CLAUDE.md)
Prompt (ask user, allow or deny):
rm -rfand recursiverm- Docker destructive commands (
docker rm,docker stop,docker system prune) kill -9,killall- Outbound data via
curl POST/wget --post - Writes outside the project directory
- Reading credential files (
~/.ssh/,~/.aws/,~/.npmrc/,~/.netrc/)
Commit gates (blocks commit until fixed):
- Direct commits on protected branches (
main,master,staging) - Commits when lint fails
- Commits when tests fail
- Pushes from/to protected branches
Installation
1. Copy hooks
cp examples/bash-precheck.py ~/.claude/hooks/
cp examples/write-boundary.py ~/.claude/hooks/
chmod +x ~/.claude/hooks/bash-precheck.py ~/.claude/hooks/write-boundary.py2. Wire into settings.json
Add to your ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [{ "type": "command", "command": "~/.claude/hooks/bash-precheck.py" }]
},
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [{ "type": "command", "command": "~/.claude/hooks/write-boundary.py" }]
}
]
}
}3. Customise
Edit the hooks to match your setup:
BLOCKED_TOOLSinbash-precheck.py-- add/remove CLI tools that should use package.json scripts instead of direct invocationPROTECTED_BRANCHES-- change from{"staging", "main", "master"}to your branch namesSENSITIVE_PATHS-- add paths specific to your environmentALWAYS_ALLOWEDinwrite-boundary.py-- add directories workers should be able to write toCLAUDE_ALLOWED_WRITE_PATHSenv var -- colon-separated additional write paths
How Hooks Work
Claude Code hooks fire on every tool use, even with --dangerously-skip-permissions:
Agent calls Bash("git push --force")
-> PreToolUse hooks fire
-> bash-precheck.py reads the command
-> Matches destructive pattern
-> Returns deny with reason
-> Command is blocked, agent sees the errorThree possible outcomes:
- Allow (hook returns nothing) -- tool executes normally
- Deny (hook returns
permissionDecision: "deny") -- tool blocked, agent sees reason - Ask (hook returns
permissionDecision: "ask") -- user prompted to allow or deny
Workers running headless with --dangerously-skip-permissions never see "ask" prompts -- they auto-approve. This is why the hooks use "deny" for genuinely dangerous operations and "ask" only for things the user might reasonably want to allow.
Worker Safety
The hooks detect worker sessions by checking for /tmp/claude-workers/<session_id>.meta. Workers get stricter rules:
- Cannot modify Claude config files (hooks, settings, CLAUDE.md)
- Cannot redirect output to Claude config
- Same destructive operation blocks as interactive sessions
This prevents a dispatched worker from modifying its own safety constraints.
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.

