Code Room
Vibe codingMediumvc-g091
Subject Ai prompt iterationLevel Mid–Senior~18 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

You ask an AI to add caching to a TypeScript function that fetches a user's feature flags from an API. It wraps it in a module-level `Map` cache keyed by userId — fast, but now flags never update until redeploy, and in your serverless runtime each cold invocation has an empty cache so the hit rate is ~0 anyway. You re-prompt 'add cache expiry'; it adds a 1-hour TTL, which fixes staleness but not the cold-start miss or a thundering herd on expiry. How do you re-steer?

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.

Describe your solution

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.