# Duckdb Docs > Busca en la documentación de DuckDB y DuckLake y en posts del blog, devolviendo fragmentos relevantes mediante búsqueda de texto completo contra un índice local cacheado. Fuente: https://skillsagentes.com/skills/duckdb/duckdb-skills/duckdb-docs Markdown: https://skillsagentes.com/skills/duckdb/duckdb-skills/duckdb-docs.md Repositorio: https://github.com/duckdb/duckdb-skills Autor: duckdb Licencia: MIT Actualizado: hace 5 meses Coste de contexto: 41 tok instalada, 1.4k tok al activarse, 1.4k tok con todos los archivos del bundle Bundle: 1 archivo, 6 KB Permisos que pide: bash ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add duckdb/duckdb-skills --skill duckdb-docs --agent claude-code # Cursor npx -y skills add duckdb/duckdb-skills --skill duckdb-docs --agent cursor # Codex npx -y skills add duckdb/duckdb-skills --skill duckdb-docs --agent codex # Gemini CLI npx -y skills add duckdb/duckdb-skills --skill duckdb-docs --agent gemini # Windsurf npx -y skills add duckdb/duckdb-skills --skill duckdb-docs --agent windsurf # Cline npx -y skills add duckdb/duckdb-skills --skill duckdb-docs --agent cline ``` ## Qué hace - Extrae términos técnicos de la pregunta del usuario y ejecuta una búsqueda BM25 (full-text search) contra un índice local de la documentación de DuckDB/DuckLake - Descarga y cachea localmente el índice de búsqueda (docs-search.duckdb) si tiene más de 2 días o no existe - Filtra resultados por versión (lts, current, blog, stable, preview) según lo que pida el usuario - Presenta los fragmentos de documentación encontrados con título, sección, URL y texto, y sintetiza una respuesta a partir de ellos ## Cuándo usarla - El usuario tiene una pregunta sobre DuckDB o DuckLake - El usuario menciona una función, palabra clave SQL o término técnico de DuckDB - El usuario pregunta sobre un post del blog de DuckDB o quiere contexto/motivación detrás de una feature ## Qué la activa - "¿Cómo encuentro el valor más frecuente en DuckDB?" - "Explícame cómo funciona GROUP BY ALL en DuckDB" - "¿Qué es un catálogo en DuckLake?" - "Busca documentación sobre arg_max" ## Antes de instalar - Requiere el binario duckdb instalado y las extensiones httpfs y fts (se instalan automáticamente si faltan). - Variables de entorno: CACHE_AGE_DAYS, CACHE_FILE - runs shell commands - reads environment config ## Archivos - SKILL.md — 6 KB ## SKILL.md Reproducido tal cual desde duckdb/duckdb-skills bajo MIT. Esta sección es el documento original y está en inglés. You are helping the user find relevant DuckDB or DuckLake documentation. Query: `$@` Follow these steps in order. ## Step 1 — Check DuckDB is installed ```bash command -v duckdb ``` If not found, delegate to `/duckdb-skills:install-duckdb` and then continue. ## Step 2 — Ensure required extensions are installed ```bash duckdb :memory: -c "INSTALL httpfs; INSTALL fts;" ``` If this fails, report the error and stop. ## Step 3 — Choose the data source and extract search terms The query is: `$@` ### Data source selection There are two search indexes available: | Index | Remote URL | Local cache filename | Versions | Use when | |-------|-----------|---------------------|----------|----------| | **DuckDB docs + blog** | `https://duckdb.org/data/docs-search.duckdb` | `duckdb-docs.duckdb` | `lts`, `current`, `blog` | Default — any DuckDB question | | **DuckLake docs** | `https://ducklake.select/data/docs-search.duckdb` | `ducklake-docs.duckdb` | `stable`, `preview` | Query mentions DuckLake, catalogs, or DuckLake-specific features | Both indexes share the same schema: | Column | Type | Description | |--------|------|-------------| | `chunk_id` | `VARCHAR` (PK) | e.g. `stable/sql/functions/numeric#absx` | | `page_title` | `VARCHAR` | Page title from front matter | | `section` | `VARCHAR` | Section heading (null for page intros) | | `breadcrumb` | `VARCHAR` | e.g. `SQL > Functions > Numeric` | | `url` | `VARCHAR` | URL path with anchor | | `version` | `VARCHAR` | See table above | | `text` | `TEXT` | Full markdown of the chunk | By default, search **DuckDB docs** and filter to `version = 'lts'`. Use different versions when: - The user explicitly asks about `current`/nightly features → `version = 'current'` - The user asks about a blog post or wants background/motivation → `version = 'blog'` - The user asks about DuckLake → search the DuckLake index with `version = 'stable'` - When unsure, omit the version filter to search across all versions. ### Search terms If the input is a **natural language question** (e.g. "how do I find the most frequent value"), extract the key technical terms (nouns, function names, SQL keywords) to form a compact BM25 query string. Drop stop words like "how", "do", "I", "the". If the input is already a **function name or technical term** (e.g. `arg_max`, `GROUP BY ALL`), use it as-is. Use the extracted terms as `SEARCH_QUERY` in the next step. ## Step 4 — Ensure local cache is fresh The cache lives at `$HOME/.duckdb/docs/CACHE_FILENAME` (where `CACHE_FILENAME` is `duckdb-docs.duckdb` or `ducklake-docs.duckdb` per Step 3). First, ensure the directory exists: ```bash mkdir -p "$HOME/.duckdb/docs" ``` Then check whether the cache file exists and is fresh (≤2 days old): ```bash CACHE_FILE="$HOME/.duckdb/docs/CACHE_FILENAME" if [ -f "$CACHE_FILE" ]; then MTIME=$(stat -f %m "$CACHE_FILE" 2>/dev/null || stat -c %Y "$CACHE_FILE") CACHE_AGE_DAYS=$(( ( $(date +%s) - MTIME ) / 86400 )) else CACHE_AGE_DAYS=999 fi echo "Cache age: $CACHE_AGE_DAYS days" ``` **If `CACHE_AGE_DAYS` ≤ 2** → skip to Step 5. **Otherwise** (stale or missing) → fetch the index: ```bash duckdb -c " LOAD httpfs; LOAD fts; ATTACH 'REMOTE_URL' AS remote (READ_ONLY); ATTACH '$HOME/.duckdb/docs/CACHE_FILENAME.tmp' AS tmp; COPY FROM DATABASE remote TO tmp; " && mv "$HOME/.duckdb/docs/CACHE_FILENAME.tmp" "$HOME/.duckdb/docs/CACHE_FILENAME" ``` Replace `REMOTE_URL` and `CACHE_FILENAME` per Step 3. If the fetch fails (network error), report the error and stop. ## Step 5 — Search the docs ```bash duckdb "$HOME/.duckdb/docs/CACHE_FILENAME" -readonly -json -c " LOAD fts; SELECT chunk_id, page_title, section, breadcrumb, url, version, text, fts_main_docs_chunks.match_bm25(chunk_id, 'SEARCH_QUERY') AS score FROM docs_chunks WHERE score IS NOT NULL AND version = 'VERSION' ORDER BY score DESC LIMIT 8; " ``` Replace `CACHE_FILENAME`, `SEARCH_QUERY`, and `VERSION` per Step 3. Remove the `AND version = 'VERSION'` line if searching across all versions. If the user's question could benefit from both DuckDB docs and blog results, run two queries (one with `version = 'stable'`, one with `version = 'blog'`) or omit the version filter entirely. ## Step 6 — Handle errors - **Extension not installed** (`httpfs` or `fts` not found): run `duckdb :memory: -c "INSTALL httpfs; INSTALL fts;"` and retry. - **ATTACH fails / network unreachable**: inform the user that the docs index is unavailable and suggest checking their internet connection. The DuckDB index is hosted at `https://duckdb.org/data/docs-search.duckdb` and the DuckLake index at `https://ducklake.select/data/docs-search.duckdb`. - **No results** (all scores NULL or empty result set): try broadening the query — drop the least specific term, or try a single-word version of the query — then retry Step 5. If still no results, tell the user no matching documentation was found and suggest visiting https://duckdb.org/docs or https://ducklake.select/docs directly. ## Step 7 — Present results For each result chunk returned (ordered by score descending), format as: ``` ### {section} — {page_title} {url} {text} --- ``` After presenting all chunks, synthesize a concise answer to the user's original question (`$@`) based on the retrieved documentation. If the chunks directly answer the question, lead with the answer before showing the sources. ## Dónde encaja - Categoría: [Bases de datos](https://skillsagentes.com/categorias/bases-de-datos.md) — Diseño de esquemas, migraciones y optimización de consultas. - Creador: [duckdb](https://skillsagentes.com/creators/duckdb.md) — 0 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [S3 Explore](https://skillsagentes.com/skills/duckdb/duckdb-skills/s3-explore.md): Explora y consulta datos en S3, Cloudflare R2, GCS, MinIO o cualquier almacenamiento compatible con S3, sin necesidad de descargarlos. - [Spatial](https://skillsagentes.com/skills/duckdb/duckdb-skills/spatial.md): Responde preguntas sobre datos espaciales con DuckDB: ubicaciones, coordenadas, distancias, mapas, direcciones, formatos como GeoJSON, Shapefile, GeoPackage, GPX o GeoParquet, usando también Overture Maps. - [Convert File](https://skillsagentes.com/skills/duckdb/duckdb-skills/convert-file.md): Convierte cualquier archivo de datos a otro formato: CSV, Parquet, JSON, Excel, GeoJSON y más, usando DuckDB. - [Read File](https://skillsagentes.com/skills/duckdb/duckdb-skills/read-file.md): Lee cualquier archivo de datos (CSV, JSON, Parquet, Avro, Excel, spatial, SQLite) o URL remota (S3, HTTPS) usando DuckDB. No sirve para código fuente. - [Read Memories](https://skillsagentes.com/skills/duckdb/duckdb-skills/read-memories.md): Busca en los logs de sesiones pasadas de Claude Code para recordar decisiones, patrones o trabajo pendiente. Úsalo cuando el usuario mencione conversaciones anteriores o necesites contexto previo. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)