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 5 of 6
The same request, written to be finished
builds on: Why agents fill gaps with plausible guesses, What 'done' means for a change
**Goal:** GET /orders returns one page of orders, **because** the mobile app times out on large accounts.
**Constraints:** the body stays a JSON array. The next cursor goes in an `X-Next-Cursor` header. Newest first. Default 50, max 200. Use `paginate()` from `src/db/paging.ts`.
**Non-goals:** other endpoints, total counts, client code.
**Acceptance:** `npm test` is green. New tests: 120 orders read in pages of 50 come back in 3 pages, newest first, each order exactly once. With 250 orders, `size=1000` returns 200.
Terms on this card
- cursor
- A marker for where the last page ended, so the next request continues from there. Stable even when new rows are added.
- GET /orders
- An HTTP endpoint: a URL path plus method that a client calls to read data, here the list of orders.
- JSON
- A plain-text data format of objects {...}, arrays [...], strings and numbers, used by most web APIs.
- JSON array
- A JSON value written as a list in square brackets, e.g. [ {...}, {...} ], as opposed to an object in curly braces.
- header
- A named key-value line sent with an HTTP request or response, outside the body, e.g. X-Next-Cursor.
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