Claude Code hookStable

claude-autoformat.

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.

Features

Formatter-aware

black or ruff for Python, prettier for JS, TS, JSON, CSS, Markdown and YAML, gofmt for Go.

Respects your config

Prefers the project-local prettier over the global one, so per-repo configs win.

Never installs anything

No formatter on PATH means a clean no-op. Safe to drop onto any machine and into any repo.

Invisible

Runs after every Write and Edit, adds no prompts and no latency you will notice.

Idempotent installer

Merges into settings.json preserving your hooks; re-running replaces instead of duplicating.

One small script

A single shell script you can read in a minute lives in ~/.claude/hooks/.

Quickstart

git clone https://github.com/jay739/claude-autoformat
cd claude-autoformat
./install.sh