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.
Pin behavior before a refactor
card 1 of 6
Six new tests, all green, after a rewrite
builds on: Refactors that quietly change behavior, What makes a test able to fail
You ask the agent to clean up `parse_tags`, a messy legacy function. It returns a tidy version plus six new tests, all green, and says behaviour is unchanged. The agent wrote those tests *after* the rewrite, by reading the rewrite. If the cleanup had changed what callers get back, would any of those tests go red?
Terms on this card
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
- red
- A test or check that is failing. Green means passing.
- green
- A test or check that passes.
Lesson goal: Write characterization tests that capture what existing code currently does before letting an agent refactor it. Use them to catch unintended behaviour changes that the agent's own new tests would miss. ·
the whole lesson