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.
Happy-path code: the edge cases it skipped
card 1 of 6
Works on the sample, breaks at the edges
builds on: Why agents fill gaps with plausible guesses
You asked the agent for two helpers for a product page: the average star rating, and paging through reviews. It ran a quick check on five sample reviews, the output looked right, and the summary says done. Nothing it tried had zero reviews, a review missing its rating, or the first page (page 1) when pages are numbered from 1. Those inputs are exactly where this kind of code fails.
Terms on this card
- edges
- Unusual but valid inputs at the limits of what code accepts: empty, missing, zero or negative values, and first/last positions in a range.
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
Lesson goal: Probe agent code for the structural inputs it typically ignores: empty collections, None/null/nil and missing keys, zero and negative values, and off-by-one boundaries on ranges, slices and pagination. Predict which of these a given function will mishandle, and write the one test that would show it. ·
the whole lesson