Claude Code hook

claude-code-hooks

Collection of safety, cost, observability and productivity hooks, also installable as a plugin marketplace.

572 stars 49 forksHooks Plugin marketplace Source

Install

Inside Claude Code
/plugin marketplace add karanb192/claude-code-hooks
From source
git clone https://github.com/karanb192/claude-code-hooks.git

From the README

claude-code-hooks

🪝 Ready-to-use hooks for Claude Code, shipped as a 22-plugin installable marketplace: safety, automation, notifications, and more.

🌐 Live site & catalog

Claude Code and agents like it run shell commands, edit files, and install packages on their own. claude-code-hooks enforces least privilege on that autonomy at runtime: every tool call passes through a PreToolUse or PostToolUse hook that allows, denies, or modifies it, with the reason fed back to the agent. Hooks run outside the model as separate processes, so prompt injection can't talk its way past them. The safety set blocks .env and secret exfiltration, curl | sh, rm -rf, force pushes to main, and tampering with the hook config itself; the rest of the catalog handles automation and notifications. Every hook is mapped against the OWASP LLM Top 10 2026.

🎬 Quick Demo

    Protecting Secrets
    Blocking Dangerous Commands

A growing collection of tested, documented hooks. Every one installs as a one-command Claude Code plugin: run /plugin marketplace add karanb192/claude-code-hooks, then /plugin install @claude-code-hooks; see Install as a plugin for the 22-plugin catalog. Prefer to own the file? Every plugin's script also works standalone: copy plugins//.js and wire it into settings.json yourself (Quick Start).

📑 Table of Contents

- Hooks
- Install as a plugin
- Quick Start
- Safety Levels
- Testing
- Token Diet
- Configuration Reference
- Contributing
- License

🪝 Hooks

Every hook below is an installable plugin; each link goes to the plugin's directory, which holds the script, its tests, and a README. They're grouped by the event that fires them, because the event model is the thing worth learning.

Session Lifecycle

Runs at session boundaries: inject context at SessionStart and…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
JavaScript
License
MIT
Last updated
2 November 2026
Topics
ai-toolsanthropicautomationclaudeclaude-codeclaude-code-hooksclaude-code-pluginclideveloper-toolshooksmarketplacenotifications

FAQ

What is claude-code-hooks?

Collection of safety, cost, observability and productivity hooks, also installable as a plugin marketplace. It is a hook for Claude Code, from karanb192/claude-code-hooks on GitHub.

How do I install claude-code-hooks?

Run /plugin marketplace add karanb192/claude-code-hooks inside Claude Code, then follow the setup in the README.

Is claude-code-hooks popular?

karanb192/claude-code-hooks has 572 GitHub stars and 49 forks, and is included in 2 curated Claude Code lists. It was last updated on 2 November 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.