@chengyixu/claudehook
v1.0.1
Published
Generate Claude Code hook configurations from natural language descriptions
Maintainers
Readme
claudehook
Generate Claude Code hook configurations from natural language descriptions.
No more reading hook docs. Just describe what you want in plain English, and claudehook generates the correct JSON configuration.
Install
npm install -g claudehookUsage
# Run tests before every git commit
claudehook "before every git commit, run npm test"
# Format files automatically after editing
claudehook "format files with prettier after editing"
# Get a desktop notification when a session ends
claudehook "send a desktop notification when a session ends"
# Block dangerous commands
claudehook "prevent rm -rf commands from running"
# Load environment on session start
claudehook "load .env on session start"
# Apply directly to your project's settings
claudehook --apply "before every git commit, run npm test"Options
| Option | Alias | Description |
|--------|-------|-------------|
| --apply | -a | Write directly to .claude/settings.json |
| --output <file> | -o | Write to a specific file |
| --dry-run | -n | Show what would be added without writing |
| --list | -l | List all hook types |
| --info | -i | Show hook reference guide |
| --help | -h | Show help |
Supported Hook Types
| Hook Type | Description | Example Prompt | |-----------|-------------|----------------| | PreToolUse | Runs BEFORE a matched tool | "before every git commit, run npm test" | | PostToolUse | Runs AFTER a matched tool | "format files with prettier after editing" | | Notification | Runs on notification events | "alert me when idle" | | Stop | Runs when session stops | "save context when session ends" | | SessionStart | Runs when session starts | "load .env on session start" |
Examples
# Before npm install, check for vulnerabilities
claudehook "before npm install, run npm audit"
# After writing files, auto-format
claudehook "after editing files, run prettier --write ."
# On session end, log it
claudehook "when session ends, log to session.log"
# Notification on idle
claudehook "show desktop notification when idle"
# Block dangerous git operations
claudehook "prevent git push --force from running"License
MIT
