Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
oakoss avatar

Pglite

  • 101 installs
  • 14 repo stars
  • Updated March 2, 2026
  • oakoss/agent-skills

Helps with ai & agent building tasks during AI-assisted development.

About

pglite is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.

  • pglite
  • AI & Agent Building
  • AI-coding skill

Pglite by the numbers

  • 101 all-time installs (skills.sh)
  • +3 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #4,322 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oakoss/agent-skills --skill pglite

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs101
repo stars14
Last updatedMarch 2, 2026
Repositoryoakoss/agent-skills

What it does

Helps with ai & agent building tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

PGlite

Overview

PGlite is a lightweight WASM build of PostgreSQL 17.4 that runs directly in the browser, Node.js, and Bun with no external dependencies. It provides a full Postgres query engine with extensions, transactions, COPY support, and listen/notify in under 3MB gzipped.

When to use: Local-first apps needing a real SQL engine, browser-based analytics, offline-capable PWAs, embedded Postgres for testing, prototyping without a server.

When NOT to use: High-concurrency server workloads (use native Postgres), apps requiring full Postgres replication, Safari OPFS storage (not supported), write-heavy multi-tab scenarios without leader election.

Quick Reference

PatternAPIKey Points
Create instancePGlite.create(dataDir?, options?)Awaits ready internally
In-memory DBPGlite.create()Default, ephemeral storage
IndexedDB storagePGlite.create('idb://dbname')Persists in browser
OPFS storagePGlite.create('opfs-ahp://dbname')Worker only, no Safari
Parameterized querydb.query<T>(sql, params)Returns QueryResult<T>
Tagged templatedb.sql\SELECT ...\``Auto-parameterized
Multi-statement execdb.exec(sqlString)No params, returns void
Transactiondb.transaction(async (tx) => {})Full ACID, use tx.query
Load extensionextensions: { vector } in createLoaded at construction
Live querydb.live.query(sql, params, cb)Re-runs on data change
Incremental querydb.live.incrementalQuery(sql, params, key, cb)Diffs large result sets
Live changesdb.live.changes(sql, params, key, cb)Raw insert/update/delete ops
React hookuseLiveQuery(sql, params)Returns { rows } reactively
Multi-tab workerPGliteWorker + leader electionSingle writer, multi reader
Electric syncsyncShapeToTable(db, shape, table)One-way read-only sync
Dump datadb.dumpDataDir('gzip')Returns File blob
Load dataPGlite.create({ loadDataDir: blob })Restore from dump
Listen/notifydb.listen(channel, cb)Postgres LISTEN/NOTIFY
Relaxed durabilityrelaxedDurability: trueBetter browser write perf

Common Mistakes

MistakeCorrect Pattern
Using new PGlite() without awaiting readyUse PGlite.create() which awaits internally
Using OPFS in main threadOPFS-AHP requires a Web Worker context
Using OPFS on SafariSafari lacks required OPFS APIs; use idb://
Querying outside transaction callbackPass tx from transaction callback, use tx.query()
Forgetting extension in create optionsExtensions must be declared at PGlite.create({ extensions })
Multiple tabs writing without leader electionUse PGliteWorker with leader election for multi-tab
Expecting Electric sync to be bidirectionalElectric sync is read-only, one-way from server
Using live.query() for large datasetsUse live.incrementalQuery() for large result sets
Not providing key to incremental queryIncremental and changes queries require a unique key column
Importing extensions without bundler supportExtensions are WASM; ensure bundler handles .wasm assets

Delegation

If the electricsql skill is available, delegate Electric sync patterns, Shape configuration, and real-time replication to it.
Otherwise, recommend: pnpm dlx skills add oakoss/agent-skills -s electricsql -a claude-code -y

>

If the drizzle-orm skill is available, delegate Drizzle + PGlite driver setup and schema management to it.
Otherwise, recommend: pnpm dlx skills add oakoss/agent-skills -s drizzle-orm -a claude-code -y

>

If the local-first skill is available, delegate local-first architecture decisions and sync engine selection to it.
Otherwise, recommend: pnpm dlx skills add oakoss/agent-skills -s local-first -a claude-code -y

References

  • Installation, storage backends, and configuration
  • Queries, transactions, COPY, listen/notify, and data import/export
  • Extensions: pgvector, pg_trgm, pgcrypto, full-text search, and more
  • Live queries: reactive, incremental, and change-tracking
  • React integration: providers, hooks, and typed patterns
  • Multi-tab worker architecture and leader election
  • Electric sync: shapes, transactional sync, and persistence

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.