secondsky avatar

Mobile Offline Support

This is a solid foundation for building offline-first mobile apps with React Native. You get local storage through AsyncStorage, a sync queue that automatically processes when connectivity returns, and basic conflict resolution strategies. The queue management is thoughtful, capping at 1000 items and discarding oldest entries when full, which prevents unbounded memory growth. The code includes placeholder API calls you'll need to wire up to your backend, and the conflict resolution defaults to last-write-wins though you can swap in merge logic. It covers the essential pattern of cache-first reads and queued writes, plus includes a simple offline banner component. Best suited for apps where occasional sync conflicts are acceptable and you need basic offline capabilities without reaching for a full framework like WatermelonDB.

skills.sh installs
412
GitHub stars
248
last updated
Aug 21, 2026

Install

$ npx -y skills add secondsky/claude-skills --skill mobile-offline-support --agent claude-code

Installs into .claude/skills of the current project.

Files

Mobile Offline Support

Build offline-first mobile applications with local storage and synchronization.

React Native Implementation

import AsyncStorage from '@react-native-async-storage/async-storage';
import NetInfo from '@react-native-community/netinfo';

class OfflineManager {
  constructor() {
    this.syncQueue = [];
    this.isOnline = true;
    // Maximum items in sync queue before discarding oldest
    this.MAX_SYNC_QUEUE_LENGTH = 1000;

    NetInfo.addEventListener(state => {
      this.isOnline = state.isConnected;
      if (this.isOnline) this.processQueue();
    });
  }

  /**
   * Fetch data from server.
   * TODO: Replace with actual API endpoint implementation.
   */
  async fetchFromServer(key) {
    try {
      // Example implementation - replace with your API
      const response = await fetch(`${API_BASE_URL}/data/${key}`);
      if (!response.ok) {
        throw new Error(`Server returned ${response.status}`);
      }
      return await response.json();
    } catch (error) {
      console.error('fetchFromServer failed:', error);
      throw new Error(`Failed to fetch ${key}: ${error.message}`);
    }
  }

Sponsors

Details

Repository
github.com/secondsky/claude-skills
Categories
Backend & APIs, Mobile Development
First seen
Jun 3, 2026

More from secondsky/claude-skills

All 146
1auth0 avatarauth0-flaskauth0/agent-skillsUse when adding session-based login, logout, or user profile to a Flask web application. Integrates auth0-server-python — use even if the user says "add login t411skills.sh installs
2narumiruna avataraiogram-frameworknarumiruna/telegram-botBuild, refactor, or troubleshoot Telegram bots using aiogram v3. Use when working with aiogram routers/handlers/filters, Dispatcher lifecycle, update delivery (407skills.sh installs
3hummingbot avatarhummingbothummingbot/skillsAgent skill that faithfully reproduces Hummingbot CLI commands (connect, balance, create, start, stop, status, history) via Hummingbot API. V1 focuses on core t406skills.sh installs
4umbraco avatarumbraco-openapi-clientumbraco/umbraco-cms-backoffice-skillsSet up OpenAPI client for authenticated API calls in Umbraco backoffice (REQUIRED for custom APIs)405skills.sh installs
5vercel avatarvercel-microfrontendsvercel/microfrontendsGuide for building, configuring, and deploying microfrontends on Vercel. Use this skill when the user mentions microfrontends, multi-zones, splitting an app acr403skills.sh installs
6codex-data avatarcodex-supergraphcodex-data/skillsUse when the user asks about token prices, charts, holders, trending tokens, pair data, prediction markets, or any on-chain analytics from Codex. Also use when 401skills.sh installs