create-hooks_skill

This skill helps you create, configure, and debug Claude Code hooks to automate workflows, validate commands, and inject context.
  • Shell

1.2k

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill glittercowboy/taches-cc-resources --skill create-hooks

  • SKILL.md9.2 KB

Overview

This skill provides expert guidance for creating, configuring, and using Claude Code hooks. It explains hook types, matchers, command vs prompt hooks, and safety patterns so you can validate commands, automate workflows, inject context, and add notifications. Use it to implement project-specific automation without modifying core code.

How this skill works

Hooks are event-driven scripts or LLM prompts that run when Claude Code events fire (PreToolUse, PostToolUse, SessionStart, etc.). You configure hooks in a JSON file per project or user, specify matchers to target tools, and choose command or prompt hooks to execute shell commands or LLM evaluations. Blocking hooks return JSON decisions (approve/block) and can modify or stop actions; non-blocking hooks observe, log, or inject context. Test and debug with the claude --debug flag to see matches, execution, and outputs.

When to use it

  • Validate destructive commands before execution (PreToolUse)
  • Log or audit tool usage (PreToolUse or PostToolUse)
  • Inject project context at session start (SessionStart)
  • Auto-format or lint code after edits (PostToolUse)
  • Notify the user when input is required (Notification)
  • Prevent subagent or session stops with custom logic (Stop, SubagentStop)

Best practices

  • Keep hook JSON valid and versioned; validate with jq before enabling
  • Prefer command hooks for simple checks and prompt hooks for language reasoning
  • Set reasonable timeouts and mark scripts executable to avoid hangs
  • Use precise matcher regexes to limit scope and avoid unintended triggers
  • Be conservative with blocking hooks and include clear reason output for audits
  • Prevent recursive loops in Stop hooks by checking stop_hook_active flag

Example use cases

  • Log every Bash command to a project-level file for auditing
  • Block dangerous shell invocations like git push --force using a prompt hook
  • Auto-run prettier or formatters after write/edit tools in PostToolUse
  • Show desktop notification when Claude requests user input via Notification hook
  • Add sprint or release notes into session context at SessionStart

FAQ

Store per-project hooks in .claude/hooks.json or per-user in ~/.claude/hooks.json. Validate with jq before use.

When should I use a prompt hook instead of a command hook?

Use prompt hooks for complex language-based decisions or context-aware validations; use command hooks for simple checks, logging, or external tools.

How do blocking hooks signal approval or denial?

Blocking hooks return JSON on stdout with a decision field: {"decision":"approve"} or {"decision":"block","reason":"explanation"}.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational