create-hooks

Create and manage JSON-based event-driven hooks for Claude Code.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/shishiv/shishiv-resources --skill create-hooks-shishiv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hooks
Source: https://github.com/shishiv/shishiv-resources/tree/main/skills/create-hooks
Command: npx skills add https://github.com/shishiv/shishiv-resources --skill create-hooks-shishiv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, and includes references (resource) components.

What problem does it solve?

Claude Code hooks automate repetitive tasks, enforce policies, and inject context without modifying core code. This Skill helps you leverage these powerful event-driven automations to streamline your workflow, ensure safety, and customize Claude's behavior, allowing you to focus on higher-value tasks.

Core Features & Use Cases

  • Event-Driven Automation: Execute shell commands or LLM prompts in response to specific events like tool use, session start/end, or user prompts.
  • Command Validation & Safety: Implement pre-execution checks to block destructive commands (e.g., rm -rf), validate user input, or ensure code quality (e.g., auto-format after edits).
  • Workflow Customization: Inject session-specific context, trigger desktop notifications for user input, or define custom completion criteria for Claude's operations.
  • Use Case: Automatically log all Bash commands executed by Claude to an audit file, or block git push --force to protect your main branch from accidental overwrites.

Quick Start

  1. Create a .claude/hooks.json file in your project.
  2. Add a PreToolUse hook with a Bash matcher.
  3. Configure a command hook to log jq -r '.tool_input.command' >> ~/.claude/bash-log.txt.
  4. Test with claude --debug.

Frequently Asked Questions about create-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate Claude Code to run commands or prompts on specific events?

Event-driven hooks execute shell commands or LLM prompts in response to events like PreToolUse, PostToolUse, SessionStart, or UserPromptSubmit. Define hooks in `.claude/hooks.json` with tool matchers and command or prompt types to trigger automations without modifying core code.

Can I block unsafe commands like `rm -rf` or `git push --force` before Claude executes them?

Yes. Use PreToolUse hooks with Bash tool matchers and validation logic to inspect commands before execution. Configure hooks to block destructive patterns, validate input, or inject safety checks that prevent risky operations from running.

What's the best way to log all commands Claude executes for audit purposes?

Create a PostToolUse hook with a Bash matcher and command hook that logs output to a file using `jq` to extract tool input. This automatically captures every command Claude runs without manual intervention.

How do I inject custom context or trigger notifications during Claude's workflow?

Hooks support both command and prompt types across session events. Use SessionStart or UserPromptSubmit hooks to inject context, trigger desktop notifications, or define custom completion criteria tailored to your workflow.

Do I need to restart Claude Code for hook changes to take effect?

Hook definitions in `.claude/hooks.json` are read at session start. Test with `claude --debug` to verify your hooks are loaded and firing on the correct events without requiring a full restart between edits.

What dependencies do I need to set up hooks for Claude Code?

Hooks require `jq` to parse and extract tool input from JSON events. The `.claude/hooks.json` file must be valid JSON; no additional frameworks or setup beyond a text editor and jq are required to get started.