local-first

Implements local-first architectures using CRDTs, IndexedDB, and sync engines for offline-capable applications.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/JenilRevaliya/ARGUS --skill local-first-jenilrevaliya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: local-first
Source: https://github.com/JenilRevaliya/ARGUS/tree/main/.agent/skills/local-first
Command: npx skills add https://github.com/JenilRevaliya/ARGUS --skill local-first-jenilrevaliya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building apps that work offline and sync across devices is hard: naive approaches using React Query or localStorage break under network loss, storage limits, and edit conflicts. This Skill guides you through local-first architecture so your UI reads and writes a local database instantly while a background engine syncs to the cloud. ## Core Features & Use Cases - Sync Engine Selection: Compares PowerSync, ElectricSQL, Replicache, and WatermelonDB versus traditional HTTP fetching, with code patterns for local-first reads and writes. - Conflict Resolution with CRDTs: Demonstrates Yjs-based automatic merging for collaborative editing without a central server deciding winners. - In-Browser Database Guidance: Decision table covering IndexedDB, Dexie.js, SQLite WASM (OPFS), RxDB, and WatermelonDB, plus live-query React integration via dexie-react-hooks. - Use Case: Building a PWA todo app that must work offline on mobile and sync across devices — use PowerSync-style local SQLite queries for instant UI and Yjs for collaborative lists. ## Quick Start Ask the AI to design an offline-capable data layer for your app using a local-first sync engine and CRDT-based conflict resolution.

Frequently Asked Questions about local-first

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build an offline-first app that syncs to the cloud?▼

Use a local-first sync engine such as PowerSync, ElectricSQL, or Replicache instead of React Query. The UI reads and writes a local database like SQLite WASM, and a background worker syncs changes to the server when connectivity returns.

What is the difference between React Query and a local-first sync engine?▼

React Query and SWR are HTTP caching layers that fail offline and add network latency. Local-first engines like PowerSync query a local SQLite database directly, resolving instantly and syncing silently in the background.

How do CRDTs resolve conflicts in collaborative apps?▼

CRDTs automatically merge concurrent edits without a central server picking a winner. Libraries like Yjs provide shared data types that observe local and remote changes and merge them cleanly when peers reconnect.

IndexedDB vs SQLite WASM for browser storage, which should I use?▼

IndexedDB suits simple key-value storage and is best accessed via Dexie.js for a clean Promise API. SQLite WASM with OPFS gives you true relational SQL in the browser but requires more setup complexity.

Why should I avoid localStorage for app data?▼

localStorage is synchronous, blocks the main thread, and caps out around 5MB. For structured data beyond that limit, use IndexedDB via Dexie or SQLite WASM, which support larger datasets and indexed queries.

When is local-first architecture not the right choice?▼

Local-first adds complexity in conflict resolution and sync design, so simple server-rendered apps with no offline requirement may not benefit. It fits best when offline support, multi-device sync, or real-time collaboration are core requirements.