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.
Duplicating code instead of reusing it
card 1 of 6
A tiny new email check
builds on: What the agent cannot see
You asked the agent to add email validation to the signup endpoint. It came back fast, tests green. The diff adds `isValidEmail` inside `signup/handler.ts`. But `src/lib/validation.ts` already has `validateEmail`, used by login, invites and password reset. The transcript shows the agent never opened that file.
Is one small extra helper harmless?
Terms on this card
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
- the diff
- The change under review in unified diff format: '-' lines removed, '+' lines added, unprefixed lines unchanged context.
- transcript
- The record of an agent session: what it read, which commands it ran, what they returned and what it said.
- helper
- A small function that does one common job, such as formatting or checking a value, so other code can call it instead of repeating it.
- green
- A test or check passing. Red means failing.
Lesson goal: Spot a new helper, validator or client that duplicates one already in the codebase that the agent never opened. Explain the later cost when the copies diverge, and when merging the copies would instead create the wrong abstraction. ·
the whole lesson