Attach Db

Attach a DuckDB database file for use with /duckdb-skills:query. Explores the schema (tables, columns, row counts) and writes a SQL state file so subsequent queries can restore this session automatically via duckdb -init.

613 stars 37 forksDatabases

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add duckdb/duckdb-skills --skill attach-db
Manual install
git clone --depth 1 https://github.com/duckdb/duckdb-skills.git /tmp/duckdb-skills
mkdir -p ~/.claude/skills
cp -r /tmp/duckdb-skills/skills/attach-db ~/.claude/skills/attach-db

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

You are helping the user attach a DuckDB database file for interactive querying.

Database path given: `$0`

Follow these steps in order, stopping and reporting clearly if any step fails.

**State file convention**: see the "Resolve state directory" section below. All skills share a single `state.sql` file per project. Once resolved, any skill can use it with `duckdb -init "$STATE_DIR/state.sql" -c "<QUERY>"`.

## Step 1 — Resolve the database path

If `$0` is a relative path, resolve it against `$PWD` to get an absolute path (`RESOLVED_PATH`).

```bash
RESOLVED_PATH="$(cd "$(dirname "$0")" 2>/dev/null && pwd)/$(basename "$0")"
```

Check the file exists:

```bash
test -f "$RESOLVED_PATH"
```

- **File exists** -> continue to Step 2.
- **File not found** -> ask the user if they want to create a new empty database (DuckDB creates the file on first write). If yes, continue. If no, stop.

## Step 2 — Check DuckDB is installed

```bash
command -v duckdb
```

If not found, delegate to `/duckdb-skills:install-duckdb` and then continue.

## Step 3 — Validate the database

```bash
duckdb "$RESOLVED_PATH" -c "PRAGMA version;"
```

- **Success** -> continue.
- **Failure** -> report the error clearly (e.g. corrupt file, not a DuckDB database) and stop.

## Step 4 — Explore the schema

First, list all tables:

```bash
duckdb "$RESOLVED_PATH" -csv -c "
SELECT table_name, estimated_size
FROM duckdb_tables()
ORDER BY table_name;
"
```
Read the full skill on GitHub

Details

Skill name
attach-db
Path
skills/attach-db/SKILL.md
License
MIT
Repo updated
23 April 2026

FAQ

What does the Attach Db skill do?

Attach a DuckDB database file for use with /duckdb-skills:query. Explores the schema (tables, columns, row counts) and writes a SQL state file so subsequent queries can restore this session automatically via duckdb -init.

How do I install the Attach Db skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add duckdb/duckdb-skills --skill attach-db. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Attach Db popular?

It lives in duckdb/duckdb-skills, which has 613 GitHub stars and 37 forks, and is included in 1 curated skill list.

Related skills

Duckdb Docs

613

duckdb/duckdb-skills

Search DuckDB and DuckLake documentation and blog posts. Returns relevant doc chunks for a question or keyword using full-text search against a locally cached index.

Writing & ContentIn 1 list37

Query

613

duckdb/duckdb-skills

Run SQL queries against the attached DuckDB database or ad-hoc against files. Accepts raw SQL or natural language questions. Uses DuckDB Friendly SQL idioms.

DatabasesIn 1 list37

Clickhouse Best Practices

562

ClickHouse/agent-skills

MUST USE when reviewing ClickHouse schemas, queries, or configurations. Contains 31 rules that MUST be checked before providing recommendations. Always read relevant rule files and cite specific rules in responses.

DatabasesIn 1 list38

Better Auth Best Practices

227

better-auth/skills

Configure Better Auth server and client, set up database adapters, manage sessions, add plugins, and handle environment variables. Use when users mention Better Auth, betterauth, auth.ts, or need to set up TypeScript authentication with email/password, OAuth, or plugin configuration.

DatabasesIn 1 list37

PostgreSQL Queries

448

sanjay3290/ai-skills

Execute safe read-only SQL queries against PostgreSQL databases. Analyze and explore your database with Claude.

DatabasesIn 4 lists49

Redis Core

171

redis/agent-skills

Core Redis modeling guidance — choose the right data structure (String, Hash, List, Set, Sorted Set, JSON, Stream, Vector Set) and use consistent colon-separated key names. Use when designing a Redis data model, caching objects, deciding between Hash and JSON, building counters, leaderboards, membership sets, or session stores, or when reviewing/cleaning up Redis key naming.

DatabasesIn 1 list32

Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.