Use when long-lived agents, project memories, system prompts, or playbooks are repeatedly summarized, rewritten, or optimized and risk losing domain detail, provenance, or execution learnings.
中文简介正在准备中。当前显示原文说明。
Writes and reviews dbt projects targeting Snowflake: models, schema.yml metadata, sources, tests, macros, and project structure. Use when building or reviewing dbt models, generating dbt YAML, or applying dbt best practices.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
You are working with dbt (data build tool) targeting Snowflake. Apply production-grade patterns at every level — clean SQL, thorough YAML metadata, sensible tests, and a project structure that scales.
| Type | When to use |
|---|---|
view | Lightweight lookups, rarely-queried transformations |
table | Stable staging/intermediate layers queried often |
incremental | Large fact tables — only process new/changed rows |
ephemeral | CTEs you want to reuse across models — no physical table |
snapshot | Slowly changing dimensions (SCD Type 2) |
dynamic_table | Snowflake-native: auto-refresh on a lag, no dbt run needed |
Configure at the model level (override project defaults):
{{ config(
materialized='incremental',
unique_key='event_id',
incremental_strategy='merge',
cluster_by=['date_day', 'account_id']
) }}
merge (default) — upsert by unique_key
{{ config(materialized='incremental', unique_key='id', incremental_strategy='merge') }}
select ...
from {{ source('raw', 'events') }}
{% if is_incremental() %}
where loaded_at > (select max(loaded_at) from {{ this }})
{% endif %}
delete+insert — for partitioned tables without a reliable unique key
{{ config(
materialized='incremental',
unique_key=['date_day', 'account_id'],
incremental_strategy='delete+insert',
partition_by={'field': 'date_day', 'data_type': 'date'}
) }}
append — event logs, audit tables where duplicates are acceptable
{{ config(materialized='incremental', incremental_strategy='append') }}
insert_overwrite — replace entire partitions (Snowflake dynamic partition pruning)
On schema changes: always add on_schema_change='sync_all_columns' for production incremental models — silently ignoring schema drift causes silent data loss.
dbt_project/
├── dbt_project.yml # Project config
├── profiles.yml # Connection config (NOT in git)
├── packages.yml # dbt-utils, dbt-expectations, etc.
├── models/
│ ├── staging/ # 1:1 with source tables, light casting only
│ │ ├── _sources.yml # source() definitions + freshness
│ │ ├── _staging.yml # staging model docs + tests
│ │ └── stg_*.sql
│ ├── intermediate/ # Business logic joins, not exposed
│ │ └── int_*.sql
│ ├── marts/ # Final models consumed by BI/apps
│ │ ├── core/
│ │ └── finance/
│ └── utils/ # Generic macros used across layers
├── macros/
├── seeds/ # Small reference CSVs
├── snapshots/ # SCD Type 2 models
├── tests/ # Singular (custom SQL) tests
└── analyses/ # Ad hoc SQL, not materialized
Naming rule: stg_<source>__<entity>, int_<entity>__<verb>, fct_<event>, dim_<entity>
# models/staging/_staging.yml
version: 2
models:
- name: stg_salesforce__accounts
description: "One row per Salesforce account, cast and renamed."
config:
tags: ["salesforce", "staging"]
columns:
- name: account_id
description: "Natural key from Salesforce."
data_tests:
- not_null
- unique
- name: created_at
description: "UTC timestamp of account creation."
data_tests:
- not_null
- name: account_type
data_tests:
- accepted_values:
values: ["Customer", "Partner", "Prospect"]
# models/staging/_sources.yml
version: 2
sources:
- name: salesforce
database: RAW_DB
schema: SALESFORCE
freshness:
warn_after: {count: 12, period: hour}
error_after: {count: 24, period: hour}
loaded_at_field: _loaded_at
tables:
- name: account
identifier: ACCOUNT # actual table name if different
description: "Raw Salesforce accounts."
columns:
- name: Id
data_tests:
- not_null
- unique
Generic tests (in schema.yml): not_null, unique, accepted_values, relationships
dbt-utils tests (install dbt-utils):
- dbt_utils.expression_is_true:
expression: "amount >= 0"
- dbt_utils.unique_combination_of_columns:
combination_of_columns: ["date_day", "account_id", "metric"]
- dbt_utils.not_empty_string:
column_name: account_name
dbt-expectations for statistical tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 1
Singular tests (tests/ folder) — custom SQL that returns rows on failure:
-- tests/assert_fct_orders_amount_positive.sql
select order_id
from {{ ref('fct_orders') }}
where amount < 0
Date spine:
-- macros/generate_date_spine.sql
{% macro generate_date_spine(start_date, end_date) %}
{{ dbt_utils.date_spine(
datepart="day",
start_date="cast('" ~ start_date ~ "' as date)",
end_date="cast('" ~ end_date ~ "' as date)"
) }}
{% endmacro %}
Surrogate key:
select
{{ dbt_utils.generate_surrogate_key(['account_id', 'date_day']) }} as sk_account_day,
...
Safe divide:
{% macro safe_divide(numerator, denominator) %}
iff({{ denominator }} = 0, null, {{ numerator }} / {{ denominator }})
{% endmacro %}
-- snapshots/snp_accounts.sql
{% snapshot snp_accounts %}
{{
config(
target_schema='SNAPSHOTS',
unique_key='account_id',
strategy='timestamp',
updated_at='updated_at',
invalidate_hard_deletes=True
)
}}
select * from {{ source('crm', 'accounts') }}
{% endsnapshot %}
Clustering keys (for large tables queried by date range):
{{ config(cluster_by=["date_day", "account_id"]) }}
Dynamic tables (Snowflake-native, set materialized='dynamic_table'):
{{ config(
materialized='dynamic_table',
snowflake_warehouse='TRANSFORM_WH',
target_lag='5 minutes'
) }}
Warehouse override for expensive models:
{{ config(snowflake_warehouse='LARGE_WH') }}
Copy grants so downstream roles keep access after table rebuild:
{{ config(materialized='table', copy_grants=True) }}
Stage-based seed loading for large reference files (avoid in-YAML seed if >10k rows):
-- Use a model that reads from a named Snowflake stage instead of dbt seed
select $1::varchar as code, $2::varchar as label
from @RAW_DB.PUBLIC.REFERENCE_STAGE/lookup.csv
(file_format => 'CSV_FORMAT')
name: 'my_project'
version: '1.0.0'
config-version: 2
profile: 'snowflake_prod'
model-paths: ["models"]
test-paths: ["tests"]
snapshot-paths: ["snapshots"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
target-path: "target"
clean-targets: ["target", "dbt_packages"]
models:
my_project:
staging:
+materialized: view
+schema: STAGING
intermediate:
+materialized: ephemeral
marts:
+materialized: table
+schema: MARTS
core:
+tags: ["core", "daily"]
vars:
start_date: "2020-01-01"
When generating dbt YAML files from code (e.g., from ETL metadata), follow these rules:
models/staging/_<layer>.ymlversion: 2 at the top of every YAML filedata_tests must match the SQL output column names exactlyidentifier field in sources is only needed when the dbt model name differs from the actual table nameref() creates lineage — always use it instead of hardcoding table namessource() for raw tables — never ref() a staging model that wraps a sourcedbt debug # Test connection
dbt compile --select my_model # See rendered SQL without running
dbt run --select +my_model # Run model + all ancestors
dbt test --select my_model # Run tests for one model
dbt docs generate && dbt docs serve # Browse lineage DAG
dbt source freshness # Check source staleness
dbt list --select tag:daily # Find all models tagged daily
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Use when long-lived agents, project memories, system prompts, or playbooks are repeatedly summarized, rewritten, or optimized and risk losing domain detail, provenance, or execution learnings.
中文简介正在准备中。当前显示原文说明。
Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document this architecture", "onboard me to this repo", or "create codebase docs". Do not trigger for routine feature implementation, bug fixes, or narrow code edits unless the user asks for repository-level discovery.
中文简介正在准备中。当前显示原文说明。
Adds educational comments to a code file so it becomes a learning resource, asking for the file (with a list of close matches) if none is given. Use when preparing code for learners, onboarding, or teaching.
中文简介正在准备中。当前显示原文说明。
Write, debug, and optimize Adobe Illustrator automation scripts using ExtendScript (JavaScript/JSX). Use when creating or modifying scripts that manipulate documents, layers, paths, text frames, colors, symbols, artboards, or any Illustrator DOM objects. Covers the complete JavaScript object model, coordinate system, measurement units, export workflows, and scripting best practices.
中文简介正在准备中。当前显示原文说明。
Patterns and techniques for adding governance, safety, and trust controls to AI agent systems. Use this skill when: - Building AI agents that call external tools (APIs, databases, file systems) - Implementing policy-based access controls for agent tool usage - Adding semantic intent classification to detect dangerous prompts - Creating trust scoring systems for multi-agent workflows - Building audit trails for agent actions and decisions - Enforcing rate limits, content filters, or tool restrictions on agents - Working with any agent framework (PydanticAI, CrewAI, OpenAI Agents, LangChain, AutoGen)
中文简介正在准备中。当前显示原文说明。
Check any AI agent codebase against the OWASP Agentic Security Initiative (ASI) Top 10 risks. Use this skill when: - Evaluating an agent system's security posture before production deployment - Running a compliance check against OWASP ASI 2026 standards - Mapping existing security controls to the 10 agentic risks - Generating a compliance report for security review or audit - Comparing agent framework security features against the standard - Any request like "is my agent OWASP compliant?", "check ASI compliance", or "agentic security audit"
中文简介正在准备中。当前显示原文说明。