create-hooks

Automate hook creation and validation for Claude Code event-driven workflows.

Updated Apr 2, 2025
One-click install
npx skills add https://github.com/Eric-Ness/NewsAnalysisBSkyPoster --skill create-hooks-eric-ness
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-hooks
Source: https://github.com/Eric-Ness/NewsAnalysisBSkyPoster/tree/main/.claude/skills/create-hooks
Command: npx skills add https://github.com/Eric-Ness/NewsAnalysisBSkyPoster --skill create-hooks-eric-ness

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill empowers you to programmatically control Claude's behavior, automating tasks, enforcing standards, and customizing workflows without altering core code. It eliminates manual intervention for repetitive checks, notifications, and context injections, saving you time and reducing complexity in your development process.

Core Features & Use Cases

  • Event-Driven Automation: Execute shell commands or LLM prompts in response to various Claude Code events like tool usage (PreToolUse, PostToolUse), session lifecycle (SessionStart, SessionEnd), or user interactions (UserPromptSubmit).
  • Workflow Customization & Safety: Implement custom validation logic (e.g., blocking destructive git commands), automate code formatting after edits, inject project-specific context at session start, or trigger desktop notifications when Claude needs input.
  • Flexible Hook Types: Choose between command hooks for deterministic tasks (logging, external tool execution) and prompt hooks for complex, context-aware decision-making using an LLM.

Quick Start

"I need to create a hook that logs every bash command Claude executes to a file. Show me how to set it up."

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 behavior with event-driven hooks?

Event-driven hooks automate Claude's behavior by executing shell commands or LLM prompts in response to specific events like tool usage, session lifecycle, or user interactions. Configure JSON-based hooks with matcher patterns and choose between command hooks for deterministic tasks or prompt hooks for context-aware decisions.

Can I block destructive commands like git operations in Claude Code?

Yes, you can implement custom validation logic through hooks that intercept PreToolUse events. Create command or prompt hooks with matcher patterns to block or flag specific git commands before execution, enforcing safety standards without modifying core code.

What hook types does Claude Code support for automation?

Claude Code supports two hook types: command hooks for deterministic shell command execution and logging, and prompt hooks for complex decision-making using an LLM. Both apply across PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, and related lifecycle events.

How do I set up logging for every command Claude executes?

Create a command hook triggered on PreToolUse events with a matcher pattern targeting bash commands. Configure it to execute a shell command that appends command details to a log file, automating audit trails without manual intervention.

Can I inject project-specific context when Claude Code starts?

Yes, use prompt hooks triggered on SessionStart events to inject project context automatically. Prompt hooks use LLM reasoning to understand your project structure and inject relevant information at session initialization, eliminating manual context setup.

What validation and safety checks are built into hook configuration?

Hook configuration includes JSON schema validation for input/output schemas, matcher pattern validation, and safety checks for command and prompt hook types. Built-in debugging and documentation workflows help identify configuration errors before hooks execute.