offline-sync_skill

This skill designs offline-first synchronization for Capacitor/Android apps, enabling batched uploads, conflict resolution, and robust data integrity.
  • TypeScript

0

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill abelv22/project-foundation --skill offline-sync

  • SKILL.md1.7 KB

Overview

This skill helps design and implement reliable offline-first persistence and synchronization for Capacitor/Android apps. It focuses on buffering native location updates, efficient batched uploads to Supabase, and robust background sync so data is never lost when connectivity is intermittent. The approach balances battery usage, storage limits, and data integrity.

How this skill works

The skill defines a local SQLite entity (OfflineLocation) mirroring the Supabase registros_reten schema and recommends Capacitor SQLite on the web layer or Room on Android. It uses WorkManager for background uploads, groups pending records into batched HTTP requests, applies timestamp-based conflict resolution, and deletes records after confirmed sync. Network state listeners trigger sync attempts and toggle between direct-to-Supabase and local-first modes.

When to use it

  • Mobile apps that must record location or telemetry while offline
  • Apps that need reliable delivery of periodic sensor or event data
  • Scenarios where battery impact from frequent network calls must be minimized
  • Use cases requiring data retention policies and bounded local storage
  • When clients connect intermittently or over unreliable networks

Best practices

  • Use batched uploads to reduce wakeups and conserve battery; group by time window or record count
  • Persist records natively with Room (Android) or Capacitor SQLite to avoid web storage limits
  • Confirm server acknowledgment before deleting local records to ensure data durability
  • Implement simple timestamp-based conflict resolution for location points and reject duplicates
  • Run sync with WorkManager constraints (e.g., require network, backoff policy) and include retry/error handling

Example use cases

  • Delivery driver app buffering GPS points during long offline stretches and uploading in batches when online
  • Field survey app that records observations offline and syncs them reliably at day end
  • IoT gateway on a mobile device collecting sensor readings and sending grouped payloads to Supabase
  • Ride-hailing check-in points stored locally and de-duplicated before server upload
  • Asset tracking where older logs are trimmed to enforce retention limits while preserving recent history

FAQ

Include a unique local ID and a server-confirmation flag; de-duplicate by ID and use timestamp comparisons before marking records as synced.

When should I truncate old records?

Apply retention only after configurable thresholds (age or total records). Truncate oldest records when storage exceeds a safe limit and notify users if data loss could occur.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational