Code Room
Vibe codingMedium
Question
An AI agent wrote this Node.js/Express code to verify a JWT before handling a request. It compiles, the import resolves, and a valid token passes. A teammate is about to merge it. What's wrong?
const jwt = require("jsonwebtoken"); function authMiddleware(req, res, next) { const token = req.headers.authorization?.split(" ")[1]; if (!token) return res.status(401).json({ error: "no token" }); try { const payload = jwt.decodeVerify(token, process.env.JWT_SECRET); req.user = payload; next(); } catch (e) { res.status(401).json({ error: "invalid token" }); }}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.