Agent skill · software engineering · aiskillstore

creating-hooks

Creates Claude Code hooks for automation and workflow customization. Guides through hook events, configuration, and script creation. Use when user wants to create a hook, automate Claude Code, or asks about hook events.

Why this skill is useful

Adds detailed scripts and configuration patterns for creating Claude Code hooks that automate workflows, which the AI wouldn't generate on its own.

What it needs

Requires jq installed locally. About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Creating Hooks Guides creation of Claude Code hooks for automation and workflow customization. Quick Start 1. Choose hook event (when should it trigger?) 2. Configure in settings.json 3. Create hook script 4. Test the hook Workflow: Create New Hook Step 1: Select Hook Event Event When It Triggers Common Use ------- ------------------ ------------ PreToolUse Before tool runs Block/modify tools PostToolUse After tool succeeds Validate, log, feedback UserPromptSubmit User sends message Inject context, validate SessionStart Session begins Load context, init state SessionEnd Session ends Cleanup, save state Stop Agent finishes Decide if should continue Full event reference: reference.md Step 2: Configure settings.json Location priority (highest wins): 1. .claude/settings.local.json (local, not committed) 2. .claude/settings.json (project) 3. ~/.claude/settings.json (user) Basic structure: Step 3: Create Hook Script Use templates from templates/ directory. Key requirements: Read JSON from stdin Use exit codes for control (0=success, 2=block) Output JSON for decisions Step 4: Test Run hook manually with test input: Hook Configuration Matcher Patterns Matchers apply to: PreToolUse, PostToolUse, PermissionRequest Timeout Default: 60 seconds. Max recommended: 300 seconds. Exit Codes Code Meaning Behavior ------ --------- ---------- 0 Success Continue normally 2 Block Stop action, show error Other Non-blocking error Log only (verbose mode) JSON Output Return JSON to stdout for decisions: Decision values by event: PreToolUse: allow, deny, ask PostToolUse: block (with reason) UserPromptSubmit: block (with reason) Stop: block (requires reason) Security Best Practices 1. Quote all variables: "$VAR" not $VAR 2. Use absolute paths: "$CLAUDEPROJECTDIR/..." 3. Validate inputs: Check before processing 4. Block path traversal: Reject paths with .. 5. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/creating-hooks

View the source on GitHub

Browse the @skills marketplace