Skip to content
Back to skills

Dbt Patterns

ASecurity

Provides dbt development patterns for materialization strategy, incremental models, and audit-column macros; use when building dbt models, writing macros, or configuring materializations.

  • 19 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 19, 2026
ai-agentssql

Security analysis

A100/100

Scanned October 19, 2026

npx -y skills add sawrus/agent-guides --skill dbt-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dbt Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dbt Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sawrus-dbt-patterns/badge)](https://www.skillsdirectory.com/skills/sawrus-dbt-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dbt-patterns
description: "Provides dbt development patterns for materialization strategy, incremental models, and audit-column macros; use when building dbt models, writing macros, or configuring materializations."
---

# Skill: dbt Development Patterns

## When to load

When building dbt models, writing macros, or configuring materializations.

## Materialization Strategy

| Layer | Materialization | Why |
|:---|:---|:---|
| `staging/` | `view` | Always reflects source |
| `intermediate/` | `ephemeral` | Reduce clutter |
| `marts/` | `table` or `incremental` | Pre-computed for BI |

## Incremental Model

```sql
{{
    config(
        materialized='incremental',
        unique_key='order_id',
        incremental_strategy='merge',
        partition_by={'field': 'order_date', 'data_type': 'date'},
    )
}}

SELECT order_id, user_id, order_date, total_amount
FROM {{ ref('stg_orders') }}

{% if is_incremental() %}
    WHERE order_date >= (SELECT MAX(order_date) FROM {{ this }}) - INTERVAL '3 days'
{% endif %}
```

## Audit Columns Macro

```sql
{% macro audit_columns() %}
    CURRENT_TIMESTAMP AS loaded_at,
    '{{ invocation_id }}' AS dbt_invocation_id,
    '{{ this.name }}' AS dbt_model
{% endmacro %}
```

Attribution

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

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.