@whyshouldaicareone AI disaster a day, and the fix

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

copy and paste
{
  "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

copy and paste
/hooks
Follow @whyshouldaicare

A new disaster and its fix every day. Comment the word under a reel to get its guide.