Formatting that never drifts
Claude generates well formatted code, but it does not always match your project's exact Prettier configuration (tab width, trailing commas, quote style, print width). The Auto Format Hook closes that gap by running Prettier after every file change. You never need to ask Claude to "fix the formatting" because the hook handles it mechanically, every single time.
1
Claude writes or edits a file
The Write or Edit tool creates or modifies a file. The PostToolUse event fires as soon as the tool completes.
2
Prettier formats the file
The hook runs <code>prettier --write</code> on the changed file, applying your project's .prettierrc configuration automatically.
3
Claude sees the formatted result
On subsequent reads, Claude works with the properly formatted version. This prevents formatting drift from accumulating across multiple edits.