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.
Triage a diff: where to look first
card 4 of 6
Read the file list before the code
builds on: Scope creep and unasked-for changes in a diff, Making a failing test pass by weakening it
Task: fix rounding in `total.py`. You expect that file, plus at most a new test for the rounding. git lists files alphabetically by path, so the real fix shows up fourth.
Check them in this order:
1. The test file: was an expected value edited?
2. `ci.yml` and `pyproject.toml`: why would a rounding fix touch these?
3. `session.py`: auth code with no link to invoices.
4. `total.py`, the real fix, last.
Five files and an auth change for a one-line task means this diff gets a deep review.
$ git diff --stat main
.github/workflows/ci.yml | 3 ++-
pyproject.toml | 2 +-
src/auth/session.py | 13 +++++++++----
src/invoice/total.py | 2 +-
tests/test_total.py | 6 +++---
Terms on this card
- diff
- The change under review, shown line by line: lines starting with '-' are removed, '+' are added, others are unchanged context.
- CI
- Continuous integration: an automated system that builds the code and runs checks such as tests on every push or pull request.
- pyproject.toml
- Python project config file: dependencies, build settings and often test and linter settings.
- auth
- Authentication and authorization: code that decides who a user is and what they may do.
- TOML
- A plain-text config file format of key = value lines, used e.g. by Cargo.toml and pyproject.toml.
Lesson goal: Review in risk order: reread the task, then check changed or deleted tests, config, CI and dependency files, error paths and security-sensitive code, and compare the diff's size to the task's size. Decide how deep to review based on the risk. ·
the whole lesson