Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Migrating Sql To Dbt

ASecurity

Converts legacy SQL to modular dbt models. Use when migrating SQL to dbt for: (1) Converting stored procedures, views, or raw SQL files to dbt models (2) Task mentions "migrate", "convert", "legacy SQL", "transform to dbt", or "modernize" (3) Breaking monolithic queries into modular layers (discovers project conventions first) (4) Porting existing data pipelines or ETL to dbt patterns Checks for existing models/sources, builds and validates layer by layer.

122 stars
0 votes
0 copies
2 views
Added 2/7/2026
developmentbashsqldatabase

Security Analysis

A100/100

Scanned 2/12/2026

Install to Claude Code

$npx -y skills add AltimateAI/data-engineering-skills --skill migrating-sql-to-dbt --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Migrating Sql To Dbt?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Migrating Sql To Dbt
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/altimateai-migrating-sql-to-dbt/badge)](https://www.skillsdirectory.com/skills/altimateai-migrating-sql-to-dbt)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: migrating-sql-to-dbt
description: |
  Converts legacy SQL to modular dbt models. Use when migrating SQL to dbt for:
  (1) Converting stored procedures, views, or raw SQL files to dbt models
  (2) Task mentions "migrate", "convert", "legacy SQL", "transform to dbt", or "modernize"
  (3) Breaking monolithic queries into modular layers (discovers project conventions first)
  (4) Porting existing data pipelines or ETL to dbt patterns
  Checks for existing models/sources, builds and validates layer by layer.
---

# dbt Migration

**Don't convert everything at once. Build and validate layer by layer.**

## Workflow

### 1. Analyze Legacy SQL

```bash
cat <legacy_sql_file>
```

Identify all tables referenced in the query.

### 2. Check What Already Exists

```bash
# Search for existing models/sources that reference the table
grep -r "<table_name>" models/ --include="*.sql" --include="*.yml"
find models/ -name "*.sql" | xargs grep -l "<table_name>"
```

For each table referenced in the legacy SQL:
1. Check if an existing model already references this table
2. Check if a source definition exists
3. If neither exists, ask user: "Table X not found - should I create it as a source?"

Only proceed to intermediate/mart layers after all dependencies exist.

### 3. Create Missing Sources

```yaml
# models/staging/sources.yml
version: 2

sources:
  - name: raw_database
    schema: raw_schema
    tables:
      - name: orders
        description: Raw orders from source system
      - name: customers
        description: Raw customer records
```

### 4. Build Staging Layer

One staging model per source table. Follow existing project naming conventions.

**Build before proceeding:**
```bash
dbt build --select <staging_model>
```

### 5. Build Intermediate Layer (if needed)

Extract complex joins/logic into intermediate models.

**Build incrementally:**
```bash
dbt build --select <intermediate_model>
```

### 6. Build Mart Layer

Final business-facing model with aggregations.

### 7. Validate Migration

```bash
# Build entire lineage
dbt build --select +<final_model>
dbt show --select <final_model>
```

## Migration Checklist

- [ ] All source tables identified and documented
- [ ] Sources.yml created with descriptions
- [ ] Staging models: 1:1 with sources, renamed columns
- [ ] Intermediate models: business logic extracted
- [ ] Mart models: final aggregations
- [ ] Each layer compiles successfully
- [ ] Each layer builds successfully
- [ ] Row counts match original (manual validation)
- [ ] Tests added for key constraints

## Common Migration Patterns

- Nested subqueries → Separate models (staging → intermediate → mart)
- Temp tables → Ephemeral materialization `{{ config(materialized='ephemeral') }}`
- Hardcoded values → Variables `{{ var("name") }}`

## Anti-Patterns

- Converting entire legacy query to single dbt model
- Skipping the staging layer
- Not validating each layer before proceeding
- Keeping hardcoded values instead of using variables
- Not documenting business logic during migration

Attribution

AltimateAIAltimateAI
View sourceMore from AltimateAI →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

284072 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2192 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →