Code Room
Vibe codingMedium
Question
An AI assistant generated a docstring for this JavaScript function. Read the docstring against the code and identify where the docs describe intended-but-not-real behavior, plus how you'd catch this class of mismatch systematically.
/** * Charges a customer and returns the charge result. * @param {string} customerId * @param {number} amountCents - amount in cents; must be positive * @returns {Promise<{ok: true, chargeId: string}>} resolves on success; * throws PaymentError on a declined card. */async function chargeCustomer(customerId, amountCents) { const res = await gateway.charge(customerId, amountCents); if (res.status !== 'succeeded') { return { ok: false, reason: res.declineCode }; } return { ok: true, chargeId: res.id };}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.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.