agentleFS
yeaight7yeaight7/agent-powerups/skills/hook-safety-review/SKILL.md

hook-safety-review

Skill6 starsChanged 4 months agoApache-2.0View on GitHub

Use when a hook is about to be enabled or modified -- a hook recipe proposed for activation, a pre/post-tool or lifecycle hook added to agent settings, a git pre-commit hook added to a repo, or a third-party hook snippet pasted in from outside.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not use for broad agent-config audits — that is the agent-config-security-audit skill.

    line 17
  2. Distinctive:

    Classify and report: Use the same levels as the security-audit command: P0 direct risk (injection, exfiltration, secret access) — do not …

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Purpose

Review a hook definition before it is enabled so command injection, data exfiltration, and silent failure cannot ride in on automation. Hooks run automatically with the agent's privileges; a malicious or sloppy hook executes without any further review once it is on.

When to Use

  • A hook recipe (safety, quality, productivity) is a candidate for activation
  • An agent settings file gains or changes a lifecycle hook entry
  • A git pre-commit or pre-push hook is added or edited
  • A hook snippet arrives from outside the repo

Do not use for broad agent-config audits — that is the agent-config-security-audit skill. This skill is the enablement gate for one hook at a time.

Inputs

  • The hook definition: command body, trigger event, matcher pattern
  • The settings or recipe file that declares it
  • What the hook can reach: environment variables, file paths, network

Workflow

  1. Inventory the trigger surface. Identify the event (pre-tool, post-tool, session start, commit), the matcher pattern, and how often it fires. A catch-all matcher on a high-frequency event deserves the strictest review.
  2. Scan for command injection. Any user- or model-controlled value interpolated into a shell string is a P0 until proven bounded:

    rg -n '\$\{?[A-Za-z_]+\}?|\$\(|`' <hook-file>        # interpolation and substitution
    rg -n 'eval|sh -c|bash -c|Invoke-Expression' <hook-file>
  3. Scan for outbound network. Hooks should not phone home:

    rg -n 'curl|wget|nc |Invoke-WebRequest|Invoke-RestMethod' <hook-file>

    Any hit needs a documented justification and explicit user approval.

  4. Scan for silent failure. Error suppression hides both bugs and attacks:

    rg -n '\|\| true|2>/dev/null|2>\$null|exit 0' <hook-file>

    A hook that swallows its own failures cannot be trusted to gate anything.

  5. Check scope and privilege. Does the body read or write outside the repo? Does it touch credentials, dotfiles, or agent config? Flag absolute paths and home-directory access.
  6. Classify and report. Use the same levels as the security-audit command: P0 direct risk (injection, exfiltration, secret access) — do not enable; P1 weakened controls (suppression, over-broad matcher) — fix before enabling; Note — best-practice gap, log it.

Output

  • A per-hook verdict: enable, fix-then-enable, or reject
  • Findings listed with level, line reference, and a concrete fix each
  • An explicit "no findings" statement when the hook is clean

Verification

  • Trigger event and matcher breadth were identified before reading the body
  • Injection, network, and suppression scans were actually run, not eyeballed
  • Every P0/P1 finding carries a line reference and a concrete fix
  • No hook was enabled during the review — the verdict and the enablement are separate, user-approved steps

Failure Modes

  • Eyeball-only review — skimming the body instead of running the scans lets obfuscated interpolation through.
  • Reviewing one file, enabling another — the content reviewed must be exactly what gets enabled, byte for byte.
  • Matcher blindness — a benign-looking body behind a catch-all matcher still runs everywhere; breadth is part of the risk.
  • Review-as-enablement — this skill ends with a verdict; turning the hook on is a separate, explicit user decision.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.