Help us improve
Share bugs, ideas, or general feedback.
From majestic-tools
Creates and configures Claude Code hooks from a natural language description, setting up events, matchers, and shell commands for workflow automation, notifications, formatting, and behavior control.
npx claudepluginhub majesticlabs-dev/majestic-marketplace --plugin majestic-toolsHow this command is triggered — by the user, by Claude, or both
Slash command
/majestic-tools:new-hook [hook-description]meta/This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# New Hook Builder `/new-hook` Create and configure Claude Code hooks for automating workflows, notifications, formatting, and behavior control. ## Arguments - `[hook-description]` - Description of the hook you want to create ## Example Usage ## Hook Events Overview Claude Code provides these hook events: - **PreToolUse**: Runs before tool calls (can block them with exit codes) - **PostToolUse**: Runs after tool calls complete - **UserPromptSubmit**: Runs when user submits a prompt, before Claude processes it - **Notification**: Runs when Claude Code sends notifications - **Stop**:...
/create-hookCreates and configures Claude Code hooks for events like PreToolUse with matcher and command, including ESLint/Prettier templates. Outputs status and hook file path.
/create-hookScaffolds, debugs, validates, and analyzes Claude Code hooks with built-in templates and conflict detection.
/cc-hooksDesigns, creates, lists, tests, debugs, and manages Claude Code hooks; installs pre-built policy packs for security, formatting, and automation.
/helpDisplays Hookify plugin help: hook events, markdown config files with regex patterns, creation via /hookify or manual files, subcommands, and examples for safe behaviors.
/create-hookCreates a new custom automation hook for Claude Code events like SessionStart or PreToolUse. Prompts for name, trigger event, matcher, language (Python/Bash); generates script and registers it in hooks.json.
/create-hookCreates new hooks via structured workflow: Iron Law tests first, brainstorm, security design, scaffold, validate. Supports --skip-brainstorm, --plugin, --event flags.
Share bugs, ideas, or general feedback.
/new-hookCreate and configure Claude Code hooks for automating workflows, notifications, formatting, and behavior control.
[hook-description] - Description of the hook you want to create# Create a logging hook
/new-hook "log all bash commands to a file"
# Create a protection hook
/new-hook "prevent editing .env files"
# Create a formatting hook
/new-hook "auto-format TypeScript files after editing"
# Create a notification hook
/new-hook "send desktop notification when Claude needs input"
Claude Code provides these hook events:
For comprehensive information, refer to:
When creating hooks, follow these steps:
* for all tools)AskUserQuestion to ask: user settings (global) or project settings (local)?Tool Matchers:
Bash - Shell commands onlyEdit|MultiEdit|Write - File editing operationsRead - File reading operations* - All toolsExit Codes (PreToolUse only):
0 - Allow tool execution2 - Block tool execution with feedback⚠️ CRITICAL: Hooks run automatically with your environment's credentials. Always:
Hooks are stored in JSON format in ~/.claude/settings.json (user) or <project>/.claude/settings.json (project):
{
"hooks": {
"<EventType>": [
{
"matcher": "<tool-pattern>",
"hooks": [
{
"type": "command",
"command": "<shell-command>"
}
]
}
]
}
}
Command Logging (PreToolUse):
jq -r '"\(.tool_input.command) - \(.tool_input.description // "No description")"' >> ~/.claude/command-log.txt
Code Formatting (PostToolUse):
jq -r '.tool_input.file_path' | { read file_path; if echo "$file_path" | grep -q '\.ts$'; then npx prettier --write "$file_path"; fi; }
File Protection (PreToolUse):
python3 -c "import json, sys; data=json.load(sys.stdin); path=data.get('tool_input',{}).get('file_path',''); sys.exit(2 if any(p in path for p in ['.env', 'package-lock.json', '.git/']) else 0)"
Desktop Notifications (Notification):
notify-send 'Claude Code' 'Awaiting your input'
After creating a hook, provide:
Always explain the hook's purpose, when it triggers, and what it accomplishes.
/hooks slash command in Claude Code to configure hooks interactively~/.claude/settings.json or <project>/.claude/settings.json