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 2 of 6

It can only reuse what it has seen

builds on: What the agent cannot see
The agent can reuse only what is in its context. A helper in a file it never opened does not exist for it, and nothing in the task made it search. Writing a fresh helper is quick and turns the tests green. The later cost comes when the copies diverge. A fix or rule change lands in one copy, not the other. The same input is then accepted in one place and rejected in another.
Terms on this card
the agent
The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
context
Everything in the model's input for the current step: your messages, instruction files, files it has read and tool outputs.
later cost
The concrete damage a shortcut does after merge, such as a hidden bug, silent data corruption or extra maintenance.
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.
Learn this step by step on Bytewise
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