hooks-automation

hooks-automation is a skill for Claude Code from frankxai/claude-skills-library. It costs 88 tokens per session (2,228 once invoked), scanned B, original, MIT.

A set of hooks for automating actions around Claude Code tasks, sessions, and Git work. Hooks are commands that run before or after certain activities, and MCP is a way for tools to exchange context with the coding agent.

In plain words
What is it for?
Use it when configuring Claude Code hooks, managing sessions, connecting Git actions, coordinating memory, or training patterns from development work.
Why use it?
It reduces repeated manual coordination, formatting, session setup, and task follow-up.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: reads .claude/ paths; mentions subagents; mentions Claude Code.

Part of the claude-skills-library plugin — 114 skills shipped together

Good fit Use it when configuring Claude Code hooks, managing sessions, connecting Git actions, coordinating memory, or training patterns from development work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/frankxai/claude-skills-library/hooks-automation
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.

Any agent
npx skills add frankxai/claude-skills-library --skill hooks-automation
Clone the repo
git clone --depth 1 https://github.com/frankxai/claude-skills-library

Made for: Claude Code.

Or install claude-skills-library, the plugin that ships this one along with the rest of its 114 skills.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/frankxai/claude-skills-library/hooks-automation/github.svg)](https://agentmods.dev/skills/frankxai/claude-skills-library/hooks-automation)
Your own site
<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.

agentmods 80×15 button for hooks-automation

Your own site · 80×15
<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>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,228 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00088 $0.02228
Opus 5.5 $0.00035 $0.00891
Sonnet 5.5 $0.00018 $0.00446
Haiku 4.5 $0.00009 $0.00223

Measured yesterday against content hash 5898aab2a384, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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
free-skills/hooks-automation/SKILL.md · 210 lines

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.json or ~/.claude/settings.json "hooks", writing PreToolUse / PostToolUse / UserPromptSubmit / Stop / SubagentStop / SessionEnd scripts, enforcing exit 2 blocking 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

Read the full file on GitHub · 210 lines

Files

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.

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. yesterday Changed · +31 lines · +20 tokens per session scan A → B 5898aab2a384
  2. 1mo ago First seen · 179 lines · 68 tokens per session scan A ba0e1bfa8245

Subscribe to this mod's changes

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.