Communitygithub.com

dbt

dbt(데이터 빌드 도구)는 SQL SELECT 문을 사용하여 데이터 웨어하우스에서 데이터를 변환합니다. 프로젝트 설정, 모델, 테스트, 문서화, 증분 자료화, 그리고 PostgreSQL, BigQuery, Snowflake와 같은 데이터 웨어하우스와의 통합에 대해 알아봅니다.

dbt란 무엇인가요?

dbt(데이터 빌드 도구)는 애널리틱스 엔지니어가 SQL SELECT 문만 작성하여 데이터를 변환할 수 있게 해주는 핵심 도구입니다. 이 스킬은 프로젝트 설정부터 모델링, 테스트, 문서화, 증분 자료화에 이르기까지 dbt의 전체 워크플로우를 다룹니다. dbt는 SQL을 중앙 집중식으로 관리하고 데이터 변환 로직을 모듈화하며, 자동화된 테스트와 문서 생성 기능을 통해 데이터 품질과 투명성을 보장합니다. 주요 데이터 웨어하우스(PostgreSQL, BigQuery, Snowflake)와 통합되며, dbt init으로 프로젝트를 시작하고, dbt run, dbt test, dbt docs generate 등의 CLI 명령어로 전체 파이프라인을 관리할 수 있습니다. 이 스킬은 dbt를 처음 접하는 사용자부터 고급 사용자까지 모든 수준의 개발자와 AI 에이전트에게 유용하며, 실제 예제를 통해 신속하게 학습하고 적용할 수 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/dbt

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

dbt은(는) 무엇을 하나요?

dbt는 애널리틱스 엔지니어가 SQL SELECT 문을 작성하여 데이터를 변환할 수 있게 해줍니다. 자료화(테이블, 뷰, 증분), 테스트, 문서화, 계보 추적을 처리합니다.

설치

# PostgreSQL 어댑터와 함께 dbt 설치
pip install dbt-postgres

# 또는 다른 어댑터와 함께 설치
pip install dbt-bigquery
pip install dbt-snowflake

# 새 프로젝트 초기화
dbt init my_project
cd my_project

프로젝트 구조

my_project/
├── dbt_project.yml      # 프로젝트 구성
├── profiles.yml         # 연결 프로필 (보통 ~/.dbt/ 에 위치)
├── models/
│   ├── staging/         # 원시 데이터 정리
│   │   ├── _staging.yml # 스테이징 모델의 스키마 + 테스트
│   │   ├── stg_users.sql
│   │   └── stg_orders.sql
│   └── marts/           # 비즈니스 로직
│       ├── _marts.yml
│       └── fct_revenue.sql
├── tests/               # 사용자 정의 데이터 테스트
├── macros/              # 재사용 가능한 SQL 매크로
└── seeds/               # 로드할 CSV 파일

구성

# dbt_project.yml: 프로젝트 구성
name: my_project
version: '1.0.0'
profile: my_project

models:
  my_project:
    staging:
      +materialized: view
      +schema: staging
    marts:
      +materialized: table
      +schema: analytics
# profiles.yml: 데이터베이스 연결 (~/.dbt/profiles.yml)
my_project:
  target: dev
  outputs:
    dev:
      type: postgres
      host: localhost
      port: 5432
      user: analyst
      password: "{{ env_var('DBT_PASSWORD') }}"
      dbname: analytics
      schema: dev
      threads: 4
    prod:
      type: postgres
      host: prod-db.example.com
      port: 5432
      user: dbt_prod
      password: "{{ env_var('DBT_PROD_PASSWORD') }}"
      dbname: analytics
      schema: public
      threads: 8

스테이징 모델

-- models/staging/stg_users.sql: 원시 사용자 데이터 정리
WITH source AS (
    SELECT * FROM {{ source('raw', 'users') }}
),

cleaned AS (
    SELECT
        id AS user_id,
        LOWER(TRIM(email)) AS email,
        name,
        created_at::timestamp AS signed_up_at,
        CASE WHEN status = 'active' THEN TRUE ELSE FALSE END AS is_active
    FROM source
    WHERE email IS NOT NULL
)

SELECT * FROM cleaned
-- models/staging/stg_orders.sql: 원시 주문 데이터 정리
SELECT
    id AS order_id,
    user_id,
    amount_cents / 100.0 AS amount,
    status,
    created_at::timestamp AS ordered_at
FROM {{ source('raw', 'orders') }}
WHERE status != 'test'

마트 모델

-- models/marts/fct_revenue.sql: 수익 팩트 테이블
{{
    config(
        materialized='incremental',
        unique_key='order_date',
        on_schema_change='sync_all_columns'
    )
}}

WITH orders AS (
    SELECT * FROM {{ ref('stg_orders') }}
    {% if is_incremental() %}
    WHERE ordered_at > (SELECT MAX(order_date) FROM {{ this }})
    {% endif %}
),

daily AS (
    SELECT
        DATE_TRUNC('day', ordered_at)::date AS order_date,
        COUNT(*) AS total_orders,
        COUNT(DISTINCT user_id) AS unique_customers,
        SUM(amount) AS total_revenue,
        AVG(amount) AS avg_order_value
    FROM orders
    WHERE status = 'completed'
    GROUP BY 1
)

SELECT * FROM daily

스키마 및 테스트

# models/staging/_staging.yml: 소스, 컬럼, 테스트 정의
version: 2

sources:
  - name: raw
    schema: public
    tables:
      - name: users
        loaded_at_field: created_at
        freshness:
          warn_after: {count: 12, period: hour}
          error_after: {count: 24, period: hour}
      - name: orders

models:
  - name: stg_users
    description: 정리된 사용자 데이터
    columns:
      - name: user_id
        tests: [unique, not_null]
      - name: email
        tests: [unique, not_null]

  - name: stg_orders
    columns:
      - name: order_id
        tests: [unique, not_null]
      - name: status
        tests:
          - accepted_values:
              values: ['pending', 'completed', 'cancelled', 'refunded']

CLI 명령어

# commands.sh: 일반적인 dbt CLI 명령어
# 모든 모델 실행
dbt run

# 특정 모델과 그 상위 의존성 실행
dbt run --select +fct_revenue

# 테스트 실행
dbt test

# 문서 생성 및 제공
dbt docs generate
dbt docs serve --port 8081

# 소스 신선도 확인
dbt source freshness

# 전체 빌드 (실행 + 테스트 + 스냅샷)
dbt build

# 프로덕션 환경에서 실행
dbt run --target prod

매크로

-- macros/cents_to_dollars.sql: 통화 변환을 위한 재사용 가능한 매크로
{% macro cents_to_dollars(column_name) %}
    ({{ column_name }} / 100.0)::numeric(10,2)
{% endmacro %}

-- 모델에서 사용법: SELECT {{ cents_to_dollars('amount_cents') }} AS amount

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

TerminalSkills/skills

>- Lovable (formerly GPT Engineer) is a browser-based AI app builder that turns a natural-language description into a working full-stack web app with a built-in backend, authentication, database and one-click publishing. Use when the user wants to prototype or ship a web app with Lovable, write effective Lovable prompts, connect Supabase or GitHub, review generated security rules, or move a Lovable project into their own editor.

관련 스킬