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.
Overbuilt code: speculative abstraction and defensive clutter
card 2 of 6
Why the agent hedges with structure
builds on: Why agents fill gaps with plausible guesses
When it lacks information, the agent fills the gap with the typical pattern. Public code is full of interfaces, factories, option objects and guard clauses. The agent cannot see that only one caller exists. Nor can it see that your types, and the code that checks incoming data, already rule out `null`. So it hedges everywhere, and that looks careful.
**Later cost:** more code to read, test and keep in sync. Checks for impossible cases blur what each function promises, and the one check that matters gets lost among ten that don't.
Terms on this card
- later cost
- The concrete damage a shortcut does after merge, such as a hidden bug, corrupted data or extra maintenance.
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
- guard
- In Rust, the value returned by `lock()`. The mutex stays locked while the guard lives and unlocks when it is dropped.
- caller
- Any place in code that invokes a function or uses a name, sometimes called a call site.
Lesson goal: Spot code bigger than the task needs: interfaces, factories or config options with one user, generic frameworks for a single case, and redundant null checks and try/catch on paths that cannot fail. Explain the later cost: more code to maintain, contracts blurred by defensive checks, and real bugs hidden in noise. Name the simpler version. ·
the whole lesson