Zero Labs
Industry News / AI

The Missing Layer in AI Data Pipelines: Designing with Spec-Driven Development

Source · Towards AI By Rahul Sahay

From the publisher’s feed, collected in the ZeroLabs newsroom.

Your Cortex Code sessions are only as good as the document you write before opening themThe Missing Layer in AI Data Pipelines: Why Spec-Driven Development Matters — In the previous piece, I explored why intent gets lost in AI pipelines. This is what actually fixes it.. Read that firstI keep coming back to a question someone asked during a demo.We had just watched Cortex Code build a full dbt pipeline from plain English. Multi-table joins. Governance policies. A working Streamlit dashboard. All of it, in six sessions. People were genuinely impressed.Then someone raised their hand.“That’s impressive. But six months from now — when the engineer who built this leaves — where does the intent live?”I didn’t have a good answer. The honest answer was — it lives in the Snowsight chat thread. Which nobody will ever find again.That question changed how I think about building data pipelines with AI. Not because it made me doubt the tool. Because it made me realise we were putting the knowledge in completely the wrong place.CoCo Is Not Agentic — And That’s Actually the PointBefore anything else, something worth saying clearly.Cortex Code is not an agentic tool. Each session is stateless. No API. No shared memory between tabs. When you close a session the context is gone — you start from scratch next time.In a real pipeline build you might run six sessions in sequence: DevOps sets up infrastructure, a Data Engineer builds staging, an Analytics Engineer builds marts, a QA Engineer writes tests, a Governance Engineer applies masking policies, an App Developer builds the dashboard. Nobody orchestrates those sessions automatically. You do. Opening each one manually. Pasting the prompt. Reviewing the output. Starting the next.CoCo is a powerful AI assistant. You are the orchestrator. And when you’re manually connecting six stateless sessions, the only thing keeping them consistent is something that exists outside all of them. Something all six can reference without you re-explaining the project every time.That thing is the Specification Development Document. The SDD.What Fat Prompts Actually Cost YouHere is what most teams do when they start building with CoCo. They write prompts that carry all the knowledge.Same task. Left: everything in the prompt. Right: prompt reads the SDD directly. The knowledge didn’t disappear — it moved.The fat prompt works the first time. CoCo produces exactly what you described. You feel productive.Then requirements change. The tier thresholds shift. A new PII column appears. You go back to the prompt, update it, and hope you remembered everything else that was in it. You didn’t. Now two sessions say different things about the same model. CoCo picks one. Your pipeline drifts.This isn’t a CoCo problem. Its a single source of truth problem. And the fix isn’t a better prompt — its a better spec.What a Prompt Looks Like With and Without the SDDLet me show you the difference across three real states. Same task — build dim_customers. Three different relationships with the spec.State 1: everything in the prompt. State 2: spec exists but prompt still carries logic. State 3: prompt reads the SDD file directly. The bottom row is what changes when requirements shift.Most teams live in State 2. They have a spec document somewhere — a Confluence page, a Google Doc — but the prompts still carry business logic because nobody took the time to structure the spec for AI consumption. Two sources of truth. Drift is inevitable.State 3 is what the structured SDD unlocks. Here is what a real session prompt looks like when the spec is doing its job:"Read the SDD file at@POC_DB.SPEC_DRIVEN.STAGE/SDD_dbt_pipeline_snowflake_v2.0.md.Using sections SDD-3.3 (intermediate models) and SDD-3.4 (marts models),build the complete dbt intermediate and marts layers.For each of the 5 marts models defined in SDD-3.4.1 through SDD-3.4.5:1. Create the .sql file using exact columns and derivation logic from the SDD2. Create _marts__models.yml with column descriptions3. Apply the materialization specified in each sectionRun: dbt runVerify: All 8 models exist. Derived tier columns correct per SDD-3.4."That prompt covers 8 models across two layers. Column names, join logic, tier derivations, masking rules, test requirements — none of it is in the prompt. CoCo reads the SDD file directly from stage and gets everything it needs. Change a tier threshold in the SDD and the same prompt produces updated code automatically. Every session that references the spec picks up the change.This is the shift. Not a better prompt. A better spec.The Six-Section SDD — What Each One DoesThe SDD is not a design document you write once and file away. It’s a living spec that CoCo reads in every session. Which means its structure matters enormously.Six sections. Each with a specific job. SDD-3 is the heart — where thin prompts get their detail.Here is what each section does in practice — and what breaks without it.SDD-1 — Problem statement grounds CoCo when a session drifts. Without it, there’s nothing to pull a confused session back to reality. Every session starts by reading this.SDD-2 — Functional requirements defines what to build. Numbered, prioritised P0 to P1, grouped by capability area. In a complex pipeline this might be 50+ requirements across pipeline, testing, governance, app, and infrastructure. Without numbering, prompts can’t reference specific requirements cleanly.SDD-3 — API contract is the heart of everything. Column-by-column, table-by-table specification of every input and every output. Source columns, target columns, transformations, data types, nullable flags, masking policies, accepted values — all of it. When a prompt says “using SDD-3.4.4”, CoCo gets the exact column mapping with no interpretation needed. This is what makes the thin prompt possible.SDD-4 — Data lineage is the section most teams don’t include — and it’s a meaningful absence. In a complex pipeline with 5 source tables, 5 staging views, 3 intermediate models, and 5 mart tables, lineage isn’t something you reverse-engineer after the build. It’s designed in. SDD-4 carries the layer map, the DAG execution order, and the entity relationship diagram. CoCo uses it to validate FK references before writing a single line of SQL.SDD-5 — Non-functional requirements defines what the pipeline must be, not just what it must do. Performance SLAs, freshness targets, security constraints, scalability expectations. Without this section, CoCo optimises for correctness and ignores operational reality.SDD-6 — Implementation phases closes the loop. Six ordered phases — each maps to a CoCo session, each has acceptance checkpoints. When a prompt says “verify per SDD-6 Phase 3”, CoCo knows exactly what done means before it starts. The AI isn’t guessing what success looks like. You told it. In the spec. Before the session opened.Skills — The Enforcement Layer Between SDD and CoCoThe SDD carries the what. But CoCo still needs to know how to enforce standards when it generates output. That’s what Skills do.Skills are reusable standards documents that load into any CoCo session. Not prompts — pre-loaded rules that CoCo inherits automatically before a single line of code is written.Six Skills work alongside the SDD in a well-structured build:sdd-context — loads the SDD file location and project identity into every session. CoCo never needs the project explained from scratch.naming-convention — CoCo never outputs customer_stg when it should be stg_src__ins_customers. Every model name is validated against the pattern before it’s created.test-coverage — enforces minimum test requirements. No FK column skips a relationships test. No mart model ships without at least one singular test.governance — locks the five-step Horizon workflow: classify → tag → mask → steward → audit. In order. Every session. No steps skipped.infra-setup — schema, roles, grants, task DAG schedule. CoCo reads the standards, not the prompt.code-review — enforces the checklist before anything is considered done. No SELECT *. CTEs only. Explicit JOIN types. Edge cases handled.Here’s the compounding effect that matters: as the SDD matures, the Skills get leaner. In a well-structured build the Skills become one-line pointers — “read SDD-2.5 for schema, roles, grants” — because everything is already in the spec. The Skills don’t carry the knowledge. They enforce where it lives.SDD fat, Skills lean. That’s the direction you want to be heading.Does the SDD Have to Be Complete on Day One?This is the strongest objection. And its right.You can’t write a perfect spec at the start of a project. The API contract is incomplete until you’ve seen the source data. Edge cases don’t reveal themselves until you’re mid-build. The lineage diagram only makes full sense after the models exist.The SDD doesn’t have to be complete to be useful. It has to be the single source of truth as you go.The SDD grows alongside the build. Thin on day one. Complete by the end. Always the single source of truth.Who Owns the SDD?Not one person. A handoff chain.The architect or senior engineer owns SDD-1, SDD-2, and SDD-5 at project start — problem, requirements, constraints. Each session persona sharpens their section as they go. The Data Engineer fills in SDD-3.1 and SDD-3.2 after seeing the source tables. The Analytics Engineer completes SDD-3.3 and SDD-3.4 as the models take shape. The Governance Engineer owns the masking and tagging contracts in SDD-3. The QA Engineer tightens the acceptance criteria in SDD-6.After the build, the data engineering team owns the living document. When requirements change, they update the SDD first. Then re-run the relevant session. The pipeline updates. The record stays intact.Ownership isn’t a single person. It’s a discipline — spec first, always.Does This Actually Scale?Three specific ways — not a vague claim.Team scale. A new engineer joins mid-project. They read the SDD. They know what was decided, why the lineage was designed that way, which edge cases were anticipated, what the acceptance criteria are. No long knowledge transfer session. No “ask the engineer who built this.”Pipeline scale. A new source table is added. You update SDD-3. Re-run the relevant session with the same prompt. The pipeline extends cleanly. No rewriting prompts from scratch, no wondering if you’ve missed something.Time scale. Six months later something breaks in production. The SDD tells you why the join was written that way, what the non-functional requirements were, which implementation phase introduced that model. The chat history is gone. The SDD isn’t.One concrete proof point: this exact SDD structure was applied to a pipeline with 5 source tables, 13 models across three layers, governance across all PII columns, and a 3-tab Streamlit dashboard — complexity score 24, Complex band. Same six sessions. Same prompt pattern. Same SDD structure from Part 1. The framework held.And here’s the detail that stuck with me: the Streamlit app’s third tab renders the SDD itself as a live documentation layer. The spec drives the build AND becomes part of the product. The SDD outlives the sessions that created it.The Tentative ROI — Honest NumbersThese numbers come from one complex build. They’re directional, not a guarantee. Your team size, Snowflake experience, and existing standards will all affect the outcome. Read them as a framework for thinking, not a contract.Assumptions behind the numbers:Small team, 2–3 engineersModerate Snowflake and dbt familiarityNo pre-existing naming conventions or governance standards“Traditional” means no AI assistance, standard sprint velocityCoCo alone assumes prompts carry all the knowledge, no structured SDDCoCo + SDD + Skills assumes a well-structured spec from session oneNumbers are DirectionalThe honest split:CoCo saves time generating code. The SDD saves time on re-prompting, rework, and context recovery across six stateless sessions. Skills prevent a ~10–15% rework rate from compounding through every session.In a six-session build, the SDD saving is bigger than the CoCo saving. Without the SDD you probably save 20–25% using CoCo. With it, the 3–5 week estimate becomes realistic. The difference is whether you’re building once or rebuilding constantly because context was never captured.Build phase reality check — again, directional:Numbers are DirectionalWhat This Opens UpSpec-driven development with CoCo raises questions this series hasn’t fully answered yet.What happens when requirements change mid-build and the SDD needs to evolve without breaking the sessions that depend on it? How do Skills compound value across projects — not just within one build? As AI-assisted development matures, how does a well-structured SDD start to close the gap between a manual assistant and something closer to a governed, repeatable build system?These are real areas worth exploring — for this series and for everyone figuring out what disciplined AI-assisted data engineering actually looks like in practice. If any of them resonate, drop a comment. That’s where the next piece will go.The spec doesn’t just drive the build. In a well-structured pipeline it becomes part of the product — a live documentation layer that outlasts the sessions that created it. That’s where this approach is heading.If you are exploring Snowflake Cortex Code (CoCo) or planning to enable it for your team, happy to connect and exchange thoughts.I’ve been working closely on Snowflake and modern data platforms, and always open to discuss real-world use cases, challenges, or even different approaches that are working across teams.Feel free to reach out on LinkedIn : https://www.linkedin.com/in/rahul-sahay-8573923/CoCo Series Reference In case you have missed: The Missing Layer in AI Data Pipelines: Designing with Spec-Driven Development was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.