SQLite Storage
SkillDatabases & dataUse when a val needs to store structured or relational data. Covers the std/sqlite API, parameterized queries, transactions, and the val-scoped vs organization-scoped database distinction.
Use SQLite Storage in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add SQLite Storage and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the SQLite Storage skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by hashgraph-online/awesome-codex-plugins in plugins/val-town/plugins/skills/sqlite-storage/SKILL.md and read by Ahel’s review.
Val Town provides built-in SQLite via the std/sqlite module. Reach for it whenever a val needs relational or structured persistent data. For simple key/value data, prefer std/blob instead.
Basic usage
import { sqlite } from "https://esm.town/v/std/sqlite/main.ts";
await sqlite.execute(`CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT UNIQUE
)`);
await sqlite.execute({
sql: "INSERT INTO users (name, email) VALUES (?, ?)",
args: ["Alice", "alice@example.com"],
});
const result = await sqlite.execute("SELECT * FROM users");
// result.rows = [{ id: 1, name: "Alice", email: "alice@example.com" }]
Transactions
Use sqlite.batch for atomic multi-statement transactions — all succeed or all roll back:
await sqlite.batch([
{ sql: "INSERT INTO users (name, email) VALUES (?, ?)", args: ["Bob", "bob@example.com"] },
{ sql: "UPDATE users SET name = ? WHERE id = ?", args: ["Robert", 2] },
]);
Per-val vs organization databases
The import path determines which database you get. Both expose the same @libsql/client API (execute, batch) and return rows as keyed objects (Record<string, unknown>[]):
std/sqlite/main.ts— val-scoped database, isolated to this val. The default for new vals, and what you almost always want.std/sqlite/global.ts— organization-scoped database, shared across every val owned by the same account. (Your personal account counts as its own organization here, so this database is shared across all of your vals.)
Do not switch an existing val between these import paths — it changes which database the val reads and writes.
Querying org-owned vals via tools
When using the sqlite_execute or sqlite_batch tools to query a val owned by an organization (not your personal account), pass the org handle as the org parameter so the call hits the right database. Example: { sql: "SELECT * FROM users", org: "some-org" }. This only matters for the tool calls — code inside the val itself reads from its own database automatically.
Rules
- Always use parameterized queries (the
argsfield) for any value derived from user input. Never interpolate strings into SQL. - Use
CREATE TABLE IF NOT EXISTSso schema setup is idempotent across val restarts. - Schema migrations: add new columns with
ALTER TABLE ... ADD COLUMN. Wrap intry/catchif the migration may run against an already-updated table.
Reference
Full API docs: https://docs.val.town/reference/std/sqlite/usage/
Signals
- GitHub stars
- 1k
- Forks
- 316
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
sqlite-storage- Source
- github.com/hashgraph-online/awesome-codex-plugins
github.com/hashgraph-online/awesome-codex-plugins
Related picks
Skill · mattpocock
The pick for TypeScripttypescript-pro
Skill · jeffallan
The pick for TypeScriptsqlite-ops
Skill · aiskillstore
The pick for SQLiteanalytics
Skill · coreyhaines31
More in Databases & datasupabase
Skill · supabase
More in Databases & dataconnect
Skill · composiohq
More in Databases & data