agentleFS
srimon12srimon12/duckdb-2-skills/skills/duckdb/SKILL.md

duckdb

Skill1 starsChanged 15 days agoMITView on GitHub

Gate the DuckDB 2.0 CLI binary, select agent output modes, evaluate result trust, and route to specialized skills. Use when the user mentions DuckDB, a .duckdb file, or the duckdb CLI.

  • Pipes a download into a shell

13 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. 0 are common, 6 are distinctive, and 11 are very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before running DuckDB commands, verify the binary version:

    line 15
  2. Very specific:

    If stdout does not contain v2.0, stop.

    line 21
  3. Distinctive:

    If DuckDB 2.0 is missing or outdated, install it:

    line 23
  4. Very specific:

    When passing any output flag (-json, -csv, -box), DuckDB disables automatic agent mode.

    line 40
  5. Very specific:

    When combining -agent with -json or -csv, DuckDB preserves JSON errors and banners on stderr, but omits the 1,000-row, 10,000-byte, and …

    line 42
  6. Very specific:

    Always read stderr. Agent mode directs its startup banner, JSON errors, cost estimates, and execution progress there.

    line 44
  7. Distinctive:

    Before trusting output, check the exit code first, stderr second, and the result footer third.

    line 48
  8. Very specific:

    When verifying result determinism, rerun with a different ORDER BY.

    line 59
  9. Very specific:

    When launching duckdb -ui, DuckDB auto-installs the ui extension on initial run.

    line 63
  10. Very specific:

    Every duckdb process starts with an isolated in-memory database and executes ~/.duckdbrc unless -no-init is passed.

    line 67
  11. Very specific:

    When passing -init FILE, DuckDB replaces ~/.duckdbrc.

    line 79
  12. Very specific:

    When combining a dot command with SQL statements, use -cmd or a heredoc.

    line 81
  13. Very specific:

    If stderr prints an estimate: line scanning 1,000,000 or more rows, request user confirmation before running an unbounded query.

    line 91
  14. Distinctive:

    When DuckDB 2.0 creates a new database file under default settings, it writes storage version 69.

    line 95
  15. Very specific:

    When configuring a Model Context Protocol client or server, consult references/mcp.md.

    line 116
  16. Distinctive:

    When an error names a specific feature or symptom, route to the owning skill:

    line 118
  17. Distinctive:

    Run verification commands to confirm CLI version and agent framing:

    line 131

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

DuckDB 2.0

Target DuckDB 2.0.0 LTS and newer 2.0 patch releases.

Gate the binary

Before running DuckDB commands, verify the binary version:

duckdb -no-agent --version

If stdout does not contain v2.0, stop. DuckDB 1.x is unsupported. When piping version output, pass -no-agent because stderr banner pollution invalidates 2>&1 | head -1.

If DuckDB 2.0 is missing or outdated, install it:

curl -fsSL https://install.duckdb.org | sh

The installer places the binary in ~/.duckdb/cli/<version>/, points ~/.duckdb/cli/latest at it, and links ~/.local/bin/duckdb when that directory exists without an existing duckdb binary. If using Homebrew, check the version immediately because Homebrew packages can lag releases. If a 2.0 binary resides outside PATH, invoke it by its absolute path.

Choose the output mode

ConsumerCommandOutput characteristics
Model reads tableduckdb -agent -c "..."Compact Markdown, JSON errors on stderr, row/byte/cell caps, result hash
Script parses rowsduckdb -json -c "..."One JSON array on stdout, text errors on stderr
Human reads terminalduckdb -box -c "..."Unicode box table
Human explores visuallyduckdb -uiBrowser UI served at localhost:4213

When passing any output flag (-json, -csv, -box), DuckDB disables automatic agent mode. To preserve agent framing (stderr JSON errors and banner) with another renderer, pass -agent explicitly (for example, duckdb -agent -json).

When combining -agent with -json or -csv, DuckDB preserves JSON errors and banners on stderr, but omits the 1,000-row, 10,000-byte, and 500-character cell caps. When results can be large, add LIMIT for an intentional sample or use an aggregate for a complete count.

Always read stderr. Agent mode directs its startup banner, JSON errors, cost estimates, and execution progress there. When the footer reads first X and last Y of N rows, the terminal display is truncated; the underlying query returned N rows and the result hash covers all N rows.

Result trust

Before trusting output, check the exit code first, stderr second, and the result footer third.

SignalMeaningAction
Exit 0, empty stderr, N rows, hash ...Complete query resultAccept output. If the query specifies LIMIT, do not treat as dataset total.
Exit 0, empty stderr, no footer, 1 to 9 rowsComplete query result (hash omitted)Accept output.
first X and last Y of N rowsDisplay truncated; query returned N rowsPass .maxrows -1 to inspect all rows, or use an aggregate for dataset total.
first X of at least N rows or query stopped earlyIncomplete lower boundStop and bound the query with selective filters.
Exit 1 with stderr JSON errorQuery execution failedRead the stderr JSON error. Do not parse stdout.
Exit 1 with header-only stdout, no JSON errorProcess interrupted (SIGINT or timeout)Rerun with bounded work or a higher timeout.

When verifying result determinism, rerun with a different ORDER BY; the result hash is order-independent. Never treat a LIMIT query result as complete for the underlying dataset.

Before parsing -json output, check the exit code and stderr; on failure, -json can emit an unclosed [ on stdout. When executing multiple statements under -json, DuckDB emits one JSON array per statement rather than a single document. Note that NaN and Infinity emit as bare tokens, violating strict JSON. When running EXPLAIN ANALYZE, DuckDB prints a formatted profile text block, ignoring -json.

When launching duckdb -ui, DuckDB auto-installs the ui extension on initial run. If installation fails, note that extension builds can lag releases and lack 2.0.0 binaries for osx_amd64 or windows_arm64 (see references/cli.md).

Run SQL

Every duckdb process starts with an isolated in-memory database and executes ~/.duckdbrc unless -no-init is passed. When session state must persist across invocations, use duckdb-session.

duckdb -agent -c "SELECT 42 AS answer;"
duckdb -agent <<'SQL'
.maxrows 50
SELECT 42 AS answer;
SQL
duckdb -f query.sql
duckdb -init .duckdb/state.sql -agent -c "SHOW TABLES;"

When passing -init FILE, DuckDB replaces ~/.duckdbrc. When passing -no-init, DuckDB skips all initialization files.

When combining a dot command with SQL statements, use -cmd or a heredoc; a single -c string cannot mix both. When passing -cmd COMMAND, DuckDB executes it at its positional argument index, even following the last -c or a completed -f.

When running -f FILE, execution halts at the first error by default; stdin input continues past errors. When passing -readonly, DuckDB denies write access to the opened database, unless overridden by an explicit ATTACH ... (READ_WRITE). When passing -safe, DuckDB disables external file access and locks configuration before -init runs, while still opening any database file specified on the command line.

To bound query duration, configure max_execution_time in milliseconds (0 disables timeout):

SET max_execution_time = 30000;

If stderr prints an estimate: line scanning 1,000,000 or more rows, request user confirmation before running an unbounded query.

Storage compatibility

When DuckDB 2.0 creates a new database file under default settings, it writes storage version 69. DuckDB 1.x cannot open version 69 files. DuckDB 2.0 reads legacy 1.x files and preserves their existing storage version across writes. Before creating a file destined for older clients, consult duckdb-migrate.

Route

TaskSkill
Write or run SQL, lambdas, triggers, nested schemasduckdb-sql
Diagnose a slow query, plan, spill, or Parquet layoutduckdb-profile
Attach a database and keep it across callsduckdb-session
Read, convert, or batch-ingest a file, or query object storageduckdb-files
VARIANT or semi-structured columnsduckdb-variant
Full-text search, BM25, HNSW, or vector searchduckdb-search
dbt v2 project, profile, or dbt-duckdb migrationduckdb-dbt
Serve a database, CONNECT, Postgres or MySQL pushdownduckdb-quack
DuckLake, Iceberg, Deltaduckdb-lakehouse
Install or update extensionsduckdb-extensions
Search the 2.0 manualduckdb-docs
Move a 1.x deployment to 2.0duckdb-migrate
Python client codeduckdb-python
Geodata, distances, Overtureduckdb-spatial

When configuring a Model Context Protocol client or server, consult references/mcp.md. The duckdb_mcp community extension targets 2.0; the MotherDuck local server pins 1.5.6.

When an error names a specific feature or symptom, route to the owning skill:

SymptomSkill or action
Deprecated lambda arrow, Division by zero, nested schema, BEFORE ... FOR EACH ROWduckdb-sql
sqlite_master does not exist, read_csv on a Parquet file, a secret validation failureduckdb-files
Trying to read a database file with version number 69duckdb-migrate
Extension ... not found, no update availableduckdb-extensions
Out of Memory Error, actual rows dwarfing estimate, Row Groups Scanned near the totalduckdb-profile
Output is box drawing under an agentCheck ~/.duckdbrc; rerun with -no-init

Verify

Run verification commands to confirm CLI version and agent framing:

duckdb -no-agent --version
duckdb -agent -c "SELECT 42 AS answer;"
duckdb -json -c "SELECT 42 AS answer;"

The version check must print v2.0 on stdout. The agent query must render a compact Markdown table. The JSON query must emit [{"answer":42}].

References

  • Command line client owns the CLI surface.
  • Agent mode owns output limits and stderr splitting.
  • Command line arguments owns the flag list.
  • Output formats owns the renderer list.
  • Migration guide owns the storage break.
  • Install owns platform install commands.
  • The complete flag, dot command, and setting tables are in references/cli.md.
  • MCP configuration and security controls are in references/mcp.md.
  • Release verified against DuckDB 2.0.0 d54cbbe3df. Agent limits and JSON error splitting validated locally.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.