Code RoomCursor pagination at scale
MediumPrep Room Coding #4351

Cursor pagination at scale

Vibe & agenticNetworking & APIsMid–Senior~18 min

You're building a paginated list endpoint in Go that serves rows from Postgres ordered by `created_at`. You want an AI agent to write the pagination utility — encoding/decoding a cursor and producing the `WHERE` clause and `LIMIT`. Write the prompt/spec, with constraints, edge cases, and acceptance criteria, that gets it correct first try. Explain what a casual prompt ("add pagination with offset and limit") would get wrong at scale.

Implement
keyset_page(rows: list[str], after_cursor: str, page_size: int) → list[str]
Examples
in[["2026-01-05T09:00|r1","2026-01-05T10:00|r2","2026-01-06T08:00|r3"],"",2]out["r1","r2","2026-01-05T10:00|r2"]
in[["2026-01-05T09:00|r2","2026-01-05T09:00|r1","2026-01-06T08:00|r3"],"2026-01-05T09:00|r1",2]out["r2","r3",""]
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 18 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.