/better-duck-skills:duckdbfrom better-duck-skills
Provides DuckDB engine knowledge for Rust developers using the better-duck driver: SQL dialect, type system with driver value mappings, extensions (json, parquet, icu, spatial), and runtime behaviors (transactions, appender semantics, parameters, replacement scans).
Ships in better-duck-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
DuckDB is an in-process OLAP SQL engine. better-duck embeds it and talks to its C API. This skill
covers the engine behaviors that matter when you drive it from Rust; for the Rust API itself see the
better-duck-core skill.
QUALIFY, GROUP BY ALL, SELECT * EXCLUDE (col),
SELECT * REPLACE (expr AS col), COLUMNS(...), list/struct/map literals, UNNEST, window
functions, PIVOT/UNPIVOT.CAST(x AS t) or x::t. TRY_CAST yields NULL instead of erroring.$1, $2, … or ?; named $name. better-duck binds positional with
execute_with and named with execute_with_named.execute_batch runs multiple ;-separated statements; a single execute
prepares one statement. DDL and INSERT/UPDATE/DELETE report a changed-row count; SELECT
and RETURNING yield rows.FROM resolve to a registered source (e.g. an
Arrow/Polars view, or a Rust replacement scan) — how query_polars/register_arrow surface data.DuckDB values arrive as better_duck_core::types::value::DuckValue. Core mappings:
| DuckDB type | DuckValue / Rust | Notes |
|---|---|---|
| BOOLEAN | Boolean / bool | |
| TINYINT…BIGINT | TinyInt/SmallInt/Int/BigInt (i8..i64) | |
| UTINYINT…UBIGINT | UTinyInt..UBigInt (u8..u64) | |
| HUGEINT / UHUGEINT | HugeInt(i128) / UHugeInt(u128) | 128-bit via DuckDB hugeint |
| FLOAT / DOUBLE | Float(f32) / Double(f64) | |
| DECIMAL(w,s) | rust_decimal::Decimal | feature decimal; preserves width/scale |
| VARCHAR | Text(String) | |
| BLOB / BIT | Blob / bit types | |
| DATE/TIME/TIMESTAMP[TZ]/INTERVAL | chrono types | feature chrono (or time feature) |
| UUID | uuid::Uuid | feature uuid |
| LIST / ARRAY / STRUCT / MAP / UNION / ENUM | nested DuckValue / derives | see better-duck-macros for DuckEnum/DuckStruct |
| NULL | DuckValue::Null | validity tracked per row/vector |
TableDescription (core) reads a table's column names, types, and DEFAULT flags without a query.
The lossless TypeInfo descriptor preserves DECIMAL width/scale, ENUM dictionaries, and nesting.
NULL is first-class: a value is DuckValue::Null, and in columnar access a column carries a validity
bitmask (see better-duck-core's columnar skill — VectorRef::validity, VectorMut::set_null /
set_row_valid). TRY_CAST and Option<T> parameters/returns propagate NULL explicitly.
json, parquet, icu (timezones/collations). These
compile the extension into the static library — no runtime INSTALL/LOAD.INSTALL/LOAD), e.g. spatial for geometry.#[duckdb_entrypoint] (feature loadable-extension,
experimental) — see better-duck-macros.DuckDB has no dedicated C-API transaction entry point; better-duck drives BEGIN/COMMIT/ROLLBACK
via SQL. Savepoints (SAVEPOINT/RELEASE/ROLLBACK TO) are not supported. Use core's
Connection::transaction (closure, commits on Ok, rolls back on Err/panic) or begin_transaction
(RAII guard). See better-duck-core.
The Appender is the fast bulk-insert path (duckdb_appender_*). It buffers rows and flushes on
save()/finish(); a failed append/flush invalidates the appender (then only error + destroy are
legal). Column defaults can be filled with append_default_row / set_chunk_default. Details in the
better-duck-core skill's appender/columnar references.
better-duck surfaces DuckDB's typed error classification as Error::Engine(EngineError { kind, message }),
where kind mirrors duckdb_error_type. A failed prepare/query carries DuckDB's own message.
When a query "returns results" from execute where you expected a changed-row count (or vice versa),
check the statement type — SELECT/RETURNING vs DML.
DuckDB ships an every-other-version LTS cadence from 1.4 (1.4 LTS, 1.5 current, …). The C API is
specified in api_spec/ YAML upstream with per-function lifecycle (stable/deprecated/unstable) +
since-version. better-duck pins a vendored DuckDB in better-duck-sys.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub nimdeveloper/better-duck --plugin better-duck-skills6 skills in this plugin
/better-duckOverview and task router for the better-duck DuckDB driver for Rust. Use when working with the better-duck / better-duck-core / better-duck-macros / better-duck-diesel / better-duck-tauri crates, when choosing a Cargo feature flag, or when deciding which API or crate fits a task (opening a connection, querying, parameter binding, bulk insert, columnar access, user-defined functions, Diesel ORM, or a Tauri plugin). Routes to the per-crate skills for depth./better-duck-coreRust API guide for the better-duck-core crate (the embedded DuckDB driver published as better-duck): opening connections, executing SQL, iterating rows and values, parameter binding, bulk insert, columnar chunks, transactions, pooling, async, and Arrow/Polars interop. Use when writing Rust against better-duck-core — Connection, execute, execute_with, execute_with_named, DuckResult / DuckValue, Appender, fetch_chunk, TableDescription, Database — or when choosing a Cargo flag feature = "chrono|decimal|arrow|polars|columnar|udf|async|pool|time|uuid" (plus json / parquet / icu for bundled extensions, and derive). For DuckDB SQL and engine behavior use the duckdb skill; for the UDF and data-derive macros use better-duck-macros./better-duck-dieselThe Diesel 2.3 ORM backend for DuckDB, built on better-duck. Use when working with the `better-duck-diesel` crate: establishing a `DuckDbConnection`, defining a `table!` schema, running INSERT/SELECT/UPDATE/DELETE/RETURNING or transactions through Diesel, mapping Rust types to DuckDB column types, or reaching DuckDB-only SQL that Diesel core omits via `use better_duck_diesel::dsl::*;` (ILIKE/SIMILAR TO/GLOB/regex operators; string, numeric, regex, date/time, JSON, list and map functions; general/statistical/approximate/bit aggregates). Also covers calling your `#[duckdb_*]` UDFs through the DSL with no raw SQL (`feature = "udf"`), spatial `ST_*` functions (`feature = "spatial"`), ORM-emitting data derives (`feature = "derive"`), and r2d2 pooling. Triggers: `better-duck-diesel`, Diesel + DuckDB, `DuckDbConnection`, `better_duck_diesel::dsl`, `feature = "udf"|"derive"|"spatial"`./better-duck-macrosProc-macro surface of the better-duck-macros crate — DuckDB user-defined functions and data derives — consumed through better-duck-core's `feature = "udf"` and `feature = "derive"` (and better-duck-diesel's `derive`), never by depending on better-duck-macros directly. Use when writing or registering a UDF with `#[duckdb_scalar]`, `#[duckdb_table_function]`, `#[duckdb_aggregate]`, `#[duckdb_cast]`, or `#[duckdb_entrypoint]`; when mapping Rust types with `#[derive(FromRow|ToRow|DuckEnum|DuckStruct)]`; when reaching for the `transaction!` / `params!` helper macros; or when choosing/debugging their attribute options (`name`, `columns`, `named_params`, `projection_pushdown`, `state`, `volatile`, `rename_all`)./better-duck-tauriThe better-duck-tauri crate: a Tauri v2 plugin that exposes better-duck (embedded DuckDB) to the webview as a local analytics engine. Use when registering the plugin in `tauri::Builder`, choosing a backend Cargo feature (`feature = "backend-core"` default, `feature = "backend-diesel"`, or `feature = "arrow"`), calling the webview commands (`load`/`close`/`select`/`execute`, plus import/export/append/stream/checkpoint/revert) from JS/TS via `@better-duck/tauri`, wiring Tauri capabilities/permissions and the scope + policy security model, defining startup migrations, or configuring WAL checkpoint strategies. Triggers: "Tauri", "webview", the crate name, the command names, or the backend/arrow feature flags.