Make Claude Code format every file, always
Instructions are suggestions. A hook runs every time, whether Claude remembers or not.
Add to .claude/settings.json
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"hooks": [{ "type": "command", "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write" }]
}]
}
}Other hooks worth having
Run the linter after edits, run tests before a commit, block edits to .env files with a PreToolUse hook that exits 2.
Check it
/hooksA new disaster and its fix every day. Comment the word under a reel to get its guide.