# Global Agent Guardrails

Configure the shared guard against catastrophic shell commands in local AI agents.

- Repository: https://github.com/davidondrej/skills (4238 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add davidondrej/skills --skill global-agent-guardrails -g -a claude-code -y`
Codex: `npx skills add davidondrej/skills --skill global-agent-guardrails -g -a codex -y`
Cursor: `npx skills add davidondrej/skills --skill global-agent-guardrails -g -a cursor -y`
Gemini CLI: `npx skills add davidondrej/skills --skill global-agent-guardrails -g -a gemini-cli -y`

## Description

Configure the shared guard against catastrophic shell commands in local AI agents. Use when changing block patterns, adding an agent or machine, or investigating why a command was or wasn't blocked.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Global Agent Guardrails

Block catastrophic shell commands before execution. One patterns file feeds a shared hook script or native adapter for each agent. This guards against accidents, not malicious agents (obfuscation like `python -c "shutil.rmtree(...)"` can slip past regex).

[Cloudroom](https://www.cloudroom.dev/security) ships a built-in Command Guard based on this one, on by default.

## File map

The setup consists of a shared pattern list, a guard script, a test suite, and agent-specific adapters. Keep those in the appropriate user-level configuration locations for your tools.

## Check installation

Confirm the shared guard and patterns are present, then run the test suite; it should report no failures.

If missing, rebuild from the wiring documentation in the project documentation.

## Add or tune a pattern

1. Edit the shared patterns file. Write POSIX ERE (`grep -E`). Use `[[:space:]]`, never `\s`, adapters may convert `[:space:]` to `\s` for JS/Python and compile in multiline mode.
2. Add block and allow cases to the test suite, then run it; all must pass.
3. Verify the new pattern compiles in each adapter's regex engine.
4. Consumers should re-read patterns for every command. If an agent uses a native blocklist, mirror changes there as appropriate.

Block only catastrophic commands (irreversible data loss, disk wipes, repo deletion). Recoverable local commands stay allowed; avoid over-blocking.

## Per-agent wiring (user-global)

Configure each agent using its documented hook or native command-blocking mechanism. Where supported, point the hook to the shared guard; merge settings into existing configuration rather than overwriting it. Use absolute paths in configs where path expansion is inconsistent.

## Gotchas

The rest: https://github.com/davidondrej/skills/blob/HEAD/skills/ops-and-setup/global-agent-guardrails/SKILL.md
