generate-hooks

generate-hooks is a command for Claude Code from Jamie-BitFlight/claude_skills. It costs 21 tokens per session (513 once invoked), scanned A, original, MIT.

A command that turns findings from a kaizen analysis into proposed or installed Claude Code hooks. Hooks are automated actions that run at specific agent events.

In plain words
What is it for?
Use it to create hook configurations from an analysis file, either as draft proposals or directly in project settings.
Why use it?
It helps prevent repeated tool misuse, missing context, quality-gate failures, and other recurring mistakes without correcting them manually each time.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; mentions Claude Code.

Part of the agentskill-kaizen plugin — 4 skills, 4 commands, 2 agents shipped together

Good fit Use it to create hook configurations from an analysis file, either as draft proposals or directly in project settings.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/jamie-bitflight/claude_skills/generate-hooks
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.

Clone the repo
git clone --depth 1 https://github.com/Jamie-BitFlight/claude_skills

Made for: Claude Code.

Or install agentskill-kaizen, the plugin that ships this one along with the rest of its 4 skills, 4 commands, 2 agents.

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 generate-hooks

README.md
[![agentmods](https://agentmods.dev/badge/commands/jamie-bitflight/claude_skills/generate-hooks.svg)](https://agentmods.dev/commands/jamie-bitflight/claude_skills/generate-hooks)
Your own site
<a href="https://agentmods.dev/commands/jamie-bitflight/claude_skills/generate-hooks"><img src="https://agentmods.dev/badge/commands/jamie-bitflight/claude_skills/generate-hooks.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 513 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00021 $0.00513
Opus 5 $0.00010 $0.00257
Sonnet 5 $0.00004 $0.00103
Haiku 4.5 $0.00002 $0.00051

Measured 4d ago against content hash 64712dc0a644, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

generate-hooks scanned grade A with 0 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/agentskill-kaizen/commands/generate-hooks.md · 50 lines

How it starts

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

Generate Claude Code hook configurations from kaizen analysis findings. Translates discovered anti-patterns into automated prevention hooks.

Arguments

  • --install — Write hooks directly to project settings instead of draft files. Without this flag, hooks are written as proposals to .planning/kaizen/hooks/.
  • --from <analysis-file> — Source analysis file to generate hooks from. Default: most recent analysis file in .planning/kaizen/.

Execution Steps

  1. Find source analysis. If --from is provided, use that file. Otherwise, glob for the most recent .planning/kaizen/analysis-*.md.

  2. Extract hook-eligible findings. Read the analysis file and identify findings where the recommended improvement type is "hook". Filter for:

    • Tool misuse patterns (PreToolUse deny/redirect)
    • Missing context injection (SubagentStart)
    • Quality gate violations (SubagentStop, Stop)
    • Repeated manual corrections (PreToolUse)
  3. Spawn @improvement-generator agent. Delegate hook generation:

    subagent_type: improvement-generator
    prompt: "Generate hook configurations from these findings: {findings}. Write proposals to .planning/kaizen/hooks/ or install to settings if --install flag is set."
    

    The agent uses the kaizen-improvement skill which contains hook patterns and templates.

  4. Output results.

    Draft mode (default): Write each hook proposal as a separate file in .planning/kaizen/hooks/:

    .planning/kaizen/hooks/
    ├── tool-misuse-prevention.md
    ├── edit-before-read-guard.md
    └── research-to-files-enforcement.md
    

    Each file contains the hook configuration, script (if command type), rationale, and testing instructions.

    Install mode (--install): Merge hook configurations into the project's hooks/hooks.json or .claude/settings.json. Report what was installed.

  5. Display summary. Show the user how many hooks were generated, what anti-patterns they address, and where the output was written.

Read the full file on GitHub · 50 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 · 50 lines · 21 tokens per session scan A 64712dc0a644

Subscribe to this mod's changes

generate-hooks is a command published in the GitHub repository Jamie-BitFlight/claude_skills (66 stars, last pushed today), licensed MIT. It adds 21 tokens to every session and 513 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.