Code Room
Vibe codingMediumvc-g078
Subject Ai prompt iterationLevel Mid–Senior~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

You ask an AI agent to add a Rust function that parses a `Duration` from strings like `"1h30m"`, `"45s"`, `"2d"`. Its first attempt uses `chrono::Duration::from_str`, which doesn't exist; you tell it 'that API isn't real' and it pivots to `humantime::parse_duration` — but your crate can't add new dependencies, and `humantime` rejects `"2d"` plus the compound `"1h30m"` form anyway. You're three messages deep and still broken. How do you diagnose what's going wrong and re-steer it to get a working parser?

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.