---
name: "pouchdb-offline-sync-replication"
description: "Store data locally in IndexedDB and synchronize bi-directionally with remote CouchDB."
metadata:
  author: "PouchDB"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "sync pouchdb with couchdb"
  - "query pouchdb with mango find"
  - "handle offline pouchdb sync"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# PouchDB In-Browser Database & Cloud Sync

Implements offline-first web applications using PouchDB: client-side querying with pouchdb-find, handling live sync events, managing local attachment blobs, and resolving merge conflicts.

## When to Invoke
Invoke this skill whenever you need to:
- sync pouchdb with couchdb
- query pouchdb with mango find
- handle offline pouchdb sync

## Execution SOP & Rules
1. Create local database: const localDB = new PouchDB('app_data'); const remoteDB = new PouchDB('https://...').
2. Start continuous sync: localDB.sync(remoteDB, { live: true, retry: true }).on('change', handleUpdate).
3. Create local index: await localDB.createIndex({ index: { fields: ['status', 'createdAt'] } }).
4. Execute queries offline: await localDB.find({ selector: { status: 'active' }, sort: ['createdAt'] }).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
