creating-claude-hooks

Create and publish Claude Code hooks with PRPM packaging.

121|16|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/pr-pm/prpm --skill creating-claude-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: creating-claude-hooks
Source: https://github.com/pr-pm/prpm/tree/main/.claude/skills/creating-claude-hooks
Command: npx skills add https://github.com/pr-pm/prpm --skill creating-claude-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the confusion and errors when creating Claude Code hooks by providing comprehensive guidance on executable format, event handling, I/O conventions, and security requirements.

Core Features & Use Cases

  • Hook Development: Complete guidance on creating executable hooks for session-start, user-prompt-submit, tool-call, and assistant-response events.
  • Package Publishing: Step-by-step instructions for publishing hooks as PRPM packages with proper structure and metadata.
  • Use Case: Imagine you want to automatically format code whenever a file is saved. Use this Skill to create a tool-call hook that runs Prettier on modified files automatically.

Quick Start

Use the creating-claude-hooks skill to help me create a session-start hook that logs session information and checks for required dependencies.

Frequently Asked Questions about creating-claude-hooks

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

FAQPage Schema
How do I create a Claude Code hook that runs on specific events?

Claude Code hooks are executable scripts that trigger on session-start, user-prompt-submit, tool-call, and assistant-response events. Write hooks as executables with a proper shebang, accept JSON input via stdin, and output text to stdout with appropriate exit codes to signal success or failure.

What executable format and I/O conventions do Claude Code hooks require?

Hooks must be executable files with a shebang line (e.g., #!/bin/bash), receive JSON event data on stdin, write output to stdout, and return exit code 0 for success or non-zero for errors. This stdin/stdout pattern enables Claude Code to pass event context and capture hook results consistently.

How do I package and publish a Claude Code hook as a PRPM package?

Package hooks using PRPM format with proper directory structure and metadata. Include your hook executable, schema definitions for validation, and security configurations. PRPM packaging standardizes hook distribution, enables dependency resolution, and ensures hooks meet security and format requirements before publication.

What security and schema requirements apply to publishing Claude Code hooks?

Hooks must pass schema validation to ensure correct input/output structure and comply with security requirements specified in PRPM packaging. These requirements prevent malformed hooks from executing and protect the Claude Code environment from unvalidated or unsafe hook behavior.

Can I use Claude Code hooks to automate tasks on file modifications or user actions?

Yes. Hook events like tool-call and assistant-response let you trigger automation in response to Claude Code actions. For example, create a tool-call hook to run code formatters on modified files or an assistant-response hook to post-process outputs automatically.

Do I need prior automation experience to create and publish Claude Code hooks?

No prior automation experience is strictly required, but familiarity with shell scripting or executable development helps. The Skill covers hook format, event handling, and I/O conventions step-by-step, making it accessible for developers new to hook creation.