# Create Hooks

Expert guidance for creating, configuring, and using Claude Code hooks.

- Repository: https://github.com/glittercowboy/taches-cc-resources (1986 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-04-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add glittercowboy/taches-cc-resources --skill create-hooks -g -a claude-code -y`
Codex: `npx skills add glittercowboy/taches-cc-resources --skill create-hooks -g -a codex -y`
Cursor: `npx skills add glittercowboy/taches-cc-resources --skill create-hooks -g -a cursor -y`
Gemini CLI: `npx skills add glittercowboy/taches-cc-resources --skill create-hooks -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add glittercowboy/taches-cc-resources`

## Description

Expert guidance for creating, configuring, and using Claude Code hooks. Use when working with hooks, setting up event listeners, validating commands, automating workflows, adding notifications, or understanding hook types (PreToolUse, PostToolUse, Stop, SessionStart, UserPromptSubmit, etc).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

<objective>
Hooks are event-driven automation for Claude Code that execute shell commands or LLM prompts in response to tool usage, session events, and user interactions. This skill teaches you how to create, configure, and debug hooks for validating commands, automating workflows, injecting context, and implementing custom completion criteria.

Hooks provide programmatic control over Claude's behavior without modifying core code, enabling project-specific automation, safety checks, and workflow customization.
</objective>

<context>
Hooks are shell commands or LLM-evaluated prompts that execute in response to Claude Code events. They operate within an event hierarchy: events (PreToolUse, PostToolUse, Stop, etc.) trigger matchers (tool patterns) which fire hooks (commands or prompts). Hooks can block actions, modify tool inputs, inject context, or simply observe and log Claude's operations.
</context>

<quick_start>
<workflow>
1. Create hooks config file:
   - Project: `.claude/hooks.json`
   - User: `~/.claude/hooks.json`
2. Choose hook event (when it fires)
3. Choose hook type (command or prompt)
4. Configure matcher (which tools trigger it)
5. Test with `claude --debug`
</workflow>

<example>
**Log all bash commands**:

`.claude/hooks.json`:
```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '\"\\(.tool_input.command) - \\(.tool_input.description // \\\"No description\\\")\"' >> ~/.claude/bash-log.txt"
          }
        ]
      }
    ]
  }
}
```

This hook:
- Fires before (`PreToolUse`) every `Bash` tool use
- Executes a `command` (not an LLM prompt)
- Logs command + description to a file
</example>
</quick_start>

The rest: https://github.com/glittercowboy/taches-cc-resources/blob/HEAD/skills/create-hooks/SKILL.md
