enhance-hooks

enhance-hooks is a skill for Claude Code, Codex from agent-sh/agentsys. It costs 19 tokens per session (3,436 once invoked), scanned F, original, MIT.

A review skill for Claude Code hooks. Hooks are automated actions that run at specific points in a coding-agent session, such as before a tool runs.

In plain words
What is it for?
It discovers hook files, checks their event types and frontmatter, reports findings, and can apply automatic fixes when given the --fix option.
Why use it?
It checks hook definitions and scripts for unsafe behavior, missing time limits, incorrect settings, and other problems.

Skill for Claude CodeCodex

Part of the agentsys plugin — 28 skills, 1 hook shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/agent-sh/agentsys/enhance-hooks
Any agent
npx skills add agent-sh/agentsys --skill enhance-hooks
Clone the repo
git clone --depth 1 https://github.com/agent-sh/agentsys

Made for: Claude Code, Codex.

Or install agentsys, the plugin that ships this one along with the rest of its 28 skills, 1 hook.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for enhance-hooks

README.md
[![agentmods](https://agentmods.dev/badge/skills/agent-sh/agentsys/enhance-hooks.svg)](https://agentmods.dev/skills/agent-sh/agentsys/enhance-hooks)
Your own site
<a href="https://agentmods.dev/skills/agent-sh/agentsys/enhance-hooks"><img src="https://agentmods.dev/badge/skills/agent-sh/agentsys/enhance-hooks.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,436 The whole file, excluding the scripts and references it only reads on demand.
Security scan F 4 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00019 $0.03436
Opus 5 $0.00010 $0.01718
Sonnet 5 $0.00004 $0.00687
Haiku 4.5 $0.00002 $0.00344

Measured 5d ago against content hash 37fa54f06d36, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade F, and why

enhance-hooks scanned grade F with 4 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

| `curl \| sh` | Remote code execution | HIGH |

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

| User settings | `~/.claude/settings.json` | All projects | No |

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

if echo "$cmd" | grep -qE 'rm -rf|git reset --hard|curl.*\|.*sh'; then

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

if echo "$cmd" | grep -qE 'rm -rf|git reset --hard|curl.*\|.*sh'; then
.kiro/skills/enhance-hooks/SKILL.md · 555 lines

How it starts

The opening of the file, as written. The whole thing — 555 lines — stays where its author put it; the contents beside it link to each section on GitHub.

enhance-hooks

Analyze hook definitions and scripts for safety, correctness, and best practices.

Parse Arguments

const args = '$ARGUMENTS'.split(' ').filter(Boolean);
const targetPath = args.find(a => !a.startsWith('--')) || '.';
const fix = args.includes('--fix');

Workflow

  1. Discover - Find hook files (.md, .sh, .json)
  2. Classify - Identify hook type and event
  3. Parse - Extract frontmatter and script content
  4. Check - Run all pattern checks against knowledge below
  5. Filter - Apply certainty filtering
  6. Report - Generate markdown output
  7. Fix - Apply auto-fixes if --fix flag present

Hook Knowledge Reference

What Are Hooks

Hooks are automated actions triggered at specific points in a Claude Code session. They enable validation, monitoring, and control of Claude's actions through bash commands or LLM-based evaluation.

Hook Lifecycle (Complete Reference)

Hooks fire in this sequence:

Order Event Description Matcher Required
1 SessionStart Session begins or resumes No
2 UserPromptSubmit User submits a prompt No
3 PreToolUse Before tool execution (can modify/block) Yes
4 PermissionRequest When permission dialog appears Yes
5 PostToolUse After tool succeeds Yes
6 SubagentStart When spawning a subagent No
7 SubagentStop When subagent finishes No
8 Stop Claude finishes responding No
9 PreCompact Before context compaction No
10 SessionEnd Session terminates No
11 Notification Claude Code sends notifications No

Hook Types

Command Hooks (type: "command"):

  • Execute bash commands with full stdin/stdout control
  • Available for all events

Prompt Hooks (type: "prompt"):

  • Use LLM evaluation for intelligent, context-aware decisions
  • Only supported for Stop and SubagentStop events

Read the full file on GitHub · 555 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 555 lines · 19 tokens per session scan F 37fa54f06d36

Subscribe to this mod's changes

enhance-hooks is a skill published in the GitHub repository agent-sh/agentsys (982 stars, last pushed yesterday), licensed MIT. It adds 19 tokens to every session and 3,436 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it F with 4 findings (downloads and executes remote code, reads agent configuration directories, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.