Brakes: coding with AI agents · Part 6
Minus twelve dollars shouldn't compile
Money as a plain number takes anything: minus 1240, 19.999, NaN. So every function has to remember its own guard, and one forgets. Make money its own type, a branded Money with one door in, Money.cents(), that refuses negatives and fractions. Every guard inside dissolves, and when the agent writes Part 1's bug again, tsc stops it before it runs. The bug is caught before the first keystroke.
Comment below: Is money a number in your codebase?
Brakes: a series on the checks that let an AI coding agent go fast without shipping bugs. Every best practice shortens the time between writing a bug and finding it. Brakes are why race cars go fast. All code is real TypeScript on Node 24, typechecked and tested before it went on screen.




