Code Room
Vibe codingMediumvc-g080
Subject Ai prompt iterationLevel Mid–Senior~14 minCommon in Algorithms & data structures interviewsIndustries Software development, IT services

Question

You ask an AI for a Bash script to 'rename all the log files to add a date prefix.' It writes a loop with `for f in $(ls *.log)` and `mv $f 2024-...-$f`. It runs fine on your test dir, so you point it at production logs and it mangles a dozen filenames containing spaces and a couple starting with `-`. You tell it 'handle spaces' and it wraps a few vars in quotes but the dash-prefixed files still break. How do you re-steer to get this robust?

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.