Claude.Hooks.Hook.Behaviour behaviour (claude v0.1.0)
Behaviour for implementing Claude Code hooks.
Hooks must implement:
config/0
to return their hook configuration as a %Claude.Hooks.Hook{} structrun/2
to execute the hook logicdescription/0
to provide a human-readable description
Summary
Callbacks
Returns the hook configuration as a %Claude.Hook{} struct.
Returns a human-readable description of what this hook does.
Executes the hook logic.
Callbacks
@callback config() :: Claude.Hooks.Hook.t()
Returns the hook configuration as a %Claude.Hook{} struct.
This configuration will be automatically encoded to JSON and written to the settings.json file during installation.
@callback description() :: String.t()
Returns a human-readable description of what this hook does.
Executes the hook logic.
Parameters
event_type
- The type of event that triggered this hook (e.g., "Write", "Edit")file_path
- The path to the file being processed
Return values
:ok
- Hook executed successfully{:error, reason}
- Hook execution failed