Hook Development for Claude Code Plugins
anthropics/claude-plugins-official
Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.
Expert guidance for creating, configuring, and using Claude Code hooks.
$ npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install glittercowboy/taches-cc-resources create-hooks --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ 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-srcUse ~/.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/
Install the "create-hooks" agent skill from https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooks into .claude/skills/create-hooks/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "create-hooks", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooksType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install glittercowboy/taches-cc-resources create-hooks --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/glittercowboy/taches-cc-resources.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/create-hooks .agents/skills/create-hooks && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "create-hooks" agent skill from https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooks into .agents/skills/create-hooks/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "create-hooks", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install glittercowboy/taches-cc-resources create-hooks --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/glittercowboy/taches-cc-resources.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/create-hooks .cursor/skills/create-hooks && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "create-hooks" agent skill from https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooks into .cursor/skills/create-hooks/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "create-hooks", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/glittercowboy/taches-cc-resources.git --path skills/create-hooks--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install glittercowboy/taches-cc-resources create-hooks --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/glittercowboy/taches-cc-resources.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/create-hooks .gemini/skills/create-hooks && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "create-hooks" agent skill from https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooks into .gemini/skills/create-hooks/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "create-hooks", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install glittercowboy/taches-cc-resources create-hooksInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/glittercowboy/taches-cc-resources.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/create-hooks .github/skills/create-hooks && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "create-hooks" agent skill from https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooks into .github/skills/create-hooks/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "create-hooks", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add glittercowboy/taches-cc-resources --skill create-hooks -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install glittercowboy/taches-cc-resources create-hooks --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/glittercowboy/taches-cc-resources.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/create-hooks .opencode/skills/create-hooks && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "create-hooks" agent skill from https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-hooks into .opencode/skills/create-hooks/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "create-hooks", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
create-hooksExpert 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. 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.
5 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 1757615. It shows what the files ask for, not the result of running them.
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.
Shell commands in SKILL.md call:
claudejqFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
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.
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.
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.
The full file from glittercowboy/taches-cc-resources at commit 1757615, republished under its MIT licence (© glittercowboy). 726 words, ~2,357 tokens.
.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.<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>
.claude/hooks.json~/.claude/hooks.jsonclaude --debug</workflow>
<example>
**Log all bash commands**:
.claude/hooks.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:
PreToolUse) every Bash tool usecommand (not an LLM prompt)</example>
</quick_start>
<hook_types>
| Event | When it fires | Can block? |
|---|---|---|
| PreToolUse | Before tool execution | Yes |
| PostToolUse | After tool execution | No |
| UserPromptSubmit | User submits a prompt | Yes |
| Stop | Claude attempts to stop | Yes |
| SubagentStop | Subagent attempts to stop | Yes |
| SessionStart | Session begins | No |
| SessionEnd | Session ends | No |
| PreCompact | Before context compaction | Yes |
| Notification | Claude needs input | No |
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:
Input: JSON via stdin Output: JSON via stdout (optional)
{
"type": "command",
"command": "/path/to/script.sh",
"timeout": 30000
}</hook_type>
<hook_type name="prompt"> Type: LLM evaluates a prompt
Use when:
Input: Prompt with $ARGUMENTS placeholder
Output: JSON with decision and reason
{
"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:
{
"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
{
"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):
{
"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:
| Variable | Value |
|---|---|
$CLAUDE_PROJECT_DIR | Project root directory |
${CLAUDE_PLUGIN_ROOT} | Plugin directory (plugin hooks only) |
$ARGUMENTS | Hook input JSON (prompt hooks only) |
Example:
{
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/validate.sh"
}</environment_variables>
<common_patterns> Desktop notification when input needed:
{
"hooks": {
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "osascript -e 'display notification \"Claude needs input\" with title \"Claude Code\"'"
}
]
}
]
}
}Block destructive git commands:
{
"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:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "prettier --write $CLAUDE_PROJECT_DIR",
"timeout": 10000
}
]
}
]
}
}Add context at session start:
{
"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
```
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
Command vs Prompt hooks: references/command-vs-prompt.md
Matchers and patterns: references/matchers.md
Input/Output schemas: references/input-output-schemas.md
Working examples: references/examples.md
Troubleshooting: references/troubleshooting.md
<security_checklist> Critical safety requirements:
stop_hook_active flag in Stop hooks to prevent recursive triggeringchmod +x)$CLAUDE_PROJECT_DIR to avoid path injectionjq before use to catch syntax errorsTesting protocol:
# Always test with debug flag first
claude --debug
# Validate JSON config
jq . .claude/hooks.json</security_checklist>
<success_criteria> A working hook configuration has:
.claude/hooks.json (validated with jq)--debug flag showing expected behaviorstop_hook_active flag)© glittercowboy, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 6 other files (references) in skills/create-hooks of glittercowboy/taches-cc-resources.
Open the folder on GitHubat commit 1757615
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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Create Hooks this skillglittercowboy/taches-cc-resources | 2k | — | ~2.4k | Automated safety check: Pass | MIT | |
| Hook Development for Claude Code Pluginsanthropics/claude-plugins-official | 38k | 11 repos | ~4.1k | Automated safety check: Notes | Apache-2.0 | |
| Claude Code Agent Developmentanthropics/claude-plugins-official | 38k | 8 repos | ~2.8k | Automated safety check: Pass | Apache-2.0 | |
| Claude Code Skill Developer Guidediet103/claude-code-infrastructure-showcase | 10k | 11 repos | ~3.5k | Automated safety check: Pass | MIT | |
| Plugin Settings Patternanthropics/claude-plugins-official | 38k | 7 repos | ~3k | Automated safety check: Pass | Apache-2.0 | |
| MCP Integration for Pluginsanthropics/claude-plugins-official | 38k | 11 repos | ~3.1k | Automated safety check: Pass | Apache-2.0 |
anthropics/claude-plugins-official
Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.
anthropics/claude-plugins-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.
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.
anthropics/claude-plugins-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.
anthropics/claude-plugins-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.
anthropics/claude-plugins-official
Explains how to write Claude Code slash commands: Markdown files with YAML frontmatter, arguments, file references, bash context and interactive prompts.
glittercowboy/taches-cc-resources
Create Model Context Protocol (MCP) servers that expose tools, resources, and prompts to Claude.
glittercowboy/taches-cc-resources
Search The Pirate Bay for torrents and extract magnet links via the apibay.org JSON API.
glittercowboy/taches-cc-resources
Create optimized prompts for Claude-to-Claude pipelines with research, planning, and execution stages.
glittercowboy/taches-cc-resources
Expert guidance for creating, writing, building, and refining Claude Code Skills.
glittercowboy/taches-cc-resources
Create hierarchical project plans optimized for solo agentic development.
glittercowboy/taches-cc-resources
Expert guidance for creating, building, and using Claude Code subagents and the Task tool.
Categories
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.
Create Hooks fits situations like: working with hooks; setting up event listeners; validating commands; automating workflows.
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.
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.
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.
Going by SKILL.md and its folder, Create Hooks needs the command-line tools its instructions call (claude and jq).
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.
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.
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.
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.
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.
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.