create-hooks

Create event-driven Claude Code hooks for tool-use monitoring and validation.

7|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/kvnloo/evolve --skill create-hooks-kvnloo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hooks
Source: https://github.com/kvnloo/evolve/tree/main/.claude/skills/create-hooks
Command: npx skills add https://github.com/kvnloo/evolve --skill create-hooks-kvnloo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides expert guidance to create, configure, and debug Claude Code hooks, enabling programmatic control over Claude's behavior without modifying core code. It eliminates manual intervention for repetitive tasks, validates commands, and injects context, saving you time and reducing errors in your development workflows.

Core Features & Use Cases

  • Event-Driven Automation: Execute shell commands or LLM prompts in response to events like tool use (PreToolUse, PostToolUse), session start/end, or user prompts.
  • Workflow Customization: Automate tasks such as code formatting after edits, logging all bash commands, or sending desktop notifications when Claude needs input.
  • Context Injection & Validation: Inject project-specific context at session start or validate user prompts and tool inputs using LLM reasoning to prevent destructive actions.
  • Use Case: Automatically format code with prettier after every Write or Edit tool use, ensuring consistent code style across your project without any manual effort.

Quick Start

Create a .claude/hooks.json file in your project. Add a PreToolUse hook with a Bash matcher. Configure it to log every bash command to ~/.claude/bash-log.txt. Test your new hook with claude --debug.

Frequently Asked Questions about create-hooks

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

FAQPage Schema
How do I automate Claude Code workflows with event-driven hooks?

Event-driven hooks monitor Claude Code tool usage and trigger automated actions on events like PreToolUse, PostToolUse, or SessionStart. Create a `.claude/hooks.json` file with hook configurations that execute bash commands or LLM prompts in response to these events, enabling automation without modifying core code.

Can I validate and block dangerous bash commands in Claude Code?

Yes. Use PreToolUse hooks with Bash matchers to validate commands before execution. Hooks support LLM reasoning to inspect tool inputs and prevent destructive actions, or return stop signals to block execution entirely.

What events can I hook into with Claude Code?

Claude Code supports PreToolUse, PostToolUse, Stop, SessionStart, and UserPromptSubmit events across Bash, Write/Edit, and MCP tools. Each event fires at specific workflow moments, letting you inject context, log activity, validate inputs, or trigger notifications.

How do I inject project context automatically at session start?

Configure a SessionStart hook to execute LLM prompts that load project-specific context into Claude's reasoning. This prepares Claude with environment details, coding standards, or domain knowledge without manual input on each session.

Can hooks format code automatically after edits?

Yes. Use a PostToolUse hook with a Write/Edit matcher to trigger code formatting tools like Prettier after every file modification. This enforces consistent code style across your project without manual intervention.

What's the difference between command and prompt hooks?

Command hooks execute shell scripts synchronously and return output; prompt hooks submit LLM reasoning tasks that inspect tool inputs or context and return structured decisions like validation results or stop signals for advanced control.