safety-guardrails
Skill54 starsChanged 6 months agoMITView on GitHub
Flags risky shell commands and unsafe tree ops.
- Deletes or force-pushes
- Commits and pushes
1 other project uses a version of this.
Adopted by
Most recently taken up by
- kangarooking/system-prompt-skillstheir own version, first seen May 4, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- kangarooking/system-prompt-skills★ 205same 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 repository31 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- architecture-sketchingSkill
- autonomous-bug-fixSkill
- behavioral-foundationSkill
- brainstormingSkill
- codebase-onboardingSkill
- code-reviewSkill
- debuggingSkill
- demand-eleganceSkill
- derive-nfr-from-driverSkill
- derive-security-from-riskSkill
- dispatching-parallel-agentsSkill
- durable-workSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- plan-before-codeSkill
- pr-workflowSkill
- receiving-code-reviewSkill
- refactoringSkill
- requesting-code-reviewSkill
- requirements-elicitationSkill
- security-auditSkill
- self-improvementSkill
- subagent-strategySkill
- test-writingSkill
- traceability-gateSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verify-before-doneSkill
- template-skillSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
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
- Distinctive: line 18
Before running any command that deletes, overwrites, or rewrites history.
- Distinctive: line 19
Before a risky git operation (force-push, hard reset, history rewrite).
- Distinctive: line 20
Before a bulk file operation, to confirm the working tree is in a safe state.
- Distinctive: line 21
When a user-supplied or generated command "looks" destructive — check it first.
- Distinctive: line 23
NOT as a security boundary — it is trivially bypassed (see Pitfalls).
- Very specific: line 33
Use the powershell tool to invoke the guard before the risky action:
- Very specific: line 77
DO NOT: treat a clean result as "safe to run".
- Distinctive: line 78
DO NOT: use this as a sandbox or permission system.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Safety Guardrails Skill
Gives the agent two invokable preflight checks before a dangerous action: a command guard that flags obviously-destructive commands (rm -rf /, force-push, reset --hard, dd, mkfs), and a tree guard that flags an unsafe working-tree state (mass deletions, or a dirty tree when a clean one is required). This is a heuristic speed bump, not a sandbox — it cannot parse shell grammar or stop execution, so it complements, never replaces, human confirmation.
When to Use
- Before running any command that deletes, overwrites, or rewrites history.
- Before a risky
gitoperation (force-push, hard reset, history rewrite). - Before a bulk file operation, to confirm the working tree is in a safe state.
- When a user-supplied or generated command "looks" destructive — check it first.
- As a standing habit in autonomous loops where no human reviews each command.
- NOT as a security boundary — it is trivially bypassed (see Pitfalls).
Prerequisites
- The
powershellCopilot tool to run the guard scripts. - Python 3 on
PATH(the guards share one stdlib core; the.sh/.ps1are thin wrappers). gitavailable for the tree guard (it degrades to a skip outside a repo).
How to Run
Use the powershell tool to invoke the guard before the risky action:
# Command guard — exit 1 means STOP and confirm
bash skills/safety-guardrails/scripts/safety-guard.sh command "rm -rf /"
# Tree guard — flag mass deletions or (optionally) any dirty tree
bash skills/safety-guardrails/scripts/safety-guard.sh tree --require-cleanOn Windows, call the parity wrapper safety-guard.ps1 with the same verbs. Exit codes: 0 no concern, 1 flagged (stop and confirm), 2 usage error.
Quick Reference
| Guard | Flags | Example trigger |
command | recursive force-delete of a root/home/system path | rm -rf /, rm -rf ~ |
command | force-push / history rewrite | git push --force, git filter-branch |
command | irreversible reset / clean | git reset --hard, git clean -fdx |
command | disk/device destruction | dd of=/dev/sda, mkfs, > /dev/sdb |
command | over-permissive mode | chmod -R 777 . |
tree | mass staged/pending deletions (≥ threshold) | a refactor that removed many files |
tree | dirty tree when --require-clean | uncommitted edits before a hard reset |
Procedure
Step 1: Guard the Command
Pass the exact command string to the command guard with the powershell tool. If it exits 1, treat the listed reasons as a hard stop: confirm intent with the user and prefer a reversible alternative (a feature branch over a force-push, git revert over git reset --hard, a preview flag over a destructive one).
Step 2: Guard the Working Tree
Before a bulk or destructive operation, run the tree guard. It reads git status and flags when the number of pending deletions meets the threshold (default 3, tune with --max-deletions). Add --require-clean when the next step assumes a pristine tree (for example, before a hard reset or a checkout that discards changes).
Step 3: Confirm or Abort
A flag is a checkpoint, not a veto. If the destructive action is genuinely intended and understood, state that explicitly and proceed; otherwise abort and choose the reversible path. Record the decision in tasks/todo.md when it affects the plan.
Step 4: Extend the Rules
The detection rules live in skills/safety-guardrails/scripts/safety_guard.py as a single shared core. Add a new rule there (with a test in tests/test_safety_guard.py) so the .sh and .ps1 wrappers stay in parity automatically.
Pitfalls
- DO NOT treat a clean result as "safe to run". The guard misses quoting, command substitution, variable expansion, aliases, and alternate binaries like
/bin/rm. A pass is the absence of an obvious flag, not a proof of safety. - DO NOT use this as a sandbox or permission system. It does not block execution — it informs a decision.
- DO NOT suppress a flag silently. If you override it, say why.
- DO NOT widen the danger rules so far that every
rmtrips them — false positives train the agent to ignore the guard. - DO NOT edit only one wrapper. The logic lives in the Python core; the
.sh/.ps1are thin and must stay that way.
Verification
- The command guard was run on the destructive command and its exit code observed.
- Any
1(flagged) result was either resolved with a reversible alternative or explicitly confirmed. - The tree guard was run before bulk/destructive file operations.
- New or changed detection rules have matching cases in
tests/test_safety_guard.py.
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.

