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

Tanstack Db

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

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

About

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

  • tanstack-db
  • AI & Agent Building
  • AI-coding skill

Tanstack Db by the numbers

  • 96 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #4,561 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 tanstack-db

Add your badge

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

Listed on Skillselion
Installs96
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 ↗

TanStack DB

Overview

TanStack DB is a reactive client store built on differential dataflow that extends TanStack Query with collections, live queries, and optimistic mutations. It normalizes data into typed collections, enables sub-millisecond cross-collection queries, and provides instant optimistic updates with automatic rollback on failure.

When to use: Reactive UIs needing local-first data, cross-collection joins with live updates, optimistic mutations with automatic sync, real-time sync via ElectricSQL or other backends, apps that outgrow TanStack Query's per-query caching model.

When NOT to use: Simple fetch-and-display (TanStack Query alone suffices), server-components-only apps, purely synchronous local state (useState/Zustand), GraphQL with normalized caching (Apollo/urql).

TanStack DB is currently in beta. APIs may change between releases.

Quick Reference

PatternAPIKey Points
Create collectioncreateCollection(queryCollectionOptions({...}))Define typed set of objects with getKey
Live query (React)useLiveQuery((q) => q.from({...}).where(...))Auto-updates when underlying data changes
Filter.where(({ t }) => eq(t.field, value))Supports eq, gt, lt, like, and, or, not
Select fields.select(({ t }) => ({ id: t.id, name: t.name }))Project specific fields from collections
Order results.orderBy(({ t }) => t.field, 'asc')Sort ascending or descending
Join collections.join({ b: collB }, ({ a, b }) => eq(...), 'inner')Cross-collection joins with type safety
Group and aggregate.groupBy(...).select(({ t }) => ({ count: count(t.id) }))Supports count, sum, avg, min, max
Insertcollection.insert({ ...data })Optimistic insert, syncs via onInsert handler
Updatecollection.update(key, (draft) => { ... })Immer-style draft mutation, syncs via onUpdate
Deletecollection.delete(key)Optimistic delete, syncs via onDelete handler
Electric syncelectricCollectionOptions({ shapeOptions: {...} })Real-time Postgres sync via ElectricSQL
Live query coll.liveQueryCollectionOptions({ query })Derived collection from live query definition
Local storagelocalStorageCollectionOptions({...})Persistent local data, syncs across tabs

Sync Modes (v0.5+)

ModeBehaviorUse Case
Eager (default)Loads all records on collection initSmall datasets (< 1k rows)
On-demandLoads only what queries request (predicate pushdown)Large datasets, selective loading
ProgressiveFast first paint, full dataset syncs in backgroundBest of both, scales to 100k+

Common Mistakes

MistakeCorrect Pattern
Using TanStack Query directly for local stateUse collections with live queries for reactive local data
Forgetting getKey in collection configAlways provide getKey to identify items uniquely
Not providing persistence handlersDefine onInsert/onUpdate/onDelete to sync with server
Using useQuery instead of useLiveQueryuseLiveQuery provides reactive cross-collection queries
Creating collections inside componentsDefine collections at module scope, outside components
Importing from @tanstack/db in React appsImport from @tanstack/react-db (re-exports core)
Expecting automatic server sync without configCollections require explicit persistence handlers for sync
Not installing collection type packageInstall @tanstack/query-db-collection for REST API usage

Delegation

If the tanstack-query skill is available, delegate TanStack Query-specific patterns (query keys, cache invalidation, SSR) to it.
Otherwise, recommend: npx skills add oakoss/agent-skills --skill tanstack-query
If the electricsql skill is available, delegate ElectricSQL setup, shapes, auth proxy, and write patterns to it.
Otherwise, recommend: pnpm dlx skills add oakoss/agent-skills -s electricsql -a claude-code -y
If the local-first skill is available, delegate architecture decisions, sync engine comparison, and conflict resolution to it.
Otherwise, recommend: pnpm dlx skills add oakoss/agent-skills -s local-first -a claude-code -y
  • Query pattern discovery: Use Explore agent
  • Architecture review: Use Task agent

References

  • Setup, installation, and collection configuration
  • Live queries, filtering, joins, and aggregations
  • Optimistic mutations, persistence handlers, and sync patterns
  • ElectricSQL integration, electric collections, and txid patterns
  • Error class hierarchy, transaction states, and rollback patterns
  • Local-only and localStorage collections with cross-tab sync
  • Cross-collection transactions, joins, batching, and lifecycle

Related skills

This week in AI coding

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

unsubscribe anytime.