local-first-architecture
Installation
SKILL.md
Local-First Architecture — Instant UI & Sync Engines
Mandatory Pre-Flight Context Inspection
Before implementing local-first architecture or offline sync engines, you MUST inspect:
- Zero Network Latency Rule → Execute reads and writes against local storage (OPFS / IndexedDB / WASM SQLite) first before queueing outbound sync
- Outbound Mutation Queue & Idempotency → Persist mutation logs locally with client-generated UUID
idempotencyKeyfields to prevent duplicate server writes - Conflict Resolution Strategy → Define explicit conflict handling (Last-Write-Wins with Lamport timestamps or CRDTs via Yjs/Automerge)
- OPFS (Origin Private File System) → In modern web browsers, use OPFS for high-speed disk I/O instead of raw legacy IndexedDB for database files
Activation Boundaries
- Activate when: Building instant-feeling offline-capable web or desktop applications, collaborative editors, sync engines, and optimistic data stores.
- DO NOT activate when: Building traditional request-response server-rendered apps where clients hold zero persistent state.