Skip to content

ai / claude-code / hooks

Hooks for Claude Code

40 hooks written out as Claude Code expects them, in .claude/settings.json. Small checks that run on every edit or command, so rules are enforced, not just requested.

/

40 templates

  • Block Chmod 777

    HookSecurity

    Free
  • Block Curl Pipe Shell

    HookSecurity

    Free
  • Block Dangerous Commands

    HookSecurity

    Free
  • Block Database Drops

    HookDatabases

    Free
  • Block Env in Git Add

    HookSecurity

    Free
  • Block Force Push

    HookSecurity

    Free
  • Block Generated File Edits

    HookCode quality

    Free
  • Block Git No Verify

    HookGit and releases

    Free
  • Block Git Reset Hard

    HookGit and releases

    Free
  • Block Global Installs

    HookDevOps and cloud

    Free
  • Block Large Writes

    HookCode quality

    Free
  • Block npm Publish

    Hooknode

    Free
  • Block Secrets in Edits

    HookSecurity

    Free
  • Block Secrets in Prompts

    HookSecurity

    Free
  • Block Sudo Commands

    HookSecurity

    Free
  • Block Vendor Edits

    HookCode quality

    Free
  • Check Node Version

    Hooknode

    Free
  • Detect Merge Markers

    HookGit and releases

    Free
  • Ensure Final Newline

    HookCode quality

    Free
  • Format After Edit

    HookCode quality

    Free
  • Inject Current Date

    HookWorkflow

    Free
  • Inject Git Branch

    HookGit and releases

    Free
  • Log Bash Commands

    HookWorkflow

    Free
  • Log Session End

    HookWorkflow

    Free
  • Notification Bell

    HookWorkflow

    Free
  • Protect CI Workflows

    Hookgithub-actions

    Free
  • Protect Env Files

    HookSecurity

    Free
  • Protect Lockfiles

    HookDevOps and cloud

    Free
  • Remind Run Tests

    HookTesting

    Free
  • Session Git Context

    HookGit and releases

    Free
  • Stop Bell

    HookWorkflow

    Free
  • Trim Trailing Whitespace

    HookCode quality

    Free
  • Validate JSON After Edit

    HookCode quality

    Free
  • Warn Console Log

    Hookjavascript

    Free
  • Warn Debugger Statements

    HookCode quality

    Free
  • Warn Long Files

    HookCode quality

    Free
  • Warn New Todos

    HookCode quality

    Free
  • Warn Skipped Tests

    Hookjavascript

    Free
  • Warn Uncommitted Changes

    HookGit and releases

    Free

Hooks for Claude Code: the basics

Where do hooks go in Claude Code?
Claude Code reads them from .claude/settings.json, a file it shares with your other settings, so the install command merges into it instead of replacing it. The install command on each page writes the file there for you.
What is a hook?
A command the agent runs at a fixed moment, such as before a tool call or after an edit. Unlike an instruction, a hook always runs, so it can block a dangerous command or format a file every time.
Do I need to restart Claude Code after installing?
Skills, subagents and commands are picked up in a new session. MCP servers and hooks are read at startup, so restart the session and approve the server when asked.