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.
What the agent cannot see
card 4 of 6
The export change, with two blind spots
builds on: What the agent sees: its context
The test file has 6 invoice rows, so the change looks fine. The tell is that `db.stream` became `fetch_all` plus an in-memory sort. The agent couldn't see the 30 million production rows. It also couldn't see that streaming was chosen after an earlier out-of-memory crash. **Later cost:** the nightly job gets killed for memory. BETTER: keep `stream` and put `ORDER BY created` in the SQL.
// Python
--- a/billing/export.py
+++ b/billing/export.py
def export_invoices(db, out):
q = "SELECT * FROM invoices"
- for row in db.stream(q):
+ rows = db.fetch_all(q)
+ rows.sort(key=lambda r: r["created"])
+ for row in rows:
out.write(to_csv(row))
Terms on this card
- tell
- An observable sign in a diff, transcript or summary that suggests a shortcut or an error.
- later cost
- The concrete damage a shortcut does after merge, such as a hidden bug, data corruption or extra maintenance.
- in-memory sort
- Loading all items into the program's memory, then sorting them there, instead of letting the database return them ordered.
- SQL
- Structured Query Language, the language used to query relational databases.
- ORDER BY
- SQL clause that makes the database return rows sorted, often using an index, without the client holding them all at once.
Lesson goal: Name what is usually missing from an agent's context: files it never opened, runtime and production behaviour, real data and its volumes, team decisions and the history of why the code looks the way it does, and the intent you never wrote down. Predict which mistakes follow from each gap. ·
the whole lesson