mit einem Klick
duckdb-sql
// Load when hitting DuckDB syntax errors or writing DuckDB-specific SQL. Covers gotchas that differ from PostgreSQL/MySQL.
// Load when hitting DuckDB syntax errors or writing DuckDB-specific SQL. Covers gotchas that differ from PostgreSQL/MySQL.
Gather business context from Notion before dbt builds. Searches pages, extracts definitions/decisions/constraints, writes structured context for the build agent and notion-verify subagent.
Load at Step 1 before exploring the project. Covers Notion context gathering, output shape inference, incremental model handling, and what to trust in YML.
Load when dbt run or dbt parse fails. Covers YML duplicate patches, ref errors, passthrough model warnings, current_date fixes, DuckDB error messages, and zero-row diagnosis.
Load at Step 4 when writing SQL models. Covers column naming, type preservation, JOIN defaults, lookup joins, sibling models, materialization, packages, and filtering rules.
BigQuery-specific SQL patterns: UNNEST for array expansion, STRUCT, ARRAY_AGG, DATE_DIFF/DATE_ADD, backtick-quoted table references, EXCEPT/REPLACE in SELECT, approximate aggregation, partitioned and wildcard tables.
Use this skill before writing any SQL query. Covers: output shape inference (cardinality clues from the question), efficient schema exploration, iterative CTE-based query building, structured verification loop (row count, NULL audit, fan-out check, sample inspection), error recovery protocol, saving output to result.sql and result.csv, turn budget management, and common benchmark traps.
| name | duckdb-sql |
| description | Load when hitting DuckDB syntax errors or writing DuckDB-specific SQL. Covers gotchas that differ from PostgreSQL/MySQL. |
| type | skill |
5/2 = 2. Fix: CAST(numerator AS DOUBLE) / denominatorCAST(DATE_TRUNC('month', col) AS DATE)INTERVAL '1' DAY (quoted), NOT INTERVAL 1 DAYcol + INTERVAL '1' DAY and DATE_DIFF('day', start, end)COALESCE(SUM(col), 0) if 0 is needed.decimal(6,2),
cast the FINAL output to match: CAST(ROUND(AVG(col), 2) AS DECIMAL(6,2)).
Do NOT cast the input — cast the result after rounding.(SELECT MAX(date_col) FROM source) to anchor to the data's actual date rangeSTRPTIME(col, '%d/%m/%Y')::DATETRY_STRPTIME returns NULL on failure (safe)CAST(date_str AS DATE) on non-ISO stringsFilter window function results without a subquery:
SELECT *, ROW_NUMBER() OVER (PARTITION BY group ORDER BY col DESC) AS rn
FROM table
QUALIFY rn <= 10
SELECT UNNEST(GENERATE_SERIES(min_date::DATE, max_date::DATE, INTERVAL '1' DAY)) AS date_day
Always use the primary fact table's max date as endpoint — call get_date_boundaries first.
CAST(x AS INTEGER), CAST(x AS DOUBLE), CAST(x AS VARCHAR), CAST(x AS DATE)
TRY_CAST returns NULL on failure.