migrating-sql-to-dbt

Convert legacy SQL into layered dbt models with build validation.

2|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/miptah21/skills --skill migrating-sql-to-dbt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrating-sql-to-dbt
Source: https://github.com/miptah21/skills/tree/main/.agents/skills/migrating-sql-to-dbt
Command: npx skills add https://github.com/miptah21/skills --skill migrating-sql-to-dbt

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Migrating legacy SQL into dbt without breaking logic or losing validation.

Core Features & Use Cases

  • Layer-by-layer conversion: breaks monolithic queries into staging, intermediate, and mart models while validating each step.
  • Project-aware discovery: checks existing models and sources so you only add what’s missing.
  • Migration rigor: builds incrementally, validates via builds and model inspections, and adds tests and documentation during the port.

Quick Start

Ask the skill to convert your legacy SQL file into dbt by first discovering existing models and sources, then creating missing sources, building staging models, and validating each layer before producing the final mart model.

Frequently Asked Questions about migrating-sql-to-dbt

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate legacy SQL to dbt layer-based transformations?

Migrating legacy SQL to dbt involves breaking monolithic queries into staging, intermediate, and mart models while validating row-level outputs through incremental dbt builds. This approach converts stored procedures and raw query files into maintainable transformations without breaking existing logic.

What is the best way to split monolithic SQL queries into dbt staging and mart models?

Splitting monolithic SQL queries requires project-aware discovery to map referenced tables to existing models or new sources. You create missing YAML sources, build staging models first, validate them, and then produce the final mart model incrementally.

Does converting stored procedures to dbt models require creating sources.yml manually?

Converting stored procedures does not require manual sources.yml creation if the migration process handles project-aware discovery. It automatically checks for existing models and sources, creating missing YAML sources only when necessary during the port.

How do I validate row-level outputs when refactoring SQL into dbt models?

Validating row-level outputs when refactoring SQL into dbt models is done by running incremental dbt builds per layer and using dbt show. This ensures each staging, intermediate, and mart model maintains data integrity before moving to the next step.

Can I port existing views into dbt without losing validation or breaking pipeline logic?

Porting existing views into dbt without breaking logic is achieved through iterative build-and-validate requirements. The migration checks for model and source existence, applies layer-by-layer conversion, and adds tests and documentation during the port to preserve validation.