hook-factory
БесплатноЗапускает вложенные скриптыНе проверенGenerate production-ready Claude Code hooks with interactive Q&A, automated installation, and enhanced validation. Supports 10 templates across 7 event types…
Об этом скилле
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:
- Interactive Mode (NEW!) - 7-question guided flow with smart defaults
- Natural Language - Describe what you want in plain English
- 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)
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
python3 hook_factory.py -r "auto-format Python files after editing"
- Simple keyword matching
- Quick generation for common patterns
3. Template Mode (Advanced)
python3 hook_factory.py -t post_tool_use_format -l python
- Direct template selection
- Full customization control
Supported Hook Templates (10 Total)
Formatting & Code Quality:
- post_tool_use_format - Auto-format after editing (Python, JS, TS, Rust, Go)
- post_tool_use_git_add - Auto-stage files with git
Testing & Validation: 3. subagent_stop_test_runner - Run tests when agent completes 4. pre_tool_use_validation - Validate before tool execution 5. pre_push_validation - Check before git push
Session Management: 6. session_start_load_context - Load context at session start 7. stop_session_cleanup - Cleanup at session end
User Interaction: 8. user_prompt_submit_preprocessor - Pre-process user prompts 9. notify_user_desktop - Desktop notifications (macOS/Linux)
Security: 10. security_scan_code - Security scanning with semgrep/bandit
Languages Supported
- Python (black formatter, pytest)
- JavaScript (prettier, jest)
- TypeScript (prettier, jest)
- Rust (rustfmt, cargo test)
- Go (gofmt, go test)
Enhanced Validation (v2.0)
4-Layer Validation System:
- Structure Validation - JSON syntax, required fields, types
- Safety Validation - No destructive ops, tool detection, silent failure
- Matcher Validation - Valid glob patterns, tool names, file paths
- Event-Specific Validation - Rules per event type (PreToolUse, SessionStart, etc.)
NEW in v2.0:
- ✅ Secrets Detection - AWS keys, JWT tokens, API keys, private keys (20+ patterns)
- ✅ Event-Specific Rules - PreToolUse must have tool matcher, SessionStart read-only, etc.
- ✅ Command Validation - Bash syntax, Unix commands, path validation, dangerous operations
- ✅ macOS/Linux Validation - Platform-specific command checks
Safety Features
Every generated hook includes:
- ✅ Tool detection (checks if required tools are installed)
- ✅ Silent failure mode (never interrupts your workflow)
- ✅ Appropriate timeout settings (5s-120s based on event type)
- ✅ No destructive operations
- ✅ Comprehensive validation before generation
- ✅ Clear documentation and troubleshooting guides
- ✅ Automatic backup during installation
How to Invoke
Natural Language Requests
Simply describe what you want the hook to do:
"I want to auto-format Python files after editing"
"Create a hook that runs tests when agents complete"
"Auto-add files to git after editing"
"Load my TODO.md at session start"
Explicit Template Selection
If you know which template you want:
"Generate a hook using the post_tool_use_format template for JavaScript"
"Create a test runner hook for Rust"
List Available Templates
"Show me all available hook templates"
"List hook templates"
Example Interactions
Example 1: Auto-Format Python
You: "I need a hook to auto-format my Python code after editing"
Hook Factory:
- Detects template:
post_tool_use_format - Detects language: Python
- Generates hook with black formatter
- Validates configuration
- Saves to
generated-hooks/auto-format-code-after-editing-python/ - Creates
hook.jsonandREADME.md
Example 2: Git Auto-Add
You: "Automatically stage files with git
Установить hook-factory в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл hook-factory?
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.
Как установить скилл hook-factory?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл hook-factory запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic