Chat on WhatsApp

What is a Claude Code "hook" and how does it map to Magento events?

A Claude Code hook is a shell command run automatically at lifecycle moments — PreToolUse, PostToolUse, UserPromptSubmit, Stop — configured in .claude/settings.json or ~/.claude/settings.json. It is the same shape as a Magento event observer: a side-effect that fires on a named lifecycle moment without changing the caller's logic. Useful Magento examples: a PostToolUse hook that runs bin/magento setup:di:compile after every etc/di.xml edit, or a Stop hook that runs vendor/bin/phpcs on the changed files. Hooks are the bridge from “AI wrote code” to “AI shipped working code”.

Was this helpful?