claude-hook-builder

Create, validate, and configure Claude Code hooks with event triggers.

Updated Nov 25, 2025
One-click install
npx skills add https://github.com/gounthar/bazel-riscv --skill claude-hook-builder-gounthar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: claude-hook-builder
Source: https://github.com/gounthar/bazel-riscv/tree/main/.claude/skills/anthropic/claude-hook-builder
Command: npx skills add https://github.com/gounthar/bazel-riscv --skill claude-hook-builder-gounthar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Implementing Claude Code hooks for tool validation, automation, and workflow enhancement requires understanding various hook events, types, and configuration, which can be complex. This Skill simplifies the process, helping you create robust, event-driven automations that save time and improve security.

Core Features & Use Cases

  • Event-Driven Automation: Create hooks that trigger on specific events like PreToolUse, PostToolUse, or UserPromptSubmit to automate tasks at precise moments.
  • Tool Validation & Control: Implement scripts to validate tool inputs, block dangerous commands, or modify tool parameters, enhancing security and preventing errors.
  • Configuration Guidance: Learn to configure hooks in settings.json with appropriate matchers and actions, ensuring seamless integration into your workflow.
  • Use Case: If you want a hook that automatically formats Python files after Claude Code edits them, this Skill can guide you on setting it up as a PostToolUse hook with a bash script, saving you manual formatting time.

Quick Start

Help me create a PreToolUse hook that blocks any Bash command containing 'rm -rf'.

Frequently Asked Questions about claude-hook-builder

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

FAQPage Schema
How do I create a Claude Code hook to validate tool inputs before execution?

Create a PreToolUse hook by configuring a command or prompt-based script in settings.json that validates tool inputs against your schema. Specify the trigger event, tool matcher (Read, Write, Edit, Bash, Glob, or MCP), and return format to block or modify dangerous commands before Claude Code executes them.

What are Claude Code hooks and when should I use them?

Claude Code hooks are event-driven automations triggered on specific moments like PreToolUse, PostToolUse, or UserPromptSubmit. Use them to validate actions, automate formatting, enforce security policies, or modify tool parameters—streamlining workflows while preventing errors and unsafe commands.

Can I automate actions after Claude Code modifies files using hooks?

Yes, use PostToolUse hooks to trigger automation after tool execution. For example, configure a PostToolUse hook with a bash script to auto-format Python files after Claude Code edits them, eliminating manual formatting steps in your workflow.

How do I configure hook scope and matching in settings.json?

Define scope as user, project, or local in settings.json. Specify matchers for targeted tools (Read, Write, Edit, Bash, Glob, or MCP) and trigger events to ensure your hook runs only when conditions align, delivering deterministic and predictable integration.

What hook events are available for Claude Code automation?

Available hook events include PreToolUse, PostToolUse, UserPromptSubmit, Stop, SessionStart, and SessionEnd. Each triggers at different workflow moments, letting you automate validation, cleanup, or notifications at precise points in your Claude Code session.

Can hooks block dangerous bash commands in Claude Code?

Yes, PreToolUse hooks can validate Bash tool inputs and block commands matching unsafe patterns like 'rm -rf'. Configure input schemas and return formats to reject or alert on dangerous operations, enhancing security and preventing accidental data loss.