Code Room
Vibe codingMedium
Question
This Cloud Function (Python) queries Postgres on each HTTP request. The AI generated it and it works in local testing. Under traffic the database starts rejecting connections with 'too many clients already'. What's wrong and how do you fix it?
import psycopg2 def handler(request): conn = psycopg2.connect( host=DB_HOST, dbname=DB_NAME, user=DB_USER, password=DB_PASS, ) cur = conn.cursor() cur.execute("SELECT plan FROM users WHERE id = %s", (request.args['id'],)) row = cur.fetchone() return {"plan": row[0]}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.