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

Remember

builds on: What the agent cannot see
When the agent adds a helper, search for one that already exists. It reuses only what it opened. Copies of the *same* rule drift apart and give inconsistent behaviour later. Code that only *looks* alike but follows *different* rules should stay separate.
Terms on this card
the agent
The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
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.
drift
The agent gradually breaking rules it followed early in a session, because those rules got weaker attention or were lost as context filled.
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