Posts
-
Automating Away Claude's Bad Habits with Hooks
When AI agents like Claude Code write code, they often leave trailing whitespace for no reason. Tabs or spaces? Doesn’t matter. It’s bad.
Whyyyyy?
LLMs generate trailing whitespace because they produce text token by token without visual feedback. They ’learn’ from training data containing inconsistent whitespace patterns.
Telling Claude what to do isn’t enough
I used to have something like this in my
CLAUDE.md
:NEVER EVER leave trailing whitespace at the end of lines.
But as with many things added as context in
CLAUDE.md
, Claude Code can be very inconsistent about following them. Does that happpen as the context window fills up? I don’t know. I want something more deterministic here, though.