1 min lesson
Driving AI well: a draft you'd then read line-by-line and harden
Talk through the example in "Driving AI well: a draft you'd then read line-by-line and harden", then name the result it is meant to produce.
Step 1 of 2
Driving AI well: a draft you'd then read line-by-line and hardents
// AI gave me this stream handler. Before I trust it, I'm checking: // - partial multi-byte chunks across reads? // - what happens if the stream errors mid-message? // - do I flush the buffer on close? async function readStream(res: Response, onToken: (t: string) => void) { const reader = res.body!.getReader(); const decoder = new TextDecoder(); let buf = ""; for (;;) { const { value, done } = await reader.read(); if (done) break; buf += decoder.decode(value, { stream: true }); // TODO verify: parse complete SSE events from buf, keep remainder for (const evt of takeCompleteEvents(buf)) onToken(evt); } }
Interview move
Treat the AI like a fast junior engineer whose work you own. Generate aggressively, then review like a senior: ‘this is close, but it drops the trailing buffer on close - let me fix that.’ Owning and correcting AI output is exactly the behavior the paid onsite scales up.