hook.define

Create and register automatic validation hooks for Claude Code projects.

2|Updated Oct 22, 2025
One-click install
npx skills add https://github.com/epieczko/betty --skill hook-define
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hook.define
Source: https://github.com/epieczko/betty/tree/main/skills/hook.define
Command: npx skills add https://github.com/epieczko/betty --skill hook-define

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires yaml.

What problem does it solve?

Create and register validation hooks for Claude Code to automate safety rails, ensuring validation runs automatically on relevant events like file edits, commits, and pushes.

Core Features & Use Cases

  • Create and configure .claude/hooks.yaml
  • Load existing hooks and merge updates without duplicates
  • Save updated hooks configuration back to disk
  • Examples include on_file_edit validating OpenAPI specs or on_commit checking for breaking changes

Quick Start

python skills/hook.define/hook_define.py <event> <command> [options] Example: on_file_edit "python betty/skills/api.validate/api_validate.py {file_path} zalando"
--pattern="*.openapi.yaml" --blocking=true --timeout=10000 --description="Validate OpenAPI specs"

Frequently Asked Questions about hook.define

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

FAQPage Schema
How do I automate validation hooks in Claude Code projects?

Validation hooks automate safety checks on Claude Code events like file edits, commits, and pushes. Use hook.define to create and register hooks in .claude/hooks.yaml, specifying the event, command, and optional pattern, blocking behavior, timeout, and description to run validation automatically.

What events can trigger validation hooks in Claude Code?

Hook.define supports on_file_edit, on_commit, on_push, on_file_save, on_tool_use, on_agent_start, and on_workflow_end events. Each event fires validation commands automatically—for example, on_file_edit can validate OpenAPI specs, while on_commit can check for breaking changes.

Can I update existing hooks without duplicating them?

Yes. Hook.define loads existing .claude/hooks.yaml, deduplicates hooks by name when merging updates, and writes the consolidated configuration back to disk, preventing duplicate hook registrations across multiple runs.

Do I need to write YAML manually to set up validation hooks?

No. Hook.define generates and manages .claude/hooks.yaml programmatically. Provide the event, command, and optional parameters (pattern, blocking, timeout, description) to the skill; it handles YAML creation and updates automatically.

What's the difference between blocking and non-blocking hooks?

Blocking hooks halt the triggering action if validation fails, enforcing compliance before proceeding. Non-blocking hooks run validation but allow the action to continue. Set blocking=true in hook.define to enforce strict validation gates.

Can validation hooks apply only to specific files?

Yes. Use the --pattern option in hook.define to scope hooks to matching file paths—for example, --pattern="*.openapi.yaml" restricts an OpenAPI validation hook to only YAML files matching that pattern.