Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Silent fallbacks that hide bugs
card 6 of 6
A default must be the true answer
builds on: Errors swallowed by catch-all handlers
A fallback is right only when *missing* is expected and the default is the real answer for that case, like a count of 0. Otherwise it turns a loud failure into quietly wrong data. In that case, fail or propagate the error, and name what was missing.
Terms on this card
- propagate
- Pass an error up to the caller instead of handling it locally, so whoever can decide what to do sees it.
Lesson goal: Recognise defaults that turn a loud failure into quietly wrong data: `unwrap_or_default()`, `?? ""`, `getOrDefault`, `dict.get(k, 0)`, returning [] on a parse error. Decide when a default is genuinely correct and when the code should fail or propagate the error instead. ·
the whole lesson