# Hook Factory

Generate production-ready Claude Code hooks with interactive Q&A, automated...

- Repository: https://github.com/alirezarezvani/claude-code-skill-factory (897 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2025-11-12
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add alirezarezvani/claude-code-skill-factory --skill hook-factory -g -a claude-code -y`
Codex: `npx skills add alirezarezvani/claude-code-skill-factory --skill hook-factory -g -a codex -y`
Cursor: `npx skills add alirezarezvani/claude-code-skill-factory --skill hook-factory -g -a cursor -y`
Gemini CLI: `npx skills add alirezarezvani/claude-code-skill-factory --skill hook-factory -g -a gemini-cli -y`

## Description

Generate production-ready Claude Code hooks with interactive Q&A, automated installation, and enhanced validation. Supports 10 templates across 7 event types for comprehensive workflow automation.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Hook Factory v2.0

**Generate production-ready Claude Code hooks with interactive Q&A, automated installation, and enhanced validation.**

## What This Skill Does

Hook Factory v2.0 is a comprehensive hook generation system with three modes:

1. **Interactive Mode** (NEW!) - 7-question guided flow with smart defaults
2. **Natural Language** - Describe what you want in plain English
3. **Template Mode** - Direct generation from 10 production templates

**Key Features:**
- **Interactive Q&A** - 7 questions with validation and smart defaults
- **Automated Installation** - Python and Bash installers with backup/rollback
- **Enhanced Validation** - Secrets detection, event-specific rules, command validation
- **10 Templates** - Covering 7 event types (PostToolUse, SubagentStop, SessionStart, PreToolUse, UserPromptSubmit, Stop, PrePush)
- **Comprehensive Safety** - Tool detection, silent failure, atomic operations
- **macOS/Linux Support** - Production-ready for Unix environments

## When to Use This Skill

Use hook-factory when you want to:

- Auto-format code after editing
- Automatically stage files with git
- Run tests when agents complete
- Load project context at session start
- Create custom workflow automation
- Learn how hooks work through examples

## Capabilities

### Three Generation Modes

**1. Interactive Mode (Recommended)**
```bash
python3 hook_factory.py -i
```
- 7-question guided flow
- Smart defaults based on event type
- Input validation and safety warnings
- Optional auto-install

**2. Natural Language Mode**
```bash
python3 hook_factory.py -r "auto-format Python files after editing"
```
- Simple keyword matching
- Quick generation for common patterns

**3. Template Mode (Advanced)**
```bash
python3 hook_factory.py -t post_tool_use_format -l python
```
- Direct template selection
- Full customization control

### Supported Hook Templates (10 Total)

The rest: https://github.com/alirezarezvani/claude-code-skill-factory/blob/HEAD/generated-skills/hook-factory/SKILL.md
