Hook Command Has Field
Hook handlers with "type": "command" MUST include a "command" field containing the shell command to execute. Without it, Claude Code has no command to run and the hook fails silently.
Antipatterns
- Command handler without command field. Defining
"type": "command"with a"matcher"or"prompt"field but forgetting the"command"field. Claude Code has nothing to execute. - Wrong field name. Using
"cmd","script", or"exec"instead of"command". Only the exact key"command"is recognized. - Empty command string. Setting
"command": ""— technically present but produces no useful execution.
Pass / Fail
Pass
{
"hooks": {
"PreToolUse": [
{ "type": "command", "command": "/bin/bash .claude/hooks/lint.sh" }
]
}
}
Fail
{
"hooks": {
"PreToolUse": [
{ "type": "command", "matcher": "Edit" }
]
}
}
Limitations
Checks that at least one "command" field exists in the settings file. Does not verify the command is a valid executable or that it pairs correctly with a "type": "command" handler.
