Cookbook: A framework for improving LLM generative abilities via programmatic data generating templates