Create data/<type> only when writing first YAML; replace exception-based flow with existence checks and simplify template loading and main flow.