{"id":"dbt-transformation-patterns","name":"dbt-transformation-patterns","summary":"モデルの整理、テスト、ドキュメント作成、増分戦略を備えた分析エンジニアリングのためのDBT(データ構築ツール)のマスター。","body":"# dbt Transformation Patterns\n\nProduction-ready patterns for dbt (data build tool) including model organization, testing strategies, documentation, and incremental processing.\n\n## When to Use This Skill\n\n- Building data transformation pipelines with dbt\n- Organizing models into staging, intermediate, and marts layers\n- Implementing data quality tests\n- Creating incremental models for large datasets\n- Documenting data models and lineage\n- Setting up dbt project structure\n\n## Core Concepts\n\n### 1. Model Layers (Medallion Architecture)\n\n```\nsources/          Raw data definitions\n    ↓\nstaging/          1:1 with source, light cleaning\n    ↓\nintermediate/     Business logic, joins, aggregations\n    ↓\nmarts/            Final analytics tables\n```\n\n### 2. Naming Conventions\n\n| Layer        | Prefix         | Example                       |\n| ------------ | -------------- | ----------------------------- |\n| Staging      | `stg_`         | `stg_stripe__payments`        |\n| Intermediate | `int_`         | `int_payments_pivoted`        |\n| Marts        | `dim_`, `fct_` | `dim_customers`, `fct_orders` |\n\n## Quick Start\n\n```yaml\n# dbt_project.yml\nname: \"analytics\"\nversion: \"1.0.0\"\nprofile: \"analytics\"\n\nmodel-paths: [\"models\"]\nanalysis-paths: [\"analyses\"]\ntest-paths: [\"tests\"]\nseed-paths: [\"seeds\"]\nmacro-paths: [\"macros\"]\n\nvars:\n  start_date: \"2020-01-01\"\n\nmodels:\n  analytics:\n    staging:\n      +materialized: view\n      +schema: staging\n    intermediate:\n      +materialized: ephemeral\n    marts:\n      +materialized: table\n      +schema: analytics\n```\n\n```\n# Project structure\nmodels/\n├── staging/\n│   ├── stripe/\n│   │   ├── _stripe__sources.yml\n│   │   ├── _stripe__models.yml\n│   │   ├── stg_stripe__customers.sql\n│   │   └── stg_stripe__payments.sql\n│   └── shopify/\n│       ├── _shopify__sources.yml\n│       └── stg_shopify__orders.sql\n├── intermediate/\n│   └── finance/\n│       └── int_payments_pivoted.sql\n└── marts/\n    ├── core/\n    │   ├── _core__models.yml\n    │   ├── dim_customers.sql\n    │   └── fct_orders.sql\n    └── finance/\n        └── fct_revenue.sql\n```\n\n## Detailed patterns and worked examples\n\nDetailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.\n\n## Best Practices\n\n### Do's\n\n- **Use staging layer** - Clean data once, use everywhere\n- **Test aggressively** - Not null, unique, relationships\n- **Document everything** - Column descriptions, model descriptions\n- **Use incremental** - For tables > 1M rows\n- **Version control** - dbt project in Git\n\n### Don'ts\n\n- **Don't skip staging** - Raw → mart is tech debt\n- **Don't hardcode dates** - Use `{{ var('start_date') }}`\n- **Don't repeat logic** - Extract to macros\n- **Don't test in prod** - Use dev target\n- **Don't ignore freshness** - Monitor source data","author":"@wshobson","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/wshobson/agents/tree/main/plugins/data-engineering/skills/dbt-transformation-patterns","license":"MIT","category":"testing","lang":"en","tokens":758,"stars":0,"calls30d":2,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"references/details.md","size":10449,"sha256":"f560a1ba857fdf4a2a78ac3c634c1a952afaee2ffc3a13baa21811284586d6e2"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}