---
title: "dbt でデータ変換を構築する（エージェント用スキル） | Orchestor"
description: "dbt のモデル構成、テスト、文書化、増分処理を用いて、分析向けのデータ変換を構築します。データモデルの作成やアナリティクスエンジニアリングのベストプラクティスの導入に使います。wshobson/agents が公開している「dbt でデータ変換を構築する」の使い方を確認できます。"
canonical_url: "https://www.orchestor.io/ja/skills/wshobson/agents/dbt-transformation-patterns"
markdown_url: "https://www.orchestor.io/ja/skills/wshobson/agents/dbt-transformation-patterns.md"
---

[c96b5f6](https://github.com/wshobson/agents/commit/c96b5f6552dba32e4492307493ee613581430715)[原文を開く](https://github.com/wshobson/agents/blob/c96b5f6552dba32e4492307493ee613581430715/plugins/data-engineering/skills/dbt-transformation-patterns/SKILL.md)

wshobson2026/11/24

原文 (選択中)

未翻訳

プレビュー (選択中)

114 行（空行を除く 92 行） · 3.20 KB原文

```yaml
name: dbt-transformation-patterns
description: Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
```

# dbt Transformation Patterns

Production-ready patterns for dbt (data build tool) including model organization, testing strategies, documentation, and incremental processing.

## When to Use This Skill

* Building data transformation pipelines with dbt
* Organizing models into staging, intermediate, and marts layers
* Implementing data quality tests
* Creating incremental models for large datasets
* Documenting data models and lineage
* Setting up dbt project structure

## Core Concepts

### 1\. Model Layers (Medallion Architecture)

```
sources/          Raw data definitions
    ↓
staging/          1:1 with source, light cleaning
    ↓
intermediate/     Business logic, joins, aggregations
    ↓
marts/            Final analytics tables
```

### 2\. Naming Conventions

| Layer        | Prefix       | Example                     |
| ------------ | ------------ | --------------------------- |
| Staging      | stg\_        | stg\_stripe\_\_payments     |
| Intermediate | int\_        | int\_payments\_pivoted      |
| Marts        | dim\_, fct\_ | dim\_customers, fct\_orders |

## Quick Start

```yaml
# dbt_project.yml
name: "analytics"
version: "1.0.0"
profile: "analytics"
​
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
​
vars:
  start_date: "2020-01-01"
​
models:
  analytics:
    staging:
      +materialized: view
      +schema: staging
    intermediate:
      +materialized: ephemeral
    marts:
      +materialized: table
      +schema: analytics
```

```
# Project structure
models/
├── staging/
│   ├── stripe/
│   │   ├── _stripe__sources.yml
│   │   ├── _stripe__models.yml
│   │   ├── stg_stripe__customers.sql
│   │   └── stg_stripe__payments.sql
│   └── shopify/
│       ├── _shopify__sources.yml
│       └── stg_shopify__orders.sql
├── intermediate/
│   └── finance/
│       └── int_payments_pivoted.sql
└── marts/
    ├── core/
    │   ├── _core__models.yml
    │   ├── dim_customers.sql
    │   └── fct_orders.sql
    └── finance/
        └── fct_revenue.sql
```

## Detailed patterns and worked examples

Detailed pattern documentation lives in details.md. Read that file when the navigation tier above is insufficient.

## Best Practices

### Do's

* **Use staging layer** \- Clean data once, use everywhere
* **Test aggressively** \- Not null, unique, relationships
* **Document everything** \- Column descriptions, model descriptions
* **Use incremental** \- For tables > 1M rows
* **Version control** \- dbt project in Git

### Don'ts

* **Don't skip staging** \- Raw → mart is tech debt
* **Don't hardcode dates** \- Use `{{ var('start_date') }}`
* **Don't repeat logic** \- Extract to macros
* **Don't test in prod** \- Use dev target
* **Don't ignore freshness** \- Monitor source data

## Structured data

```json
[
  [
    {
      "@context": "https://schema.org",
      "@type": "Organization",
      "name": "Orchestor",
      "url": "https://www.orchestor.io",
      "sameAs": [
        "https://orchestor.io",
        "https://www.orchestor.io",
        "https://docs.orchestor.io"
      ],
      "@id": "https://www.orchestor.io/#organization",
      "alternateName": [
        "オーケスター"
      ],
      "logo": "https://www.orchestor.io/images/common/ogp/orchestor-ogp.png",
      "parentOrganization": {
        "@type": "Organization",
        "name": "ドットメディア株式会社",
        "url": "https://www.dotmedia.co.jp"
      }
    },
    {
      "@context": "https://schema.org",
      "@type": "WebSite",
      "url": "https://www.orchestor.io",
      "name": "Orchestor",
      "description": "Orchestor で画像・動画・音声を作り、参照素材を Remix できます。",
      "@id": "https://www.orchestor.io/#website",
      "alternateName": [
        "オーケスター"
      ],
      "inLanguage": "ja",
      "publisher": {
        "@id": "https://www.orchestor.io/#organization"
      }
    }
  ],
  {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "@id": "https://www.orchestor.io/skills/wshobson/agents/dbt-transformation-patterns#breadcrumb",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Orchestor",
        "item": "https://www.orchestor.io/"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "スキル",
        "item": "https://www.orchestor.io/skills"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "dbt でデータ変換を構築する",
        "item": "https://www.orchestor.io/skills/wshobson/agents/dbt-transformation-patterns"
      }
    ]
  }
]
```

---

[Documentation index](https://www.orchestor.io/llms.txt)
