/build-hook - Build Custom Claude Code Hooks banner
alirezarezvani alirezarezvani

/build-hook - Build Custom Claude Code Hooks

Productivity community intermediate

Description

**Interactive guide for creating custom hooks with Q&A workflow and automatic validation.** > **Note**: This command is also available as `/build hook` for consistency with other factories (skills, ag

Installation

Terminal
claude install-skill https://github.com/alirezarezvani/claude-code-skill-factory

README

/build-hook - Build Custom Claude Code Hooks

**Interactive guide for creating custom hooks with Q&A workflow and automatic validation.**

**Note**: This command is also available as `/build hook` for consistency with other factories (skills, agents, prompts). Both work identically - use whichever you prefer!

    undefined

Usage

/build-hook
/build-hook notification
/build-hook formatting
/build-hook testing
/build-hook git

What This Command Does

**Two Ways to Build Hooks**:

1. Agent-Guided (Recommended for Beginners)

**Without arguments** (`/build-hook`):

    undefined

**With argument** (`/build-hook [type]`):

    undefined

2. Direct CLI (Advanced Users)

**Interactive Mode**:

cd generated-skills/hook-factory
python3 hook_factory.py -i
    undefined

**Template Mode**:

python3 hook_factory.py -t post_tool_use_format -l python
    undefined

Examples

Build Any Hook (Interactive)

/build-hook

**Output**:

Welcome to the Claude Code Hooks Factory! 🔧

I'll help you build a custom hook through 5-7 straightforward questions.

Hooks are workflow automation that run when events occur:
- SessionStart: Load context when Claude starts
- PostToolUse: Auto-format code after editing
- SubagentStop: Run tests when agents complete
- And 4 more event types...

Let's get started!

Question 1: What should this hook do?
Examples:
- Auto-format Python files
- Run tests automatically
- Send notifications
- Auto-commit to git

Your answer: ___

Build Notification Hook (Suggested)

/build-hook notification

**Output**:

Great! Building a notification hook.

I'll ask you a few questions to customize it:

Question 1: When should notifications be sent?
1. When any agent completes (SubagentStop)
2. When specific agent completes (SubagentStop + filter)
3. After every file edit (PostToolUse)
4. At session start (SessionStart)

Your choice (1-4): ___

→ Continues with hooks-guide Q&A → Generates notification hook with macOS/Linux support


Build Auto-Format Hook (Suggested)

/build-hook formatting

**Output**:

Perfect! Building an auto-formatting hook.

Question 1: Which language should be formatted?
1. Python (black)
2. JavaScript/