Skip to content
Development
Skill

/hook-safety-review

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.

From plugin
agent-powerups
8114 skills46 agents54 commands

Claude Code

$ npx -y skills add yeaight7/agent-powerups --skill hook-safety-review --agent claude-code

SKILL.md

hook-safety-review.SKILL.md
name: hook-safety-review
description: 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.

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.
Read more
@yeaight7
Ships withagent-powerups

Curated power-ups for coding agents: skills, slash commands, MCP configs, hooks, AGENTS.md templates, and workflows for serious software engineering. Claude Code, Codex, Antigravity CLI, Cursor and more

8114 skills46 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
8
Star history of yeaight7/agent-powerups on GitHub, a chart by star-history.com

Other skills on agent-powerups.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc11d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about hook-safety-review.

Which coding agents can use hook-safety-review?
hook-safety-review installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.