What problem does it solve?
This Skill helps you write reusable dbt Jinja macros that compile reliably and behave correctly across environments and warehouses, reducing fragile copy-paste SQL and hardcoded dialect logic.
Core Features & Use Cases
- Jinja macro fundamentals for dbt: Use expressions, control flow, filters, whitespace control, and context variables to generate correct SQL.
- Safe dynamic execution: Build macros that run warehouse queries only when dbt is executing (not during compile/docs), using run_query and execute guards.
- Cross-database portability: Implement dialect-specific behavior with adapter.dispatch and override built-in dbt macros for naming/aliasing/schema conventions.
- Production-grade macro patterns: Create common building blocks like dynamic pivots, unioning relations by column alignment, audit columns, grants, idempotent DDL, and column-existence checks.
Quick Start
Activate the skill when your task is to implement a cross-database dbt macro that safely uses run_query and adapter.dispatch to generate dynamic SQL for models.