Plugin for managing Claude Code hooks (PreToolUse and PostToolUse).
This plugin enables installation and management of hooks for Claude Code, which execute shell commands before or after tool usage.
claude-code
- PreToolUse: Executed before a tool is used
- PostToolUse: Executed after a tool is used
Hooks are defined in JSON format:
{
"hookType": "PreToolUse",
"tools": ["Edit", "Write"],
"command": "echo 'About to edit a file'",
"description": "Log before file edits"
}hookType(required): EitherPreToolUseorPostToolUsecommand(required): Shell command to executetools(optional): Array of tool names to apply this hook to (empty = all tools)description(optional): Human-readable description
- Global:
~/.claude/hooks/ - Project:
./.claude/hooks/
# Install a hook
caf install local:./path/to/hooks --type claude-code-hooks --agent claude-code
# List installed hooks
caf list --type claude-code-hooks
# Remove a hook
caf remove hook-name --type claude-code-hooks{
"hookType": "PreToolUse",
"tools": ["Bash"],
"command": "git diff --cached --name-only | grep -q . || exit 0",
"description": "Verify staged changes before git operations"
}{
"hookType": "PostToolUse",
"tools": ["Write", "Edit"],
"command": "trunk fmt ${FILE_PATH}",
"description": "Auto-format files after writing"
}