Environment config with type coercion
You need a config loader for a Python service that reads settings from environment variables, applies defaults, coerces types (a port is an int, a feature flag is a bool, a timeout is a float), and fails loudly at startup if a required value is missing or malformed. You'll ask an AI agent to write it. Draft the prompt/spec with the constraints, edge cases, and acceptance criteria that make the agent get it right first try. What does a vague prompt ("parse my config from env") miss?
validate_env_config(env_lines: list[str], specs: list[str]) → list[str][["PORT=8080","DEBUG=false"],["PORT:int:required","DEBUG:bool:optional"]]out[][["PORT=abc"],["PORT:int:required","TIMEOUT:float:required"]]out["PORT is not a valid int (got 'abc')","TIMEOUT is required but is not set"][["FLAG=maybe"],["FLAG:bool:optional"]]out["FLAG is not a valid bool (got 'maybe')"]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.
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.