All skills
av avatar

/turso-db

@5ecea61
by Ivan Charapanauav/skills16 stars
2

Install, configure, and work with Turso DB — an in-process SQLite-compatible relational database engine written in Rust. Use when the user needs to (1) install Turso DB, (2) create or query databases with the tursodb CLI shell, (3) use Turso from JavaScript/Node.js via @tursodatabase/database, (4) work with vector search or embeddings in Turso, (5) set up full-text search with FTS indexes, (6) configure transactions including MVCC concurrent transactions, (7) enable encryption at rest, or (8) use Change Data Capture (CDC) for audit logging.

Use this Skill: https://skilld.dev/gh/av/skills/turso-db

This session only. Nothing lands on disk.

referencesadvanced-features.md

≈974 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Turso Advanced Features

Journal Modes

Query or switch journal mode at runtime:

PRAGMA journal_mode;                          -- query current mode
PRAGMA journal_mode = wal;                    -- WAL mode (default)
PRAGMA journal_mode = experimental_mvcc;      -- MVCC mode
  • Switching modes triggers a checkpoint
  • Legacy SQLite databases auto-convert to WAL on open
  • Legacy modes (delete, truncate, persist, memory, off) not supported

Encryption (Experimental)

Requires --experimental-encryption flag.

Setup

Generate a 32-byte hex key:

openssl rand -hex 32

Create Encrypted Database

tursodb --experimental-encryption database.db

Then in the shell:

PRAGMA cipher = 'aegis256';   -- or 'aes256gcm'
PRAGMA hexkey = '<your-64-char-hex-key>';

Or via URI:

tursodb --experimental-encryption \
  "file:database.db?cipher=aegis256&hexkey=<your-64-char-hex-key>"

Reopening Encrypted Database

Must use URI format with cipher and hexkey parameters:

tursodb --experimental-encryption \
  "file:database.db?cipher=aegis256&hexkey=<your-64-char-hex-key>"

Supported Ciphers

AES-GCM (128/256-bit), AEGIS-256, AEGIS-256-X2, AEGIS-256-X4, AEGIS-128L, AEGIS-128-X2, AEGIS-128-X4.

Change Data Capture (CDC) — Early Preview

Track all inserts, updates, and deletes per connection in real-time.

Enable CDC

PRAGMA unstable_capture_data_changes_conn('<mode>[,custom_cdc_table]');

Modes

Mode Description
off Disable CDC
id Log only rowid (most compact)
before Capture row state before updates/deletes
after Capture row state after inserts/updates
full Both before and after states (recommended for audit)

Changes are logged to turso_cdc table (or a custom table name).

CDC Table Schema

Column Type Description
change_id INTEGER Monotonically increasing PK
change_time INTEGER Unix epoch seconds
change_type INTEGER 1=INSERT, 0=UPDATE, -1=DELETE
table_name TEXT Affected table
id INTEGER Rowid of affected row
before BLOB Row state before change (NULL for INSERT)
after BLOB Row state after change (NULL for DELETE)
updates BLOB Granular column modifications (UPDATE only)

Example

PRAGMA unstable_capture_data_changes_conn('full');
CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);
INSERT INTO users VALUES (1, 'John'), (2, 'Jane');
UPDATE users SET name='John Doe' WHERE id=1;
DELETE FROM users WHERE id=2;
SELECT * FROM turso_cdc;

Notes

  • CDC records visible before transaction commits
  • Failed operations not recorded
  • Schema changes tracked with table_name = 'sqlite_schema'
  • full mode: each N-byte update writes 3x to disk (before + after + WAL)
  • WITHOUT ROWID tables not supported

Index Methods (Experimental)

Requires --experimental-index-method flag. Custom data access methods integrated with query planner.

Create/Drop

CREATE INDEX t_idx ON t USING index_method_name (column1, column2);
CREATE INDEX t_idx ON t USING index_method_name (c) WITH (a = 1, b = 'text');
DROP INDEX t_idx;

DML (INSERT/DELETE/UPDATE) on the base table automatically updates the index. The query planner automatically uses the index when a query matches one of the index method's patterns.

SQLite C API

Turso supports a subset of the SQLite C API:

  • sqlite3_open / sqlite3_open_v2 — open connection
  • sqlite3_prepare_v2 — prepare SQL statement
  • sqlite3_step — execute/advance prepared statement
  • sqlite3_column_* — extract column values (type, count, decltype, name, int64, double, blob, bytes, text)
  • libsql_wal_frame_count — get WAL frame count (Turso extension)

Source: SKILL.md on GitHub

1 warning1d4 checks · Risk SAFE
  • Gen Agent Trust Hub1d

    The turso-db skill provides tools to install and manage Turso database instances. It includes a standard shell-based installation method from the official Turso GitHub repository and facilitates database operations via SQL and Node.js. The primary security considerations involve the execution of external installation scripts and the potential for untrusted data stored in the database to influence the agent's actions during search or retrieval tasks.

  • Socket1d

    No alerts

  • Snyk1d

    Risk: LOW · No issues

  • Runlayer7mo

    6/6 files flagged

Signed by skilld at 5ecea61. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 7 months ago

README badge

README badge for av/skills/turso-db