Skip to content
Data
Skill

/duckdb-sql

Load when hitting DuckDB syntax errors or writing DuckDB-specific SQL. Covers gotchas that differ from PostgreSQL/MySQL.

From plugin
signalpilot
48928 skills2 agents

Claude Code

$ npx -y skills add signalpilot-labs/signalpilot --skill duckdb-sql --agent claude-code

SKILL.md

duckdb-sql.SKILL.md
name: duckdb-sql
description: "Load when hitting DuckDB syntax errors or writing DuckDB-specific SQL. Covers gotchas that differ from PostgreSQL/MySQL."
type: skill

DuckDB SQL — Key Differences from PostgreSQL/MySQL

Gotchas

  • **Integer division truncates**: `5/2 = 2`. Fix: `CAST(numerator AS DOUBLE) / denominator`
  • **DATE_TRUNC returns TIMESTAMP**: Cast result if DATE needed: `CAST(DATE_TRUNC('month', col) AS DATE)`
  • **INTERVAL syntax**: `INTERVAL '1' DAY` (quoted), NOT `INTERVAL 1 DAY`
  • **No DATEADD/DATEDIFF**: Use `col + INTERVAL '1' DAY` and `DATE_DIFF('day', start, end)`
  • **SUM(NULL) = NULL**: Not 0. Use `COALESCE(SUM(col), 0)` if 0 is needed.
  • **ROUND precision**: If the YML specifies a decimal type like `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.

  • **Avoid CURRENT_DATE** in models with historical data — use `(SELECT MAX(date_col) FROM source)` to anchor to the data's actual date range

Date Parsing

  • Non-ISO strings: `STRPTIME(col, '%d/%m/%Y')::DATE`
  • `TRY_STRPTIME` returns NULL on failure (safe)
  • Never `CAST(date_str AS DATE)` on non-ISO strings

QUALIFY Clause

Filter window function results without a subquery:

SELECT *, ROW_NUMBER() OVER (PARTITION BY group ORDER BY col DESC) AS rn
FROM table
QUALIFY rn <= 10

Date Spines

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.

Type Casting

`CAST(x AS INTEGER)`, `CAST(x AS DOUBLE)`, `CAST(x AS VARCHAR)`, `CAST(x AS DATE)` `TRY_CAST` returns NULL on failure.

Read more
@signalpilot-labs
Ships withsignalpilot
48928 skills2 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
489
Star history of signalpilot-labs/signalpilot on GitHub, a chart by star-history.com

Other skills on signalpilot.

dbt-testing

dbt-testing

Load when task involves adding, writing, or fixing dbt unit tests. Covers unit_tests YAML format, given/expect blocks, edge-case…

More skills from other plugins.

paddleocr-doc-parsing

paddleocr-doc-parsing

Use this skill to extract structured Markdown/JSON from PDFs and document images—tables with cell-level precision, formulas as…

paddleocr2mo93k
@paddlepaddle@paddlepaddleInstall Skill
context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,…

mem02w69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and an…

posthog3w41k
@posthog@posthogInstall Skill

Questions about duckdb-sql.

Which coding agents can use duckdb-sql?
duckdb-sql installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.