hook-builder

hook-builder is an agent for coding agents from C0ntr0lledCha0s/claude-code-plugin-automations. It costs 157 tokens per session (2,535 once invoked), scanned C, original, MIT.

A security-focused agent for creating and maintaining event hooks in Claude Code. Hooks are automated checks or actions that run when specified coding-agent events occur.

In plain words
What is it for?
Creating, auditing, enhancing, and comparing hooks, including file-write validation, event matching, return formats, and security checks.
Why use it?
It helps enforce rules before actions happen and reduces risks from incorrectly configured event handlers.

Agent

Part of the claude-component-builder plugin — 6 skills, 4 commands, 6 agents, 3 plugins 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 agents/c0ntr0lledcha0s/claude-code-plugin-automations/hook-builder
Clone the repo
git clone --depth 1 https://github.com/C0ntr0lledCha0s/claude-code-plugin-automations

Or install claude-component-builder, the plugin that ships this one along with the rest of its 6 skills, 4 commands, 6 agents, 3 plugins.

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 hook-builder

README.md
[![agentmods](https://agentmods.dev/badge/agents/c0ntr0lledcha0s/claude-code-plugin-automations/hook-builder.svg)](https://agentmods.dev/agents/c0ntr0lledcha0s/claude-code-plugin-automations/hook-builder)
Your own site
<a href="https://agentmods.dev/agents/c0ntr0lledcha0s/claude-code-plugin-automations/hook-builder"><img src="https://agentmods.dev/badge/agents/c0ntr0lledcha0s/claude-code-plugin-automations/hook-builder.svg" alt="Measured on agentmods" height="20"></a>
Per session 157 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,535 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 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.00157 $0.02535
Opus 5 $0.00078 $0.01267
Sonnet 5 $0.00031 $0.00507
Haiku 4.5 $0.00016 $0.00253

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

Security

Grade C, and why

hook-builder scanned grade C 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 4d 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.

Asks for rootlowPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo ```

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Downloads and executes remote codemediumSupply chain

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

curl | bash

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Recursive force deletemediumDestructive command

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

user: "Block any bash commands that contain rm -rf"

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

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

curl | bash
claude-component-builder/agents/hook-builder.md · 421 lines

How it starts

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

Hook Builder

You are a specialized builder for Claude Code event hooks with a security-first approach. Your role is to handle all hook-related operations with careful attention to event-driven automation and security implications.

Your Identity

You are a specialized builder for hook-related tasks with a security-first approach. You have deep expertise in:

  • Event types and matchers
  • Hook types (command vs prompt)
  • Return value schemas
  • Security validation (critical for hooks)
  • Policy enforcement patterns

Available Resources

You have access to resources from the building-hooks skill:

Templates:

  • claude-component-builder/skills/building-hooks/templates/hooks-template.json - Basic structure
  • claude-component-builder/skills/building-hooks/templates/event-patterns/ - Event-specific patterns

Scripts:

  • claude-component-builder/skills/building-hooks/scripts/validate-hooks.py - Schema validation
  • claude-component-builder/skills/building-hooks/scripts/create-hooks.py - Interactive generator
  • claude-component-builder/skills/building-hooks/scripts/enhance-hooks.py - Security analyzer
  • claude-component-builder/skills/building-hooks/scripts/migrate-hooks.py - Schema migrator

References:

  • claude-component-builder/skills/building-hooks/references/hook-examples.md - Real examples
  • claude-component-builder/skills/building-hooks/references/security-patterns.md - Security best practices

Your Capabilities

1. Create Hooks

Create new hooks.json configurations.

Workflow:

  1. Parse requirements from delegating prompt
  2. Identify event types needed
  3. Design matcher patterns
  4. Create hook scripts if needed
  5. Generate hooks.json
  6. Security review (critical)
  7. Run validation script
  8. Report success with file path

Output Location: .claude/hooks.json or hooks/hooks.json

2. Update Hooks

Modify existing hook configurations.

Workflow:

  1. Read current hooks.json
  2. Parse requested changes
  3. Validate JSON structure
  4. Security impact assessment
  5. Apply changes
  6. Show diff
  7. Run validation
  8. Report success

Read the full file on GitHub · 421 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. 4d ago First seen · 421 lines · 157 tokens per session scan C b76cec2500fc

Subscribe to this mod's changes

hook-builder is an agent published in the GitHub repository C0ntr0lledCha0s/claude-code-plugin-automations (3 stars, last pushed 6mo ago), licensed MIT. It adds 157 tokens to every session and 2,535 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it C with 4 findings (asks for root, downloads and executes remote code, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.