build-hook

build-hook is a command for Claude Code from alirezarezvani/claude-code-skill-factory. It costs 0 tokens per session (3,082 once invoked), scanned D, original, MIT.

An interactive command for creating custom hooks, which are automated actions triggered by development events. It asks questions, creates a hook configuration and installation guide, and validates the result.

In plain words
What is it for?
Used to create hooks from a guided questionnaire or a suggested type, then save them under generated-hooks with documentation and validation.
Why use it?
It turns an idea such as a formatting, testing, notification, or Git hook into a configured file set without requiring the user to design every detail manually. It also checks for unsafe operations and missing error handling.

Command for Claude Code

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 commands/alirezarezvani/claude-code-skill-factory/build-hook
Clone the repo
git clone --depth 1 https://github.com/alirezarezvani/claude-code-skill-factory

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/alirezarezvani/claude-code-skill-factory/build-hook.svg)](https://agentmods.dev/commands/alirezarezvani/claude-code-skill-factory/build-hook)
Your own site
<a href="https://agentmods.dev/commands/alirezarezvani/claude-code-skill-factory/build-hook"><img src="https://agentmods.dev/badge/commands/alirezarezvani/claude-code-skill-factory/build-hook.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,082 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 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.00000 $0.03082
Opus 5 $0.00000 $0.01541
Sonnet 5 $0.00000 $0.00616
Haiku 4.5 $0.00000 $0.00308

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

Security

Grade D, and why

build-hook scanned grade D with 2 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.

Reads agent configuration directoriesmediumAgent snooping

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

# Install to user level (~/.claude/settings.json)

Recursive force deletehighDestructive command

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

- No dangerous commands (rm -rf, git push --force, etc.)
.claude/commands/build-hook.md · 556 lines

How it starts

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

/build-hook - Build Custom Claude Code Hooks

Interactive guide for creating custom hooks with Q&A workflow and automatic validation.

Note: This command is also available as /build hook for consistency with other factories (skills, agents, prompts). Both work identically - use whichever you prefer!

  • Consistent pattern: /build hook (recommended)
  • Alias: /build-hook (this command)

Usage

/build-hook
/build-hook notification
/build-hook formatting
/build-hook testing
/build-hook git

What This Command Does

Two Ways to Build Hooks:

1. Agent-Guided (Recommended for Beginners)

Without arguments (/build-hook):

  • Invokes the hooks-guide agent for interactive Q&A
  • Asks 5-7 straightforward questions about your hook needs
  • Generates complete hook configuration with validation
  • Creates README.md with installation guide
  • Validates safety (no destructive ops, proper error handling)
  • Saves to generated-hooks/[hook-name]/

With argument (/build-hook [type]):

  • Suggests hook template based on type
  • Continues with interactive questions
  • Customizes template for your needs

2. Direct CLI (Advanced Users)

Interactive Mode:

cd generated-skills/hook-factory
python3 hook_factory.py -i
  • 7-question guided flow with smart defaults
  • Comprehensive input validation
  • Optional auto-install to user/project level
  • Faster workflow for experienced users

Template Mode:

python3 hook_factory.py -t post_tool_use_format -l python
  • Direct template generation
  • Requires template knowledge
  • Manual installation needed

Examples

Build Any Hook (Interactive)

/build-hook

Output:

Welcome to the Claude Code Hooks Factory! 🔧

I'll help you build a custom hook through 5-7 straightforward questions.

Hooks are workflow automation that run when events occur:
- SessionStart: Load context when Claude starts
- PostToolUse: Auto-format code after editing
- SubagentStop: Run tests when agents complete
- And 4 more event types...

Let's get started!

Question 1: What should this hook do?
Examples:
- Auto-format Python files
- Run tests automatically
- Send notifications
- Auto-commit to git

Your answer: ___

Read the full file on GitHub · 556 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 · 556 lines · 0 tokens per session scan D 475872e3d0be

Subscribe to this mod's changes

build-hook is a command published in the GitHub repository alirezarezvani/claude-code-skill-factory (855 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,082 tokens. A static security scan graded it D with 2 findings (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.