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.
Write a task the agent can finish card 4 of 6

The diff: four guesses in seven lines

builds on: Why agents fill gaps with plausible guesses, What 'done' means for a change
Each `+` line settles something you never decided. It uses page numbers with offsets, the most common pattern. The default is 20 with no upper bound, so `?size=1000000` loads everything again. No sort order is given, and offsets shift when new orders arrive, so rows can move between pages. That explains the duplicates. `res.json({ items: rows, page, size })` replaced a bare array and broke every existing client. From the agent's view none of this was wrong, because your request never ruled it out.
// TypeScript
--- a/src/routes/orders.ts
+++ b/src/routes/orders.ts
 router.get("/orders", async (req, res) => {
-  const rows = await db.orders.all();
-  res.json(rows);
+  const page = Number(req.query.page) || 1;
+  const size = Number(req.query.size) || 20;
+  const rows = await db.orders.list({
+    offset: (page - 1) * size,
+    limit: size,
+  });
+  res.json({ items: rows, page, size });
 });
Terms on this card
offsets
Paging by skipping a number of rows (offset) and taking the next N. Results shift if rows are added or the order is not fixed.
JSON
A plain-text data format of objects {...}, arrays [...], strings and numbers, used by most web APIs.
res.json
The call in the route handler that sends a value to the client as the JSON response body.
the diff
The change under review in unified diff format: '-' lines removed, '+' lines added, unprefixed lines are context.
the agent
The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
Learn this step by step on Bytewise
Lesson goal: Write tasks that state the goal and the reason for it, the constraints, the non-goals and checkable acceptance criteria. Point out which ambiguities in a vague request would force the agent to guess. · the whole lesson