5 Claude Code Hooks That Automate My Entire Workflow
Claude Code hooks are shell commands that fire at specific lifecycle events. They're configured in .claude/settings.json and run automatically — no manual intervention. I use 5 hooks across all my ...

Source: DEV Community
Claude Code hooks are shell commands that fire at specific lifecycle events. They're configured in .claude/settings.json and run automatically — no manual intervention. I use 5 hooks across all my projects. Here's each one with the exact config. 1. Auto-Format After Every File Write Every time Claude writes or edits a file, Prettier runs on it automatically. { "hooks": { "PostToolUse": [{ "matcher": "Write|Edit", "hooks": [{ "type": "command", "command": "jq -r '.tool_response.filePath // .tool_input.file_path' | { read -r f; prettier --write \"$f\"; } 2>/dev/null || true" }] }] } } Why: Claude's code formatting is inconsistent. Sometimes it uses 2 spaces, sometimes 4. Prettier fixes it instantly. The || true ensures the hook never blocks Claude if Prettier fails. 2. Inbox Check on Every Message Every time I send a message, Claude checks its message bus inbox for tasks from other agents. { "hooks": { "UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "~/.claude/bus/che