Skip to content

Visual Hook Composer

Hooks let you run custom commands when Claude Code performs specific actions. Fig’s Visual Hook Composer lets you create and edit hooks without writing JSON by hand.

Hooks are event handlers that trigger shell commands at specific points during a Claude Code session. They’re useful for:

  • Running linters or formatters after code changes
  • Logging tool usage for auditing
  • Enforcing project-specific rules
  • Triggering notifications or integrations

Hooks are keyed by event name. Common event types include:

EventWhen It Fires
PreToolUseBefore Claude Code uses a tool
PostToolUseAfter Claude Code uses a tool
NotificationWhen Claude Code sends a notification
StopWhen Claude Code finishes a session

Each event can have multiple hook groups. A hook group defines:

  • Matcher — an optional pattern that filters when the hook fires (e.g., only for specific tools or file patterns)
  • Commands — the shell commands to execute when the hook triggers
  1. Navigate to the Hooks tab in a project’s detail view
  2. Select the event type you want to hook into
  3. Add a new hook group
  4. Optionally set a matcher pattern to narrow when it fires
  5. Add one or more commands to execute

Matchers filter hook execution based on the event context. For example, a PreToolUse hook with a matcher of Write will only fire before write operations.

Hooks are stored in the hooks field of settings files:

{
"hooks": {
"PreToolUse": [
{
"matcher": "Write",
"commands": ["echo 'About to write a file'"]
}
]
}
}

Hooks from all configuration tiers concatenate — hooks defined at every level will run together.