Guardrail Hooks is for the moment an agent does it again: “make this impossible”, “add a hook”, “my hook didn’t fire”. It picks the smallest code path that holds the rule, from a permission rule in settings to a PreToolUse, Stop, SessionStart or PostToolUse hook, or a refusal inside your own tool.
It also covers writing a guard that does not become noise: match what runs, look inside scripts, choose ask, deny or exit 2 on purpose, decide how it fails, and test it with samples before wiring it.
What You Get
- A table choosing between permission rules, PreToolUse, Stop, SessionStart, PostToolUse and git hooks
- guard_one_way_doors.py, which asks or denies before irreversible or public actions
- block_wrong_identity.py, which refuses a commit identity or author you have forbidden
- test_hooks.py, which pipes trigger and look-alike samples into the guards
- Canary commands that prove a hook is wired without running a real one-way door
Common Use Cases
- Stopping an agent from deleting or publishing something public without a typed go
- Keeping a personal email address out of commit authorship
- Making an agent run tests before it may say it is done
- Debugging a hook that never fires
What Makes It Unique
The skill treats a hook as a guardrail, not a sandbox, and says what hooks cannot see: MCP tools, browser clicks and files the user mentions. It prefers a permission rule over a hook and a refusal inside your own tool over both. New blocking hooks start in observe mode, hooks name how they fail, and the go for a one-way door has to be typed in the conversation. Every vendor fact carries a date.
Under The Hood
The skill is instructions, a hook-contract reference and three Python scripts that use only the standard library. The guards read the pending command as JSON on stdin and answer with an exit code and a JSON decision; they do not call the network. Installing means the agent copies scripts into a hooks folder and edits the project or user settings file to wire them, and runs the test script and canary commands in the shell. The re-verify section tells the agent to read the vendors’ hook documentation pages on the web.