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

MITAuto-check passedAgent Workflows

Install Create Hooks

skills CLI
$ npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install glittercowboy/taches-cc-resources create-hooks --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/glittercowboy/taches-cc-resources.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/create-hooks .claude/skills/create-hooks && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
create-hooks
GitHub stars
2k
Token cost
~2.4k tokens
SKILL.md length
726 words
Files
7 (incl. references)
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 5 steps: Create hooks config file → Choose hook event (when it fires) → Choose hook type (command or prompt) → …
  • Working with hooks
  • Calls claude and jq
  • Setting up event listeners

What it does

Create Hooks is an agent skill from glittercowboy/taches-cc-resources. 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).

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/command-vs-prompt.md`, `references/examples.md` and `references/hook-types.md`).

It sits in Agent Workflows, covering Hooks and plugins. The repository describes itself as: A collection of my favorite custom Claude Code resources to make life easier. The licence is MIT.

When your agent uses it

  • Working with hooks
  • Setting up event listeners
  • Validating commands
  • Automating workflows

Example prompts

  • “/create-hooks”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Create hooks config file
  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

What it can do on your machine

Read from SKILL.md and the folder at commit 1757615. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • claude
    • jq

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Create Hooks loads about 2.4k tokens when it runs, and up to ~16k if it reads all its reference files. Until then it costs about 76 tokens; SKILL.md has 726 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~76
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~16k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from glittercowboy/taches-cc-resources at commit 1757615, republished under its MIT licence (© glittercowboy). 726 words, ~2,357 tokens.

Download SKILL.mdSave it as .claude/skills/create-hooks/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
create-hooks
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).
<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>

<hook_types>

EventWhen it firesCan block?
PreToolUseBefore tool executionYes
PostToolUseAfter tool executionNo
UserPromptSubmitUser submits a promptYes
StopClaude attempts to stopYes
SubagentStopSubagent attempts to stopYes
SessionStartSession beginsNo
SessionEndSession endsNo
PreCompactBefore context compactionYes
NotificationClaude needs inputNo

Blocking hooks can return "decision": "block" to prevent the action. See references/hook-types.md for detailed use cases. </hook_types>

<hook_anatomy> <hook_type name="command"> Type: Executes a shell command

Use when:

  • Simple validation (check file exists)
  • Logging (append to file)
  • External tools (formatters, linters)
  • Desktop notifications

Input: JSON via stdin Output: JSON via stdout (optional)

json
{
  "type": "command",
  "command": "/path/to/script.sh",
  "timeout": 30000
}

</hook_type>

<hook_type name="prompt"> Type: LLM evaluates a prompt

Use when:

  • Complex decision logic
  • Natural language validation
  • Context-aware checks
  • Reasoning required

Input: Prompt with $ARGUMENTS placeholder Output: JSON with decision and reason

json
{
  "type": "prompt",
  "prompt": "Evaluate if this command is safe: $ARGUMENTS\n\nReturn JSON: {\"decision\": \"approve\" or \"block\", \"reason\": \"explanation\"}"
}

</hook_type> </hook_anatomy>

<matchers>
Matchers filter which tools trigger the hook:
json
{
  "matcher": "Bash",           // Exact match
  "matcher": "Write|Edit",     // Multiple tools (regex OR)
  "matcher": "mcp__.*",        // All MCP tools
  "matcher": "mcp__memory__.*" // Specific MCP server
}

No matcher: Hook fires for all tools

json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [...]  // No matcher - fires on every user prompt
      }
    ]
  }
}
</matchers>

<input_output> Hooks receive JSON via stdin with session info, current directory, and event-specific data. Blocking hooks can return JSON to approve/block actions or modify inputs.

Example output (blocking hooks):

json
{
  "decision": "approve" | "block",
  "reason": "Why this decision was made"
}

See references/input-output-schemas.md for complete schemas for each hook type. </input_output>

<environment_variables> Available in hook commands:

VariableValue
$CLAUDE_PROJECT_DIRProject root directory
${CLAUDE_PLUGIN_ROOT}Plugin directory (plugin hooks only)
$ARGUMENTSHook input JSON (prompt hooks only)

Example:

json
{
  "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/validate.sh"
}

</environment_variables>

<common_patterns> Desktop notification when input needed:

json
{
  "hooks": {
    "Notification": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Claude needs input\" with title \"Claude Code\"'"
          }
        ]
      }
    ]
  }
}

Block destructive git commands:

json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "prompt",
            "prompt": "Check if this command is destructive: $ARGUMENTS\n\nBlock if it contains: 'git push --force', 'rm -rf', 'git reset --hard'\n\nReturn: {\"decision\": \"approve\" or \"block\", \"reason\": \"explanation\"}"
          }
        ]
      }
    ]
  }
}

Auto-format code after edits:

json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "prettier --write $CLAUDE_PROJECT_DIR",
            "timeout": 10000
          }
        ]
      }
    ]
  }
}

Add context at session start:

json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "echo '{\"hookSpecificOutput\": {\"hookEventName\": \"SessionStart\", \"additionalContext\": \"Current sprint: Sprint 23. Focus: User authentication\"}}'"
          }
        ]
      }
    ]
  }
}

</common_patterns>

<debugging>
Always test hooks with the debug flag:
```bash
claude --debug
```
Show full SKILL.md (290 more words)Show less

This shows which hooks matched, command execution, and output. See references/troubleshooting.md for common issues and solutions. </debugging>

<reference_guides> Hook types and events: references/hook-types.md

  • Complete list of hook events
  • When each event fires
  • Input/output schemas for each
  • Blocking vs non-blocking hooks

Command vs Prompt hooks: references/command-vs-prompt.md

  • Decision tree: which type to use
  • Command hook patterns and examples
  • Prompt hook patterns and examples
  • Performance considerations

Matchers and patterns: references/matchers.md

  • Regex patterns for tool matching
  • MCP tool matching patterns
  • Multiple tool matching
  • Debugging matcher issues

Input/Output schemas: references/input-output-schemas.md

  • Complete schema for each hook type
  • Field descriptions and types
  • Hook-specific output fields
  • Example JSON for each event

Working examples: references/examples.md

  • Desktop notifications
  • Command validation
  • Auto-formatting workflows
  • Logging and audit trails
  • Stop logic patterns
  • Session context injection

Troubleshooting: references/troubleshooting.md

  • Hooks not triggering
  • Command execution failures
  • Prompt hook issues
  • Permission problems
  • Timeout handling
  • Debug workflow </reference_guides>

<security_checklist> Critical safety requirements:

  • Infinite loop prevention: Check stop_hook_active flag in Stop hooks to prevent recursive triggering
  • Timeout configuration: Set reasonable timeouts (default: 60s) to prevent hanging
  • Permission validation: Ensure hook scripts have executable permissions (chmod +x)
  • Path safety: Use absolute paths with $CLAUDE_PROJECT_DIR to avoid path injection
  • JSON validation: Validate hook config with jq before use to catch syntax errors
  • Selective blocking: Be conservative with blocking hooks to avoid workflow disruption

Testing protocol:

bash
# Always test with debug flag first
claude --debug

# Validate JSON config
jq . .claude/hooks.json

</security_checklist>

<success_criteria> A working hook configuration has:

  • Valid JSON in .claude/hooks.json (validated with jq)
  • Appropriate hook event selected for the use case
  • Correct matcher pattern that matches target tools
  • Command or prompt that executes without errors
  • Proper output schema (decision/reason for blocking hooks)
  • Tested with --debug flag showing expected behavior
  • No infinite loops in Stop hooks (checks stop_hook_active flag)
  • Reasonable timeout set (especially for external commands)
  • Executable permissions on script files if using file paths </success_criteria>

© glittercowboy, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/create-hooks of glittercowboy/taches-cc-resources.

  • SKILL.md
  • references/command-vs-prompt.md
  • references/examples.md
  • references/hook-types.md
  • references/input-output-schemas.md
  • references/matchers.md
  • references/troubleshooting.md

Open the folder on GitHubat commit 1757615

Compare with similar skills

Create Hooks next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Create Hooks compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Create Hooks this skillglittercowboy/taches-cc-resources2k—~2.4kAutomated safety check: PassMIT
Hook Development for Claude Code Pluginsanthropics/claude-plugins-official38k11 repos~4.1kAutomated safety check: NotesApache-2.0
Claude Code Agent Developmentanthropics/claude-plugins-official38k8 repos~2.8kAutomated safety check: PassApache-2.0
Claude Code Skill Developer Guidediet103/claude-code-infrastructure-showcase10k11 repos~3.5kAutomated safety check: PassMIT
Plugin Settings Patternanthropics/claude-plugins-official38k7 repos~3kAutomated safety check: PassApache-2.0
MCP Integration for Pluginsanthropics/claude-plugins-official38k11 repos~3.1kAutomated safety check: PassApache-2.0

Similar skills

  • Hook Development for Claude Code Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.

    38k GitHub starsUsed in 11 repos~4.1k tokens
    Agent WorkflowsAuto-check: notes
  • Claude Code Agent Development

    anthropics/claude-plugins-official

    Official

    Explains how to write agents for Claude Code plugins: the markdown file with YAML frontmatter, trigger descriptions, model and color settings, and system prompt design.

    38k GitHub starsUsed in 8 repos~2.8k tokens
    Agent WorkflowsAuto-check passed
  • Claude Code Skill Developer Guide

    diet103/claude-code-infrastructure-showcase

    A guide to creating and managing Claude Code skills with auto-activation: skill-rules.json triggers, hooks, enforcement levels, YAML frontmatter and progressive disclosure.

    10k GitHub starsUsed in 11 repos~3.5k tokens
    Agent WorkflowsAuto-check passed
  • Plugin Settings Pattern

    anthropics/claude-plugins-official

    Official

    Shows how Claude Code plugins keep per-project settings and state in .claude/plugin-name.local.md files with YAML frontmatter and a markdown body.

    38k GitHub starsUsed in 7 repos~3k tokens
    Agent WorkflowsAuto-check passed
  • MCP Integration for Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to bundle Model Context Protocol servers in a Claude Code plugin, covering config files, stdio, SSE, HTTP and WebSocket server types, and authentication.

    38k GitHub starsUsed in 11 repos~3.1k tokens
    Agent WorkflowsAuto-check passed
  • Claude Code Command Development

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code slash commands: Markdown files with YAML frontmatter, arguments, file references, bash context and interactive prompts.

    38k GitHub starsUsed in 10 repos~4.8k tokens
    Agent WorkflowsAuto-check passed

More from glittercowboy/taches-cc-resources

All 12 skills in this repo
  • Create MCP Servers

    glittercowboy/taches-cc-resources

    Create Model Context Protocol (MCP) servers that expose tools, resources, and prompts to Claude.

    2k GitHub stars~1.5k tokensUpdated 6 mo ago
    Auto-check passed
  • The Pirate Bay

    glittercowboy/taches-cc-resources

    Search The Pirate Bay for torrents and extract magnet links via the apibay.org JSON API.

    2k GitHub stars~1.1k tokensUpdated 6 mo ago
    Auto-check passed
  • Create Meta Prompts

    glittercowboy/taches-cc-resources

    Create optimized prompts for Claude-to-Claude pipelines with research, planning, and execution stages.

    2k GitHub starsUsed in 1 repo~4.8k tokens
    Auto-check passed
  • Create Agent Skills

    glittercowboy/taches-cc-resources

    Expert guidance for creating, writing, building, and refining Claude Code Skills.

    2k GitHub stars~1.7k tokensUpdated 6 mo ago
    Auto-check passed
  • Create Plans

    glittercowboy/taches-cc-resources

    Create hierarchical project plans optimized for solo agentic development.

    2k GitHub starsUsed in 1 repo~4.4k tokens
    Auto-check: notes
  • Create Subagents

    glittercowboy/taches-cc-resources

    Expert guidance for creating, building, and using Claude Code subagents and the Task tool.

    2k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed

Categories

Questions about Create Hooks

What does Create Hooks do?

Expert guidance for creating, configuring, and using Claude Code hooks. Create Hooks is an agent skill from glittercowboy/taches-cc-resources. Expert guidance for creating, configuring, and using Claude Code hooks.

When should I use Create Hooks?

Create Hooks fits situations like: working with hooks; setting up event listeners; validating commands; automating workflows.

How do I install Create Hooks in Claude Code?

Run `npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a claude-code`. Or copy the skill folder (skills/create-hooks in glittercowboy/taches-cc-resources) into .claude/skills/create-hooks in your project. Claude Code loads it when a task matches its description.

How do I install Create Hooks in Codex?

Run `npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a codex`. Or copy the skill folder (skills/create-hooks in glittercowboy/taches-cc-resources) into .agents/skills/create-hooks in your project. Codex loads it when a task matches its description.

Can I use Create Hooks in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/create-hooks, .gemini/skills/create-hooks, .github/skills/create-hooks and .opencode/skills/create-hooks in your project.

What does Create Hooks need to run?

Going by SKILL.md and its folder, Create Hooks needs the command-line tools its instructions call (claude and jq).

Does Create Hooks access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Create Hooks safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Create Hooks use?

Create Hooks is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Create Hooks use?

About 2.4k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 14k tokens, read only when the agent opens those files.

What are the alternatives to Create Hooks?

Skills that share tags, products or a category with Create Hooks: Hook Development for Claude Code Plugins (anthropics/claude-plugins-official, 38k stars), Claude Code Agent Development (anthropics/claude-plugins-official, 38k stars), Claude Code Skill Developer Guide (diet103/claude-code-infrastructure-showcase, 10k stars) and Plugin Settings Pattern (anthropics/claude-plugins-official, 38k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Create Hooks?

glittercowboy (a GitHub user) maintains it in glittercowboy/taches-cc-resources, which has 1,980 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on April 1, 2026.

Source: glittercowboy/taches-cc-resources on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.