Paginated API client spec
You're directing an AI agent to write a JavaScript client that pulls every record from a paginated REST API (cursor-based, rate-limited, occasionally returns 429 and 503) and writes them to a local file. Write the spec that gets a robust client the first time. What does a naive 'fetch all pages from this API' prompt get wrong?
Implement
plan_backoff_delays(status_codes: list[int], retry_after_seconds: list[int], base_delay_seconds: int, max_delay_seconds: int) → list[int]Examples
in
[[200,429,200,503,503],[0,0,0,0,0],1,60]out[1,1,2]in
[[429,429,429,429,429,429,429],[0,0,0,0,0,0,0],2,30]out[2,4,8,16,30,30,30]in
[[429,503,404,429],[5,0,0,0],1,60]out[5,2]What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
0:00 of about 12 min
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.