creating-hooks

Create Markdown rules with YAML frontmatter to block or warn on Claude Code events.

11|1|Updated Aug 6, 2025
One-click install
npx skills add https://github.com/thkt/claude-config --skill creating-hooks-thkt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: creating-hooks
Source: https://github.com/thkt/claude-config/tree/main/ja/skills/creating-hooks
Command: npx skills add https://github.com/thkt/claude-config --skill creating-hooks-thkt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Claude Codeの有害動作を防ぐためのカスタムフックを作成します。

Core Features & Use Cases

  • ルール作成の雛形(YAML frontmatterベース)
  • file/bash/stop/promptイベントに対するpattern設定
  • block/warnの実行アクション

Quick Start

/hookify [description] で新しいルールを作成します。

Frequently Asked Questions about creating-hooks

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

FAQPage Schema
How do I block dangerous file operations in Claude Code?

Block dangerous file edits by creating rules with the /hookify command. Define file patterns using regex or text matching operators, set the action to block or warn, and Claude Code will prevent or alert on matching operations before they execute.

What's the format for creating custom hook rules?

Hook rules use Markdown with YAML frontmatter. Specify the event type (file, bash, stop, or prompt), pattern operators (regex_match, contains, equals, starts_with, ends_with), and action (block or warn) to control how Claude Code handles detected operations.

Can I use hooks to prevent bash commands from running?

Yes. Hook rules support bash events alongside file operations. Use pattern matching on command text to block or warn on specific bash commands, enabling enforcement of coding standards and prevention of unwanted shell execution.

How do I create rules that only warn instead of blocking?

Set the action field to warn in your hook rule instead of block. Warn actions alert you when a pattern matches without stopping the operation, allowing review of risky behaviors while maintaining workflow flexibility.

What event types can hook rules monitor?

Hook rules monitor file edits, bash commands, stop events, prompts, and all events combined. This scope lets you enforce standards across file modifications, shell commands, workflow interruptions, and user input simultaneously.

Do I need coding experience to set up hooks?

Basic familiarity with regex and YAML syntax helps, but /hookify provides templates and guided rule creation. The Markdown format with pattern operators is designed for incremental learning as you define more complex rules.