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.
npx skills add frankxai/claude-skills-library --skill hooks-automationgit clone --depth 1 https://github.com/frankxai/claude-skills-libraryWrote 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.
[](https://agentmods.dev/skills/frankxai/claude-skills-library/hooks-automation)<a href="https://agentmods.dev/skills/frankxai/claude-skills-library/hooks-automation"><img src="https://agentmods.dev/badge/skills/frankxai/claude-skills-library/hooks-automation/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/frankxai/claude-skills-library/hooks-automation"><img src="https://agentmods.dev/badge/skills/frankxai/claude-skills-library/hooks-automation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00088 | $0.02228 |
| Opus 5.5 | $0.00035 | $0.00891 |
| Sonnet 5.5 | $0.00018 | $0.00446 |
| Haiku 4.5 | $0.00009 | $0.00223 |
Grade B, and why
hooks-automation scanned grade B with 1 finding 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 yesterday.
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.
Configure deterministic lifecycle hooks in `.claude/settings.json` (project) or `~/.claude/settings.json` (user) so Claude Code automatically formats edited files, gates risky shell or Git commands before execution, bloc How it starts
The opening of the file, as written. The whole thing — 210 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Claude Code Hooks Automation
Configure deterministic lifecycle hooks in .claude/settings.json (project) or ~/.claude/settings.json (user) so Claude Code automatically formats edited files, gates risky shell or Git commands before execution, blocks secret leaks or protected-file writes, and persists session state on completion.
Trigger Boundaries
- Activate when: Setting up or debugging
.claude/settings.jsonor~/.claude/settings.json"hooks", writingPreToolUse/PostToolUse/UserPromptSubmit/Stop/SubagentStop/SessionEndscripts, enforcingexit 2blocking gates, or returning structured JSON decisions on stdout. - Do NOT activate when: Writing React hooks (
useState,useEffect), Git-only.git/hooks/without Claude Code lifecycle integration, or generic webhook endpoints (Stripe/Polar/GitHub HTTP webhooks).
Native Claude Code Hooks (settings.json)
Claude Code executes shell commands registered under the "hooks" key in .claude/settings.json at specific lifecycle events. Every hook receives a JSON payload on stdin and communicates back via exit codes and stdout/stderr.
Hook Lifecycle Events
| Event | When It Fires | Common Use Cases |
|---|---|---|
PreToolUse |
Before a tool call executes (matches tool_name via regex matcher) |
Block unsafe Bash commands, run pre-commit checks before git commit, guard secrets and protected files |
PostToolUse |
After a tool call completes successfully | Auto-format files after Write, Edit, or MultiEdit; run targeted tests |
UserPromptSubmit |
When the user submits a prompt, before Claude processes it | Inject repository context, validate prompt constraints |
Stop |
When the main Claude Code agent finishes responding | Save session state, log trajectory metrics, verify completion checks |
SubagentStop |
When a spawned subagent (Task) finishes responding |
Aggregate subagent outputs, verify handoff receipts |
SessionEnd |
When a Claude Code session closes or terminates | Persist final session state, export metrics, clean up temporary artifacts |
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- yesterday Changed · +31 lines · +20 tokens per session scan A → B 5898aab2a384
- 1mo ago First seen · 179 lines · 68 tokens per session scan A ba0e1bfa8245
hooks-automation is a skill published in the GitHub repository frankxai/claude-skills-library (47 stars, last pushed yesterday), licensed MIT. It adds 88 tokens to every session and 2,228 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
setup-pre-commit
A setup for Husky pre-commit checks in a JavaScript or TypeScript repository. A pre-commit hook runs automatically before a Git commit and can format staged files, check types, and run tests.
implement-spec
A coding workflow that implements a written specification through a set of linked tickets. It creates a branch and draft pull request, assigns independent work to separate agents, combines their changes, and prepares the result for review.
git-guardrails-claude-code
A Claude Code setup that blocks selected destructive Git commands before they run. Git is a tool for tracking code changes; the blocked commands include pushing, deleting branches, discarding changes, and hard resets.
ship
Commit, push, create PR(s), and auto-finalize — full automation pipeline. Handles uncommitted changes and recently created PRs.
iterm2-layout
Configure iTerm2 workspace layouts with TOML. TRIGGERS - iTerm2 layout, workspace tabs, layout.toml, AutoLaunch.
commit
Smart commit with Ollama-generated messages. Conventional commits, auto-push option. Triggers on: commit this, commit changes, smart commit, /commit.