hook-builder

Generate Bash or Python hook scripts and JSON settings entries for Claude Code lifecycle events.

1|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/hunterbrewer04/claude-toolkit --skill hook-builder-hunterbrewer04
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook-builder
Source: https://github.com/hunterbrewer04/claude-toolkit/tree/main/skills/hook-builder
Command: npx skills add https://github.com/hunterbrewer04/claude-toolkit --skill hook-builder-hunterbrewer04

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and examples (resource) components.

What problem does it solve?

This Skill streamlines the creation of custom hooks for Claude Code, enabling automated responses and validations before or after tool execution, or during other lifecycle events.

Core Features & Use Cases

  • Hook Script Generation: Creates Bash or Python scripts for custom hook logic.
  • Configuration Generation: Generates the necessary JSON entries for .claude/settings.json.
  • Use Case: You need to ensure that no rm -rf commands are ever executed. This Skill can generate a PreToolUse hook that intercepts Bash commands and blocks any that match this dangerous pattern.

Quick Start

Use the hook builder skill to create a PreToolUse hook that blocks git push --force commands.

Frequently Asked Questions about hook-builder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create custom hooks for Claude Code to automate validation before tool execution?

Custom Claude Code hooks automate validation by generating Bash or Python scripts and configuration entries for lifecycle events like PreToolUse. This allows you to intercept and block dangerous commands such as rm -rf before they execute.

What is a PreToolUse hook and how does it work with Bash commands?

A PreToolUse hook intercepts tool execution in Claude Code, allowing you to validate Bash commands before they run. It uses custom scripts to check stdin formats and matchers, returning specific exit codes to block or allow the operation.

Can I use Python scripts for Claude Code hook automation instead of Bash?

Yes, Claude Code hook automation supports both Python and Bash scripts for custom hook logic. The generated scripts handle stdin parsing and return exit codes to control tool execution during lifecycle events like PostToolUse and Stop.

How do I configure hook matchers and exit codes in the settings.json file?

Configuring hooks involves generating JSON entries for the .claude/settings.json file to define matchers and lifecycle events. The hook builder creates these configuration entries alongside your custom scripts, ensuring proper exit codes and stdin/stdout formats are used.

What is the best way to block git push --force commands using Claude Code hooks?

The best way to block git push --force is by creating a PreToolUse hook that intercepts Bash commands. The hook script matches the dangerous pattern and returns a specific exit code to prevent execution before the tool runs.

Which Claude Code lifecycle events support custom hook scripts besides PreToolUse?

Claude Code supports custom hook scripts for multiple lifecycle events, including PostToolUse and Stop. These hooks automate responses and validations by processing stdin and returning exit codes to control execution flow.