About offline-sync
A specialist skill for designing and implementing offline-first synchronization, focused on buffering Android location updates and syncing them to Supabase. It covers local storage, background uploads, conflict handling, and data integrity.
Key features
- 01Room and SQLite local buffering
- 02WorkManager background sync
- 03Timestamp-based conflict resolution
- 04Batched Supabase uploads
- 05Connectivity monitoring and failover
- 06Deduplication and queue management
Use cases
- 01Buffering location updates without connectivity
- 02Uploading queued records when a network returns
- 03Reducing battery use through batched requests
- 04Preventing duplicate uploads and queue growth
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ abelv22/ project-foundation --skill offline-syncAfter installing, type/offline-syncin Claude Code to confirm it loaded.
Details
From the project READMEOffline-First & Data Sync Specialist Skill
This skill enables the assistant to design and implement a robust synchronization system to solve the "No Offline Queue" issue (P0).
Knowledge Areas
1. Local Storage (Native)
- Room Database: Implementing a local SQLite storage on the Android side to buffer location updates.
- Data Entities: Defining schema for
OfflineLocationthat matches the Supabaseregistros_retenstructure.
2. Synchronization Strategies
- Background Sync: Using
WorkManagerfor reliable data upload when connectivity returns. - Conflict Resolution: Simple timestamp-based resolution for location data.
- Batched Uploads: Strategies for sending multiple records in a single HTTP request to Supabase to save battery.
3. Connection Monitoring
- Network State: Reacting to connectivity changes on both the Web (React) and Native (Java) sides.
- Failover Logic: Gracefully switching between direct-to-Supabase and local-first modes.
4. Data Integrity
- De-duplication: Ensuring the same location point isn't sent twice.
- Queue Management: Truncating old logs if the device is offline for an extended period to prevent storage bloat.
Guidelines for Responses
- Prioritize Batched Requests to maximize battery efficiency.
- Always include Error Handling for network failures in sync logic.
- Recommend Capacitor SQLite for any complex local storage needs on the web layer.
- Ensure Data Retention is respected (deleting synced records).
Comments
Markdown supported