Claude Code · Hooks

Claude Code hook: auto format

Auto-format files after edits.

All topics / Claude Code prompts

Replace highlighted brackets, then copy.

Write a PostToolUse hook that runs [formatter] on [file pattern] after edits.
  • formatter - replace the bracketed field with your info
  • file pattern - replace the bracketed field with your info
  • Formatter command
  • File pattern
  • Hook config
  • Consider security implications of hooks.