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.
Why agent output always sounds sure card 5 of 6

A confident docstring over a silent bug

Read the code top to bottom. **BAD** is the agent's function, with its claim in the docstring. The **trace** under it follows one call: 25 items, page `-1`, `size=10`. Python reads negative indices from the end, so the slice lands on rows 5–14. You get real data for a page that doesn't exist, and no error. **BETTER** rejects page numbers and sizes below 1 with a `ValueError`, and its docstring states what happens past the end. Later cost of BAD: wrong rows shown, with no error anywhere.
// Python
# BAD
def page(items, n, size):
    """1-based page n. Handles all edge cases,
    including empty and out-of-range pages."""
    start = (n - 1) * size
    return items[start:start + size]

# Trace: 25 items, page(items, -1, 10)
# start = (-1 - 1) * 10 = -20
# index:    0..4      5..14     15..24
# from end: -25..-21  -20..-11  -10..-1
#                     ^^^^^^^^
#                     items[-20:-10]
# page -1 returns real rows 5-14, no error

# BETTER
def page(items, n, size):
    """1-based page n.
    Pages past the end return []."""
    if n < 1 or size < 1:
        raise ValueError("n, size must be >= 1")
    start = (n - 1) * size
    return items[start:start + size]
Terms on this card
the agent
The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
docstring
In Python, a string literal at the start of a function that documents what it does.
ValueError
Python's built-in exception for an argument of the right type but an invalid value.
later cost
The concrete damage a shortcut or error does after merge, such as a hidden bug or silently wrong data.
rejects
Said of a promise that ends with an error; awaiting a rejected promise throws that error at the await.
Learn this step by step on Bytewise
Lesson goal: Explain that the model generates fluent, plausible text, so its tone is the same whether it is right or wrong. Explain why its statements about itself ('tests pass', 'this handles all cases') are also generated text, not measurements. · the whole lesson