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.
Text, time and money: classic data traps
card 6 of 6
Ask three questions of every diff
builds on: Why agents fill gaps with plausible guesses
Typical code goes wrong on real text, time and money, and green tests on tidy fixtures won't show it. In every diff, ask three things. What does this length count? Which zone is this time in? What type holds this money? The safe answers are graphemes (or bytes, on purpose), zone-aware instants with calendar math, and `Decimal`/`BigDecimal` or integer cents.
Terms on this card
- fixtures
- Fixed sample data that tests run against.
- green
- A test or check that passes. Red means it fails.
- diff
- The change under review in unified format: '-' lines are removed, '+' lines are added, and unprefixed lines are context.
- graphemes
- What a reader sees as one character. It can be several code points, such as a flag or an emoji with a skin tone.
- instants
- Exact points on the global timeline, independent of any zone. Examples: Java Instant or a UTC timestamp.
Lesson goal: Spot agent code that is wrong for real-world data: string length, slicing or case-folding that breaks on non-ASCII text, naive datetimes and DST or time-zone shifts, and floating-point arithmetic for money. Name the safe type or library in each language (for example Decimal or BigDecimal, integer cents, zone-aware datetimes). ·
the whole lesson