tanstack-db
Installation
SKILL.md
TanStack DB
Use this skill when work touches TanStack DB: collections, live queries, optimistic mutations, sync engines, local persistence, offline queues, or moving a TanStack Query app onto DB.
Workflow
- Inspect the local DB shape before changing code:
- Package versions for
@tanstack/db, framework package (@tanstack/react-db), collection adapters,@tanstack/query-core,@tanstack/offline-transactions,@tanstack/react-router-with-db, React, and router. - Definition style:
collectionOptions(...)descriptors withDbClient/DbProvider, or module-levelcreateCollection(...)singletons. - Data source per collection: REST via Query, Electric, TrailBase, RxDB, PowerSync, local-only, localStorage, or custom sync.
- Sync mode (
eager,on-demand,progressive), mutation handlers, how each handler waits for sync-back, and whether SSR or offline is in scope.
- Package versions for
- Refresh docs when versions or behavior matter. DB is beta and moves fast; start from source-map.md.
- For packages,
DbClient, descriptors,getKey, schemas, sync modes, indexes, and lifecycle, use setup-collections.md. - For per-backend setup (Query, Electric, TrailBase, RxDB, PowerSync, local collections, custom sync), use adapters.md.
- For the query builder, operators, joins, includes, aggregates, hooks, query identity, and performance, use live-queries.md.
- For
insert/update/delete, handlers,createOptimisticAction, transactions, paced mutations, rollback, and errors, use mutations.md. - For SQLite/IndexedDB persistence and
@tanstack/offline-transactions, use persistence-offline.md. - For SSR, hydration, TanStack Start, Next.js streaming, and testing, use ssr-testing.md.
- For "DB or plain Query?", incremental migration, deprecations, and breaking changes, use query-vs-db-migration.md.