create-hooks

Create and debug event-driven hooks for Claude Code workflows.

2.0k|410|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/glittercowboy/taches-cc-resources --skill create-hooks-glittercowboy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hooks
Source: https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooks
Command: npx skills add https://github.com/glittercowboy/taches-cc-resources --skill create-hooks-glittercowboy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the problem of needing to manually intervene or write custom code for repetitive tasks within Claude Code. It allows you to automate responses to specific events, ensuring consistency, enforcing policies, and streamlining workflows without direct human oversight.

Core Features & Use Cases

  • Event-Driven Automation: Trigger custom actions (shell commands or LLM prompts) in response to events like tool usage, user prompts, or session start/end.
  • Workflow Customization: Implement project-specific automation, such as auto-formatting code after edits, logging all bash commands, or adding context at session start.
  • Safety & Validation: Block destructive commands (e.g., git push --force, rm -rf), validate user prompts, or ensure tests pass before Claude stops.

Quick Start

Create a hook to log all bash commands Claude executes to a file named ~/.claude/bash-log.txt.

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 trigger custom actions in response to specific events like tool usage, user prompts, or session start. Configure hooks with JSON schemas, matcher patterns, and transformations to automate validation, logging, and command execution across Bash, Write/Edit, MCP, and other tool categories without manual intervention.

Can I block destructive bash commands before Claude executes them?

Yes. PreToolUse hooks validate commands before execution by matching patterns against tool inputs and returning permission decisions. Block dangerous commands like `git push --force` or `rm -rf` by defining matcher patterns and setting deny permissions in your hook configuration.

What are the different hook types available in Claude Code?

Claude Code supports PreToolUse, PostToolUse, UserPromptSubmit, Stop, and SessionStart hooks. Each type triggers at different workflow stages, allowing you to inject context, log activity, validate inputs, enforce policies, or automate responses to user prompts and tool execution events.

How do I log all bash commands Claude executes?

Create a PostToolUse hook targeting Bash tools that captures command inputs and writes them to a log file. Configure the hook with a matcher pattern, define output transformation logic, and specify the destination file path to maintain an audit trail of all executed commands.

Do hooks support environment variables and system messages?

Yes. Hooks support environment variables for dynamic configuration and system messages for injecting context or instructions. Use these features to customize hook behavior per project, pass sensitive values securely, and modify Claude's responses based on hook-triggered events.

What input and output schemas do hooks require?

Hooks use JSON-based input/output schemas defining the structure of hook payloads and responses. Schemas specify matcher patterns for tool selection, command and prompt hook types, transformation fields (updatedInput, permission decisions), and system message injection for safe, validated automation.