Runs SQL queries against DuckDB databases, either in session mode with attached databases or ad-hoc against files. It handles natural language questions by generating SQL using DuckDB's Friendly SQL idioms like FROM-first syntax, GROUP BY ALL, and direct file queries. The skill estimates result sizes before execution to avoid token-heavy outputs and warns you if you're about to pull back millions of rows without a LIMIT. It sandboxes ad-hoc queries with restricted file access and falls back gracefully when databases aren't accessible. Error handling is solid, automatically installing missing extensions and searching docs when things break. If you're already using DuckDB for data work, this gives you a conversational layer that knows the shortcuts.

skills.sh installs
1.6K
GitHub stars
616
last updated
Aug 21, 2026

Install

$ npx -y skills add duckdb/duckdb-skills --skill query --agent claude-code

Installs into .claude/skills of the current project.

Files

You are helping the user query data using DuckDB.

Input: $@

Follow these steps in order.

Step 1 — Resolve state and determine the mode

Look for an existing state file in either location:

STATE_DIR=""
test -f .duckdb-skills/state.sql && STATE_DIR=".duckdb-skills"
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")"
PROJECT_ID="$(echo "$PROJECT_ROOT" | tr '/' '-')"
test -f "$HOME/.duckdb-skills/$PROJECT_ID/state.sql" && STATE_DIR="$HOME/.duckdb-skills/$PROJECT_ID"

If found, verify the databases it references are still accessible:

duckdb -init "$STATE_DIR/state.sql" -c "SHOW DATABASES;"

Now determine the mode:

  • Ad-hoc mode if: the --file flag is present, or the SQL references file paths/literals (e.g. FROM 'data.csv'), or STATE_DIR is empty.
  • Session mode if: STATE_DIR is set and the input references table names, is natural language, or is SQL without file references.

If no state file exists and no file is referenced, fall back to ad-hoc mode against :memory: — the user must reference files directly in their SQL.

Sponsors

Details

Repository
github.com/duckdb/duckdb-skills
Categories
Backend & APIs, Databases
First seen
Jun 3, 2026

More from duckdb/duckdb-skills

All 6
1mapbox avatarmapbox-mcp-devkit-patternsmapbox/mapbox-agent-skillsIntegration patterns for Mapbox MCP DevKit Server in AI coding assistants. Covers setup, style management, token management, validation workflows, and documenta1.6Kskills.sh installs
2alirezarezvani avatarsenior-architectalirezarezvani/claude-skillsThis skill should be used when the user asks to "design system architecture", "evaluate microservices vs monolith", "create architecture diagrams", "analyze dep1.5Kskills.sh installs
3daymade avataryoutube-downloaderdaymade/claude-code-skillsDownload YouTube videos and HLS streams (m3u8) from platforms like Mux, Vimeo, etc. using yt-dlp and ffmpeg. Use this skill when users request downloading video1.5Kskills.sh installs
4loops-so avatarloops-email-sending-best-practicesloops-so/skillsUse this skill when the user wants to review, audit, improve, or plan email sending best practices. This includes deliverability, inbox placement, sender reputa1.5Kskills.sh installs
5medusajs avatarmcloud-logsmedusajs/medusa-agent-skillsExecute mcloud logs to fetch and stream runtime logs for Cloud environments. Use when reading backend or storefront logs, filtering by time range, searching for1.5Kskills.sh installs
6nexscope-ai avataretsy-seonexscope-ai/ecommerce-skillsEtsy SEO analyzer and optimizer. Improve search visibility with title optimization, tag analysis, description scoring, and keyword research. Includes SEO scorin1.5Kskills.sh installs