Every file Claude edits comes out formatted.
A single PostToolUse hook that formats files the moment Claude Code writes them, using whatever formatter your project already has. No approval prompts, no diff noise from inconsistent style, and if a formatter is not installed it silently does nothing.
black or ruff for Python, prettier for JS, TS, JSON, CSS, Markdown and YAML, gofmt for Go.
Prefers the project-local prettier over the global one, so per-repo configs win.
No formatter on PATH means a clean no-op. Safe to drop onto any machine and into any repo.
Runs after every Write and Edit, adds no prompts and no latency you will notice.
Merges into settings.json preserving your hooks; re-running replaces instead of duplicating.
A single shell script you can read in a minute lives in ~/.claude/hooks/.
git clone https://github.com/jay739/claude-autoformat
cd claude-autoformat
./install.sh