← Zurück zu Finn
AgentFinn

Skill · Version 1.0.0

Mobile Offline-Synchronisation

Synchronisiert lokale Änderungen über dauerhafte Warteschlangen mit klarer Konfliktbehandlung und Kontentrennung.

mobile-offline-sync

Entdecke, wie der Skill hilft

Wann ist der Skill hilfreich?

Nutze dies für Bearbeitung ohne Verbindung und spätere Synchronisation.

Wobei hilft er dir?

  • Wählt erforderlichen Offlineumfang und lokales Speichermodell.
  • Ordnet wiederholungssichere ausgehende Änderungen und inkrementelle Eingänge.
  • Behandelt Konflikte, Schemawechsel und Kontowechselbereinigung sicher.

Das könntest du fragen

Synchronisiere Offline-Aufgabenänderungen, ohne wartende Änderungen eines Kontos in ein anderes zu übertragen. Stelle eine Änderung zurück, melde dich ab und mit anderem Konto an. Die alte Änderung läuft niemals unter neuer Identität; Konflikte bleiben sichtbar.

Ausführliche Dokumentation

Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.

Details…Weniger anzeigen

Offline Storage & Synchronization

Design local persistence and offline behavior around the actual product requirement—keeping offline read caches, crash-safe local drafts and deferred write outboxes strictly separated.

1. Choose the right level of offline support

Tier When to Use Storage & UI Behavior
1. Offline Read Cache Feeds, profiles, reference catalogs, orders/tickets that must remain viewable in subways/airplanes. Persist query cache or SQLite tables (stale-while-revalidate). Show cached data immediately with an unobtrusive offline/last-updated indicator; revalidate on reconnect.
2. Crash-Safe Local Drafts Multi-step forms, messages, inspection notes or media uploads that must survive app switching or network drops. Auto-save drafts locally (keyed by userId + entity/screen key) on input debounce and on background/inactive transition. Clear draft only after server confirmation.
3. Offline Mutation Outbox Field-service, note-taking or task apps where product requirements explicitly mandate offline authoring. Apply change to local DB with syncStatus: 'pending', enqueue mutation in a persistent FIFO outbox table, and replay when online. Never invent an outbox for flows like payments or live inventory booking that require immediate server validation.

2. Outbox synchronization, idempotency and ordering

  • Client-generated IDs & Idempotency-Key: generate a UUIDv4/UUIDv7 on the client (clientMutationId / Idempotency-Key header) when the mutation is created. If the connection drops after the server commits the write but before the device receives the 200 OK, replaying the outbox item with the same key must be safe and deduplicated.
  • Sequential dependency resolution: replay mutations per entity/aggregate in causal order (CREATE -> UPDATE -> DELETE). If an item is created and edited while offline, either coalesce the pending mutations in the outbox or map temporary client IDs to server IDs before sending dependent requests.
  • Retry backoff vs permanent failure:
    • Transient errors (5xx, network timeout, 429): retry with exponential backoff + jitter, triggered by connectivity restoration (NetInfo / connectivity_plus) or foreground resume.
    • Permanent rejections (400, 403, 404, 409, 422): never loop forever. Mark the outbox entry failed, preserve the user's payload, and surface a clear banner/action so the user can edit, retry or discard the change.

3. Delta pull sync and conflict resolution

  • Pull incremental updates using server cursors, sync tokens or updated_since watermarks inside a single local database transaction so readers never observe half-applied sync batches.
  • Conflict handling (409 Conflict / version mismatch):
    • Send the base version or updatedAt with offline edits.
    • Only use silent Last-Write-Wins (LWW) for trivial preferences. For user-authored records, preserve both the server state and the user's local changes so nothing is silently overwritten.

4. Database hygiene, migrations and multi-account safety

  • Schema migrations: every change to expo-sqlite, WatermelonDB, Drift, Room or CoreData/SwiftData schemas must bump schemaVersion and provide a tested migration path (onUpgrade / MigrationStrategy) so existing users upgrading the app never crash or lose unsynced outbox items.
  • Encryption at rest: when storing sensitive health, financial or enterprise records offline, enable SQLCipher (useSQLCipher in expo-sqlite / sqflite_sqlcipher / encrypted Room) with the encryption key stored in iOS Keychain / Android Keystore.
  • Storage eviction & sign-out wipe: bound cached media/attachment directories, refuse to sign out silently while unsynced outbox mutations exist without warning the user, and wipe all user-scoped tables, KV entries and cached files on logout.

Before you finish

  • Offline read cache, local drafts and outbox mutations are separated and matched to product rules.
  • Outbox writes attach stable Idempotency-Keys, respect causal ordering, and halt on 4xx errors.
  • Conflict resolution preserves user work; delta pulls commit atomically in transactions.
  • Local DB schema migrations are versioned, and sign-out warns on unsynced work and wipes user data.

Enthaltene Dateien 2

  • LICENSE.txt
  • SKILL.md