HookStack

Ship fast. Break nothing.Claude Code hooks — plus Codex & Copilot — in one command

Security, quality and workflow guardrails your agent can’t skip.

  • 105 hooks
  • Open-source · MIT
  • Hooks unit-tested
  • Security scanned

Up and running in 60 seconds

project root
0 / 105 selected
$ npx hookstack-cli@latest install

Will writes the hooks into .claude/hooks and patches settings.json — nothing else.

What hooks actually do

Watch your hooks ship a feature

Hooks fire on the agent's lifecycle — guardrails before risky actions, automation after. Scroll through one feature shipping under their watch.

prompt
guard
install
context
quality
tests
ship
UserPromptSubmit

A feature lands on your plate

“Add Stripe checkout.” The agent starts on main — exactly where it shouldn’t.

session-start-load-git-context

"Add Stripe checkout"

or fine-tune it hook by hook

Browse the Claude Code hooks catalogue

Security

15
PreToolUse· Bash
PreToolUse· Bash
PreToolUse· Write|Edit
PreToolUse· Write|Edit
PreToolUse· Bash
PermissionRequest
MessageDisplay
PreToolUse· Write|Edit
PreToolUse· Write|Edit
PreToolUse· Read
MessageDisplay
PreToolUse· Bash
PreToolUse· Bash
PreToolUse· Bash
PreToolUse· Write|Edit

Context

17
UserPromptSubmit
SessionStart
UserPromptSubmit
UserPromptSubmit
PostToolUseFailure
SessionStart· compact
UserPromptExpansion
SessionStart
SessionStart
PreToolUse· WebSearch
SessionStart
PreToolUse· Read
PreToolUse· Read
PreToolUse· Read
PreToolUse· WebFetch
SessionStart
UserPromptSubmit

Validation

33
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
Stop
PreToolUse· Bash
Stop
Stop
Stop
Stop
Stop
PostToolBatch
FileChanged· *.ts|*.tsx|*.js|*.jsx
TaskCompleted
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PreToolUse· Bash
Stop
PostToolUse· Write|Edit
FileChanged· registry.json
Stop
PostToolUse· Write|Edit
PostToolUse· Write|Edit
Stop
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
PostToolUse· Write|Edit
Stop
FileChanged
PreToolUse· Write|Edit
PreToolUse· Write
PostToolUse· Write|Edit

Notification

10
Notification
SessionEnd
PostToolUse
Notification
Stop
Notification
Stop
SubagentStart
SubagentStop
StopFailure· rate_limit

Workflow

22
PreToolUse· Edit|Write
SessionStart
SessionStart
Stop
PreCompact
SessionStart
SessionEnd
ConfigChange
CwdChanged
PermissionRequest· ExitPlanMode
FileChanged· .env|.env.local|.envrc
WorktreeRemove
StopFailure
TaskCreated
PermissionDenied
SessionStart· startup
InstructionsLoaded
SessionStart
FileChanged· *.mjs|registry.json
PreToolUse· Bash
PostToolUse· Write|Edit
SessionStart

Documentation

8
Stop
PostCompact
FileChanged· README.md
Stop
SessionStart
Stop
Stop
Stop
Select hooks (+ button) to generate your settings.json configuration.

Hooks vs slash-commands vs prompt instructions

Three ways to steer Claude Code — only one is guaranteed to run on every action.

Agentic hooksSlash-commandsPrompt instructions
How it runsNode.js script, outside the modelYou type it; the model interpretsText the model may follow
Deterministic?Yes — fires unconditionallyNo — the model decidesNo — probabilistic
Can it be skipped?NoYesYes
Token costZero (separate process)Consumes contextConsumes context
Best forGuardrails, gates, automationOn-demand interactive tasksSoft guidance & style

New to hooks? Read the guides or learn who builds HookStack.

Learn more about Claude Code hooks

Frequently asked questions

What is an agentic hook?
An agentic hook is a Node.js script triggered by Claude Code lifecycle events — PreToolUse, PostToolUse, SessionStart, Stop. Hooks enforce deterministic behavior in agentic workflows: block dangerous commands, run tests automatically, inject context, and notify your team — without relying on the LLM to remember.Read the full guide →
How do agentic hooks improve vibe coding?
Vibe coding lets an AI agent like Claude Code drive most of your implementation while you set direction. Hooks add CI-like guardrails that fire on every agent action — making your agentic workflow production-safe, auditable, and repeatable regardless of what the model decides to do.Read the full guide →
Does HookStack work with GitHub Copilot?
Yes. The hookstack-cli installs the same hooks for GitHub Copilot — the hook scripts (.mjs) are identical, only the config file paths are adapted. Run npx hookstack-cli@latest install --copilot in your project root. Because Copilot and Claude Code share the same lifecycle events (PreToolUse, PostToolUse, SessionStart, Stop), a HookStack hook is portable with no code changes.
Does HookStack work with OpenAI Codex?
Yes. The hookstack-cli installs the same hooks for OpenAI Codex into a .codex/hooks.json config file, with the hook scripts in .codex/hooks/. Use npx hookstack-cli@latest install --codex-project to commit the config with your repo, or --codex-profile to apply it to every project via ~/.codex/hooks.json. Codex and Claude Code share the same lifecycle event names (PreToolUse, PostToolUse, SessionStart, Stop), so the hook code (.mjs) is identical — only the config format differs.
Why are Claude Code hooks better than prompt instructions?
Prompts are probabilistic — the model may or may not follow them. Claude Code hooks are deterministic Node.js scripts that execute unconditionally on matching events. No drift, no hallucination, no forgotten rules. That guarantee is what makes agentic workflows trustworthy in production.Read the full guide →
How do I install Claude Code hooks with HookStack?
Browse the catalogue, select the hooks you want, then run the generated npx hookstack-cli@latest install command in your project root. HookStack writes the scripts to .claude/hooks/ and patches your settings.json — nothing else touched.Read the full guide →
I already use Claude Code commands like /gen-test-unit or /create-worktree — aren't hooks the same thing?
Commands are interactive: you type them, Claude reads and acts on them inside the conversation. Hooks are the opposite — Node.js scripts that fire unconditionally outside the model, triggered by lifecycle events (PreToolUse, PostToolUse, Stop…). The model never sees them, never decides whether to run them, and can't skip them. Commands steer the AI; hooks constrain it.Read the full guide →
Do hooks consume tokens from my context window?
No. Hooks run in a separate process, outside the model entirely. They can inject context back into the session via stdout, but the hook scripts themselves — and whatever they compute — are never sent to the model unless you explicitly return a message. Commands, on the other hand, are part of the conversation and consume context. Hooks are a zero-cost enforcement layer.Read the full guide →