Agent Skills
› NeverSight/learn-skills.dev
› offline-sync
offline-sync
GitHub针对Capacitor/Android应用设计离线优先与数据同步方案,解决无离线队列问题。涵盖Room本地存储、WorkManager后台同步、冲突解决及网络监控,确保数据完整性与电池效率。
Trigger Scenarios
需要实现离线数据存储与同步
处理Android端SQLite与Supabase数据同步
优化后台批量上传策略
Install
npx skills add NeverSight/learn-skills.dev --skill offline-sync -g -y
SKILL.md
Frontmatter
{
"name": "offline-sync",
"description": "Expert in data persistence, local-first architectures, and synchronization strategies for Capacitor\/Android applications."
}
Offline-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).
Version History
- e0220ca Current 2026-07-05 22:18


