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”.

Kishan Savaliya
Kishan Savaliya
Adobe Certified Magento Commerce Developer
Ahmedabad [IN]working hours, replies within four hours
When do you need it

Read personally. Never shared. Or email the brief.

More on claude, glossary

Need it fixed, not just explained?

Send the brief with your store URL; the written quote comes back within 24 hours.