Skip to content
SkillMixed3,455 tokens in use

Guardrail Hooks

Turn a rule an agent keeps breaking into a permission rule, hook or script, with templates for a one-way-door guard and a commit-identity guard.

680 stars on the repository MIT Licensephuryn/product-engineering · agent-harness/skills/guardrail-hooks
npx skills add phuryn/product-engineering
View source

Install command as written in the repository's README

Skill label

measured from its files

What installing Guardrail Hooks costs

43tokens idle
3,455tokens in use
7,278tokens, up to

Idle is what sits in context while the skill is installed. In use is its instructions, loaded when it runs. Up to adds the files its instructions link. Counts are approximate, made offline with cl100k_base.

Model dependence Mixed

Script-ledMixedModel-led

Scripts do part of the work and the model's judgement does the rest.

This describes the skill's structure, how much of it is scripts. It does not say how well it works. Scripts: scripts/block_wrong_identity.py, scripts/guard_one_way_doors.py, scripts/test_hooks.py.

Touches

shelldetectednetworkdetectedwrites filesdetectedgitdetected

Declared tags come from the skill's frontmatter; detected ones from its scripts, its code blocks and the commands it names in inline code. This is detected, not audited.

How it scores

Quality

How well the skill is written, counted from its own files: its frontmatter, its steps, examples, stated output and constraints, its size and whether every file it ships is one it names.How we score it →
Good
  • Frontmatter8/15
  • Structure19/25
  • Examples9/15
  • Output15/15
  • Size13/15
  • Resources15/15

Security

Starts at 100 and loses points for each thing in the skill's files that a reader should look at first.How we score it →
Good
  • Runs shell commands−5

    does this on the machine, and the frontmatter does not say so

    scripts/test_hooks.py, line 45
  • Writes files−8

    does this on the machine, and the frontmatter does not say so

    scripts/test_hooks.py, line 56
  • Reaches the network−10

    does this on the machine, and the frontmatter does not say so

    scripts/test_hooks.py, line 65
  • Runs git commands−5

    does this on the machine, and the frontmatter does not say so

    scripts/test_hooks.py, line 93

Repository health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
Good
  • Development activity100
  • Maintenance100
  • Community44
  • Maturity4
  • Momentum40

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.

Join founders building with open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on SubstackJoin 750+ subscribers