Claude Code hook
Claude Hooks
A Ruby DSL for creating Claude Code hooks
Install
git clone https://github.com/gabriel-dehan/claude_hooks.gitFrom the README
Ruby DSL for Claude Code hooks v1.4.0 just released and is introducing a great number of changes. Please read the CHANGELOG for more information. A Ruby DSL (Domain Specific Language) for creating Claude Code hooks. This will hopefully make creating and configuring new hooks way easier. Why use this instead of writing bash, or simple ruby scripts? You might also be interested in my other project, a Claude Code statusline that shows your Claude usage in realtime, inside Claude Code โจ. ๐ Table of Contents - Ruby DSL for Claude Code hooks - ๐ Table of Contents - ๐ Quick Start - ๐ฆ Installation - ๐๏ธ Architecture - ๐ช Hook Types - ๐ Claude Hook Flow - ๐ API Reference - ๐ Example: Tool usage monitor - ๐ Hook Output - ๐ Plugin Hooks Support - ๐ ๏ธ MCP Tools Integration - ๐จ Advices - โ ๏ธ Troubleshooting - ๐งช CLI Debugging - ๐ Debugging - ๐งช Development \& Contributing ๐ Quick Start Examples are available in example_dotclaude/hooks/. The GithubGuard in particular is a good example of a solid hook. You can also check Kyle's hooks for some great examples Claude Code supports two types of hooks: - Command hooks (type: "command") - Execute Ruby/bash scripts (what this DSL is for) - Prompt-based hooks (type: "prompt") - Delegate decisions to an LLM (see guide) Here's how to create a simple command hook with this DSL: 1. Install the gem: 1. Create a simple hook script 3. โ ๏ธ Make it executable 4. Register it in your .claude/settings.json That's it! Your hook will now add context to every user prompt. ๐ Need to run multiple hooks for the same event and merge their outputs? See Multi-hook structure below. ๐ฆ Installation Install it globally (simpler): Using a Gemfile Unless you use bundle exec in the command in yourโฆ
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.
Details
- Repository
- gabriel-dehan/claude_hooks
- Type
- Hooks
- Language
- Ruby
- Last updated
- 2 November 2026
- Listed in
- awesome-claude-code-hooks
FAQ
What is Claude Hooks?
A Ruby DSL for creating Claude Code hooks It is a hook for Claude Code, from gabriel-dehan/claude_hooks on GitHub.
How do I install Claude Hooks?
Clone gabriel-dehan/claude_hooks from GitHub and follow the setup steps in its README.
Is Claude Hooks popular?
gabriel-dehan/claude_hooks has 41 GitHub stars and 2 forks, and is included in 1 curated Claude Code list. It was last updated on 2 November 2026.
More hooks
Secguard
61random1st/secguard
3-level security toolkit for AI agents: regex patterns, heuristic rules, ML classification. Claude Code hooks, git pre-commit, CI/CD scanner.
AI Helpers
39opendatahub-io/ai-helpers
AI Helpers โ collections of Skills, Hooks, Agents (compatible with Claude Code, Cursor and other tools) and Gemini Gems
c0ntextKeeper
61Capnjbrown/c0ntextKeeper
Automatic context preservation for Claude Code. Never lose work to compaction again. 7 hooks, 187 semantic patterns, 3 MCP tools.
Bad Daves Robot Army
61dgriffith/bad-daves-robot-army
Repository for Claude Code artifacts, including subagents, slash commands, and hooks
Claude Leverage
68Filip-Podstavec/claude-leverage
Make any repo AI-first - write sustainable code from the start, or refactor a legacy codebase to prepare it for agent-driven development.Building blocks for Claude Code: subagents, slash commands, hooks, and workflow patterns. Copy what you need. A working developer's stack for Claude Code.
Prowler Studio
54prowler-cloud/prowler-studio
Prowler Studio an AI workflow that ensures Claude Code follows Prowler's guardrails to deliver consistent, tested, and PR-ready threat detection checks, remediations and update compliance frameworks.
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.