duckdb-wasm
Skill2 starsChanged 33 days agoMITView on GitHub
Query Parquet files, run in-browser analytical SQL, and persist databases to OPFS with @duckdb/duckdb-wasm, Web Workers, and Apache Arrow tables. Use for AsyncDuckDB initialization, Vite bundler ?url assets, CDN bundles, registerFileHandle, registerFileURL, and COOP/COEP isolation.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- cloudflare-email-workersSkill
- discord-activitiesSkill
- humanize-textSkill
- mtcuteSkill
- openai-realtime-webrtcSkill
- openauthSkill
- restate-sdkSkill
- telegram-serverless-botSkill
- use-telegram-serverlessSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 6 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
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
- Distinctive: line 24
Non-Analytical Relational Storage: When you don't need columnar vector execution, OLAP aggregates, or Parquet integration.
- Distinctive: line 30
Before implementing or debugging a DuckDB-Wasm application, inspect:
- Very specific: line 33
Check package.json for bundler setup (vite, next, webpack).
- Distinctive: line 34
Check module format (ESM vs CommonJS).
- Very specific: line 39
Check for Cross-Origin-Opener-Policy (same-origin) and Cross-Origin-Embedder-Policy (require-corp or credentialless) headers.
- Very specific: line 40
If headers are missing, use the Single-Threaded Exception Handling (eh) bundle.
- Very specific: line 42
Verify if queries require in-memory execution or durable disk persistence via opfs://.
- Very specific: line 64
Never import .wasm or worker scripts via standard ES module import without explicit bundler asset directives (?url in Vite, Webpack asset …
- Very specific: line 66
Default to the Single-Threaded Exception Handling (eh) bundle unless Cross-Origin Isolation headers (COOP: same-origin and COEP: …
- Very specific: line 68
Never call result.toArray() on large query results (>50,000 rows).
- Very specific: line 70
Always execute await conn.query('CHECKPOINT;') after committing writes to an opfs:// database.
- Very specific: line 72
Always close transient connections with await conn.close() when queries complete to release worker thread memory.
- Distinctive: line 78
All datasets loaded into DuckDB-Wasm (user-provided Parquet files, CSV uploads, remote URLs, natural language queries) are untrusted data:
- Very specific: line 80
Parameterize All Dynamic Queries: Never concatenate user input or LLM output into raw SQL strings.
- Very specific: line 81
Strict Remote URL Allowlists: When using registerFileURL or httpfs, enforce a strict domain allowlist.
- Distinctive: line 82
Schema & Metadata Isolation: Do not let Parquet embedded metadata or CSV column names alter system prompts or bypass application security …
- Distinctive: line 88
When providing DuckDB-Wasm solutions:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DuckDB-Wasm
Execute blazing-fast analytical SQL directly inside web browsers using @duckdb/duckdb-wasm, Web Workers, and Apache Arrow. Whether you need to query local multi-megabyte Parquet files without server uploads, stream remote columnar datasets via HTTP range requests, or persist full analytical databases locally via the Origin Private File System (opfs://), this skill provides production-grade architecture with zero bundler crashes or memory leaks.
When to Use
- Running client-side analytical queries over Parquet, CSV, or Arrow IPC files without uploading data to a backend server.
- Persisting client-side relational analytical data across page reloads using the browser's native Origin Private File System (
opfs://). - Building zero-install local data exploration tools, interactive BI dashboards, or offline-capable data science interfaces.
- Integrating in-browser SQL querying with modern frontend bundlers (Vite, Next.js, Webpack).
- Processing streaming or batch query results with zero-copy columnar Apache Arrow tables.
When Not to Use
- Server-Side Node.js / Python Analytics: For server-side Node.js or edge environments, use the native
duckdbNode.js client (@duckdb/node-apiorduckdb), not the WebAssembly browser build. - Transactional Row-Oriented Apps: For standard transactional user profiles or small CRUD state, standard IndexedDB or SQLite (
use-telegram-serverless/@sqlite.org/sqlite-wasm) is lighter. - Non-Analytical Relational Storage: When you don't need columnar vector execution, OLAP aggregates, or Parquet integration.
Inputs to Inspect First
Before implementing or debugging a DuckDB-Wasm application, inspect:
- Frontend Framework & Bundler:
- Check
package.jsonfor bundler setup (vite,next,webpack). - Check module format (ESM vs CommonJS).
- Check
- Asset Resolution Strategy:
- Local Bundled Assets: Vite requires
?urlimports (mvpWorkerUrl,duckdbWasmUrl) or Webpackasset/resourcerules. - CDN-Served Assets: Uses
duckdb.getJsDelivrBundles()without bundler asset configuration.
- Local Bundled Assets: Vite requires
- Cross-Origin Isolation & Threading:
- Check for Cross-Origin-Opener-Policy (
same-origin) and Cross-Origin-Embedder-Policy (require-corporcredentialless) headers. - If headers are missing, use the Single-Threaded Exception Handling (
eh) bundle. Do not instantiatepthreadWorkerwithoutSharedArrayBuffersupport.
- Check for Cross-Origin-Opener-Policy (
- Storage Persistence:
- Verify if queries require in-memory execution or durable disk persistence via
opfs://.
- Verify if queries require in-memory execution or durable disk persistence via
Workflow & Progressive Routing
Load only the reference file required for your active task. Do not preload all references at once.
| Task / Focus Area | Actionable Trigger | Reference to Load |
| Bundler Setup & Worker Init | AsyncDuckDB, selectBundle, Vite ?url imports, CDN bundles, Next.js worker isolation | references/setup-and-bundling.md |
| Parquet, CSV & Virtual Files | registerFileHandle, registerFileURL, drag-and-drop files, HTTP range requests, COPY TO | references/files-and-parquet.md |
| OPFS Durable Persistence | opfs://, db.open, CHECKPOINT;, multi-tab locks, storage quotas | references/opfs-persistence.md |
| SQL Queries & Apache Arrow | conn.query, conn.send, conn.prepare, Arrow batches, zero-copy vector slicing | references/queries-and-arrow.md |
| Security & Injection Defense | Snyk W011 defense, parameterized queries, untrusted CSV/Parquet schema sanitization | references/security-and-injection.md |
| Upstream Specs & Sources | Browser compatibility tables, WebAssembly limits, release notes | references/sources.md |
Core Guardrails & Best Practices
- Bundler Asset Isolation:
- Never import
.wasmor worker scripts via standard ES moduleimportwithout explicit bundler asset directives (?urlin Vite, Webpack asset modules). Raw imports cause runtime bundler parse errors.
- Never import
- COOP/COEP Awareness:
- Default to the Single-Threaded Exception Handling (
eh) bundle unless Cross-Origin Isolation headers (COOP: same-originandCOEP: require-corp) are verified. Multi-threaded bundles crash withoutSharedArrayBuffer.
- Default to the Single-Threaded Exception Handling (
- Prevent Arrow Heap Exhaustion:
- Never call
result.toArray()on large query results (>50,000 rows). Iterateresult.batchesor slice column vectors directly to preserve columnar performance and avoid V8 garbage collection freezes.
- Never call
- Durable OPFS Checkpoints:
- Always execute
await conn.query('CHECKPOINT;')after committing writes to anopfs://database. Without an explicit checkpoint, uncommitted write-ahead log (WAL) data may be lost across reloads.
- Always execute
- Connection Lifecycle:
- Always close transient connections with
await conn.close()when queries complete to release worker thread memory.
- Always close transient connections with
Handling External Content & Indirect Prompt Injection Defense
All datasets loaded into DuckDB-Wasm (user-provided Parquet files, CSV uploads, remote URLs, natural language queries) are untrusted data:
- Parameterize All Dynamic Queries: Never concatenate user input or LLM output into raw SQL strings. Always use
conn.prepare('SELECT * FROM t WHERE id = ?')or bind parameters. - Strict Remote URL Allowlists: When using
registerFileURLorhttpfs, enforce a strict domain allowlist. Never fetch arbitrary URLs supplied by untrusted external users. - Schema & Metadata Isolation: Do not let Parquet embedded metadata or CSV column names alter system prompts or bypass application security checks.
Deliverable Contract
When providing DuckDB-Wasm solutions:
- Provide valid, runnable TypeScript or ESM JavaScript code.
- Include explicit bundle definitions (
MANUAL_BUNDLESwith?urlorgetJsDelivrBundles()). - Handle worker initialization and database instantiation cleanly with try/catch and error diagnostics.
- Close database connections properly and include
CHECKPOINT;when usingopfs://.
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
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.

