Advent of AI - Day 10: Understanding Arguments in Goose Recipes
Source: Dev.to
I’ve edited this post with AI assistance. These quick posts are part of the Advent of AI series, and Day 10 focuses on how recipe arguments and Jinja templating turn static prompts into reusable AI workflows.
What is Goose?
Goose is an open‑source, on‑machine AI agent that automates engineering tasks. It can generate code, build projects, debug failures, orchestrate workflows, and interact with external APIs. Goose works with any LLM, supports multi‑model configurations, integrates with MCP servers, and is available as both a desktop app and a CLI.
Festival Poster Generator Recipe
The Day 10 challenge asks you to generate festival posters for different event types (food, kids, performance, etc.). By defining parameters and using conditional logic, a single recipe can handle all variations.
# version: 1.0.0
title: Festival Poster Generator
description: Generate themed HTML posters with conditional styling
parameters:
- key: event_name
input_type: string
requirement: required
description: Name of the festival event
- key: event_type
input_type: select
requirement: required
description: Type of event – determines theme and styling
options:
- food
- kids
- performance
- competition
- workshop
- key: tagline
input_type: string
requirement: optional
description: Optional tagline or subtitle
default: ""
Required parameters (e.g., event_name, event_type) must be provided; the recipe will not run without them. Optional parameters like tagline default to an empty string, allowing the Jinja logic to skip sections when they’re absent.
Using Jinja2 for Conditional Styling
The instructions field supports Jinja2 templating, enabling you to tailor the prompt based on the supplied parameters.
instructions: |
You are a festival poster generator.
**Event Details:**
- Event Name: {{ event_name }}
- Date & Time: {{ event_datetime }}
- Location: {{ location }}
- Event Type: {{ event_type }}
{% if tagline %}- Tagline: {{ tagline }}{% endif %}
{% if description %}- Description: {{ description }}{% endif %}
{% if event_type == "food" %}
## Food Event Theme
- Use warm, inviting colors (burgundy, warm orange, cream)
- Typography: Friendly, rounded fonts
- Mood: Cozy, appetizing, welcoming
{% endif %}
{% if event_type == "kids" %}
## Kids Event Theme
- Use bright, playful colors (rainbow palette, pastels)
- Typography: Playful, bold, easy‑to‑read fonts
- Mood: Fun, energetic, joyful
{% endif %}
{% if event_type == "performance" %}
## Performance Event Theme
- Use elegant, sophisticated colors (deep navy, gold)
- Typography: Serif fonts with high contrast
- Mood: Refined, dramatic, immersive
{% endif %}
The {{ variable }} syntax injects parameter values, while {% if … %} blocks include or omit sections. Jinja filters can transform values on the fly, e.g.:
Save to: poster_{{ event_type }}_{{ event_name | lower | replace(" ", "_") }}.html
Running the Recipe
You can invoke the recipe from the CLI:
goose run festival-poster-generator \
--event_name "Hot Cocoa Tasting" \
--event_datetime "December 15, 2pm–4pm" \
--location "Main Plaza" \
--event_type food
For a kids event:
goose run festival-poster-generator \
--event_name "Storytelling Hour" \
--event_datetime "December 17, 3pm–4pm" \
--location "Story Tent" \
--event_type kids
In Goose Desktop, the same recipe appears as a form UI with dropdowns for event_type and text fields for the other inputs, making it even easier to use.
Benefits of Parameterized Recipes
- Reusability: One recipe handles all event types, eliminating duplicated prompts.
- Consistency: All posters share the same structure and quality standards; only the data and styling differ.
- Scalability: Adding a new event type is as simple as extending the Jinja condition block.
- Maintainability: Changes to wording, branding, or layout are made in a single place.
These patterns apply to any repetitive AI task. During Advent of AI I used similar recipes for:
- Data transformation (Day 8)
- GitHub automation (Day 6)
- UI generation (Day 4)
The same approach could streamline generating security policies or MCP server configurations at work—just define the varying parameters and let the recipe handle the rest.