Genie Code Series — Episode 1: One Prompt, One Medallion Pipeline

Every AI agent demo starts with the agent. Every AI agent project that reaches production starts with the data. Over the next ten episodes, we are going to build a Support Copilot, an agent that helps a support team triage tickets, answer SLA questions and draft replies. We will take it all the way from a prototype to a governed, evaluated, monitored production agent on Databricks.
We start where the real work starts: getting messy support tickets into clean, trustworthy tables. In this episode, we use Genie Code in Agent mode to build a full bronze/silver/gold pipeline from a single prompt, and we teach it our team’s conventions with a Markdown skill so the output looks like something we would actually merge.
Everything in this episode runs on Databricks Free Edition.
What We Will Build
| Layer | Tables | What happens |
|---|---|---|
| Bronze | bronze_ticketsbronze_customersbronze_agentsbronze_sla_policiesbronze_ticket_events | Raw files land as-is via Auto Loader |
| Silver | silver_ticketssilver_customerssilver_agentssilver_sla_policies | Cleaning, deduplication, expectations |
| Gold | gold_ticket_factsgold_sla_dailygold_agent_performance | SLA breach flags, daily SLA health, agent performance |

Prerequisites:
- Access to a Databricks Free Edition Workspace (serverless only — that is all we need)
- Install Data Generator and Skill from the Companion Repo: databricks-tutorials/e01-genie-code-pipeline
- Time to Complete: ~45 minutes
Step 1: Generate Realistic, Messy Support Data
Clean demo data makes for clean demos and useless lessons. Our generator produces support tickets the way real help-desk exports look: priorities written as P1, Urgent and "urgent", four different timestamp formats, duplicate rows, invalid emails, CSAT scores of N/A, and tickets that are “resolved” before they were created.
CREATE SCHEMA IF NOT EXISTS workspace.support_copilot;
CREATE VOLUME IF NOT EXISTS workspace.support_copilot.raw;
python generate_support_data.py --out /Volumes/workspace/support_copilot/raw --seed 42
The seed is fixed, so your numbers will match ours: 5,327 raw tickets across four monthly files (July 1,489, August 1,482, September 1,454, October 902) and 14,521 ticket events (4,139 / 4,031 / 3,989 / 2,362), plus customers, agents and SLA policies.
Step 2: Teach Genie Code Conventions With a Skill
Genie Code is good at writing pipelines. It does not know that our team prefixes tables with bronze_, keeps one file per layer, or treats P1 as urgent. Instead of repeating that in every prompt, we put it in a skill.
Skills are folders with a SKILL.md file. User skills live in /Users/{username}/.assistant/skills/, and Genie Code loads them automatically when they are relevant, or when we @-mention them.
---
name: support-copilot-medallion
description: Conventions for building the Support Copilot Lakeflow pipeline (bronze/silver/gold) in workspace.support_copilot...
---
## Naming
- Layers are prefixes: `bronze_<entity>`, `silver_<entity>`, `gold_<subject>`...
## Silver
- Canonical values: priority in (urgent, high, normal, low) mapping P1..P4...
Clip 1 (40 s): the skill in Genie Code settings, then @support in a new chat picks it up from autocomplete.
A practical tip: skill edits do not apply to an open chat. Start a new chat after every change.
Step 3: Let Genie Code Profile the Data First
Before we ask for a pipeline, we ask for a diagnosis. This gives Genie Code (and us) a list of problems the silver layer must solve.
@support-copilot-medallion Profile the raw files in /Volumes/workspace/support_copilot/raw/. For each entity tell me the columns, row counts, and every data quality problem you can find. Don't build anything yet.
Clip 2 (53 s): Genie Code reads the skill, loads each file and reports findings per entity.
Genie Code came back with a per-entity list: duplicate customers and agents, casing variants and inactive flags, and on tickets 16 priority variants, four timestamp formats, duplicates, nulls and orphaned references. That list becomes the to-do list for the silver layer.
Step 4: One Prompt, One Pipeline
Now the main event. We create an empty ETL pipeline in the Lakeflow Pipelines Editor (catalog workspace, schema support_copilot), open Genie Code, switch to Agent mode, and send one prompt:
@support-copilot-medallion Build a medallion pipeline for the Support Copilot from /Volumes/workspace/support_copilot/raw/: bronze streaming tables ... silver tables that fix the quality problems you found, deduplicate tickets by latest updated_at, and add expectations; gold materialized views ... Show me the plan first, then create the files and run the pipeline.
Clip 3 (90 s): context gathering, the plan, approval, three SQL files, a dry run with errors that Genie fixes itself, and a green run.
Genie Code proposes a plan, asks before it runs anything, writes bronze.sql, silver.sql and gold.sql, and starts a pipeline update. Every action runs with our own Unity Catalog permissions, so it can only touch what we can touch.
It was not a perfect first draft. The dry run surfaced errors: Genie Code had used incorrect syntax for AUTO CDC and had forgotten to wrap a streaming source in STREAM(). It read the error messages, fixed both problems itself, and the next run completed with every dataset green. That loop (write, validate, read the error, fix) is exactly what we want from an agent. It is also a reminder to read the code it wrote.
If your output differs from ours, that is expected — agents are not deterministic. The reference pipeline in the repo (
fallback_pipeline/) produces exactly the tables used in the rest of the series.
Step 5: Check That the Expectations Actually Work
A pipeline that runs green is not the same as a pipeline we trust. And here is the honest part: although we asked for expectations, Genie Code’s first version of silver_tickets had none. The Expectations column was empty. A green graph hid it.
So we asked Genie Code to add the expectations defined in the skill. It read silver.sql, planned the change, and added constraints like this one:
CONSTRAINT valid_resolved_at EXPECT (resolved_at IS NULL OR resolved_at >= created_at) ON VIOLATION DROP ROW
Clip 4 (60 s): the empty Expectations column, the diff in silver.sql, the rerun, and the Data quality tab.
After the rerun, valid_resolved_at dropped 47 rows: tickets “resolved” before they were created. After deduplication and the expectations, silver_tickets holds 4,953 tickets out of 5,327 raw rows. To confirm deduplication in your own workspace, run this check. It should return no rows:
SELECT ticket_id, count(*) FROM workspace.support_copilot.silver_tickets GROUP BY 1 HAVING count(*) > 1;
Step 6: Prove It Is Incremental
We drop one more ticket file into the volume and refresh. Auto Loader picks up only the new file.
Clip 5 (39 s): upload tickets_2026_10b.csv, refresh, and bronze_tickets writes only the new rows.
The new file, tickets_2026_10b.csv, has 65 rows. bronze_tickets wrote exactly those 65 rows: Auto Loader skipped the files it had already processed. After cleaning and deduplication, silver_tickets grew by 63 rows.
Step 7: Ask the Gold Layer a Business Question
Using gold_sla_daily, what is the SLA breach rate by tier for September 2026, and which priority is breached most often for Free tier? Show a chart.
Clip 6 (40 s): Genie Code checks the gold_sla_daily schema, writes and runs the SQL, and builds a chart.

| Tier | SLA breach rate, September 2026 |
|---|---|
| Free | 10.8% |
| Pro | 5.6% |
| Business | 4.3% |
| Enterprise | 2.1% |
The tiers line up the way you would expect: the higher the tier, the lower the breach rate. For the Free tier, the answer depends on how you ask the question. By rate, low priority tickets breach most often. By volume, normal priority has the most breaches, simply because there are more of them. Ask the question precisely.
What We Learned
- Skills turn prompts into standards. One
SKILL.mdgave us consistent naming, expectations and file layout without a 40-line prompt. - Profile first, build second. Asking for a diagnosis before the build produced better silver logic.
- Green is not the same as correct. Genie Code skipped the expectations on its first pass. The pipeline still ran, so only reviewing the output caught it.
- The agent can debug its own code. It fixed its
AUTO CDCsyntax and a missingSTREAM()wrapper from the error messages, without help. - Agent output needs a safety net. Expectations and a reference implementation keep the tutorial (and your project) reproducible.
- Free Edition is enough to start. One serverless pipeline, one SQL warehouse, zero cost.
Free Edition Notes
- Free Edition allows one active pipeline per pipeline type, so stop other pipelines before running this one.
- Compute is serverless only, with daily fair-usage quotas.
Stay Tuned for Episode 2
In Episode 2, we turn unstructured attachments — PDF invoices and screenshots customers send with their tickets — into structured data with ai_parse_document, ai_extract and ai_classify.