Offline First Developmentのロゴ

Offline First Development

コミュニティ
Omar-Obando
offline-first-development

Use when implementing offline-first applications, managing local storage, implementing data synchronization, handling conflicts, and creating offline UI patterns. Includes IndexedDB, localStorage, service workers, and offline state management. Based on offline-first development best practices.

Add to TypingMind

概要

公開者Omar-Obando
リポジトリqwen-orchestrator
スキル名offline-first-development
スター
53
フォーク
13
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    Omar-ObandoがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Offline First Development」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/offline-first-development
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Omar-Obando/qwen-orchestrator.git /tmp/qwen-orchestrator
mkdir -p .claude/skills
cp -r /tmp/qwen-orchestrator/skills/offline-first-development .claude/skills/offline-first-development
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでOffline First Developmentを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にOffline First Developmentを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Offline First Developmentは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Offline-First Development Skill — Mobile Engineer

Overview

This skill provides comprehensive guidance for implementing offline-first applications. It covers local storage management, data synchronization, conflict resolution, offline UI patterns, and offline state management following offline-first development best practices.

When to Use

Use this skill when:

  • Implementing offline-first applications
  • Managing local storage (IndexedDB, localStorage)
  • Implementing data synchronization
  • Handling synchronization conflicts
  • Creating offline UI patterns
  • Implementing service workers
  • Managing offline state
  • Creating offline data models
  • Implementing offline-first APIs
  • Handling network failures
  • Creating offline indicators
  • Implementing queue for offline actions
  • Managing offline data validation
  • Creating offline sync strategies
  • Implementing conflict resolution
  • Managing offline data consistency
  • Creating offline-first UX patterns
  • Implementing background sync
  • Managing offline data caching
  • Creating offline-first error handling
  • Implementing offline data encryption
  • Managing offline storage limits
  • Creating offline-first testing

Do NOT use this skill when:

  • Writing application business logic (use domain-driven skill)
  • Designing database schemas (use database-design skill)
  • Writing API endpoint specifications (use api-design skill)
  • Performing security audits (use security-auditor skill)
  • Writing SQL queries (use sql-best-practices skill)
  • Designing multi-page website layouts (use design-system skill)
  • Analyzing deployment configurations (use deployment skill)
  • Writing documentation (use documentation-best-practices skill)

Offline-First Principles

Core Principles

┌─────────────────────────────────────────────────────────────┐
│              Offline-First Principles                       │
├─────────────────────────────────────────────────────────────┤
│  1. Always Available:                                       │
│     - Application works offline                             │
│     - Core functionality available                          │
│     - Graceful degradation                                  │
│                                                              │
│  2. Data Persistence:                                       │
│     - Data stored locally                                   │
│     - Data survives app restart                             │
│     - Data survives device restart                          │
│                                                              │
│  3. Automatic Sync:                                         │
│     - Data syncs when online                                │
│     - Sync happens automatically                            │
│     - Sync is transparent to user                           │
│                                                              │
│  4. Conflict Resolution:                                    │
│     - Handle offline changes                                │
│     - Resolve conflicts gracefully                          │
│     - User awareness of conflicts                           │
│                                                              │
│  5. Offline UI:                                             │
│     - Clear offline status                                  │
│     - Offline actions queue                                 │
│     - Offline indicators                                    │
└─────────────────────────────────────────────────────────────┘

Local Storage Options

┌─────────────────────────────────────────────────────────────┐
│              Local Storage Options                          │
├─────────────────────────────────────────────────────────────┤
│  localStorage:                                              │
│  - Key-value storage                                        │
│  - Synchronous API                                          │
│  - Limited to ~5MB                                          │
│  - String values only                                       │
│                                                              │
│  sessionStorage:                                            │
│  - Session-scoped storage                                   │
│  - Synchronous API                                          │
│  - Limited to ~5MB                                          │
│  - Cleared on session end                                   │
│                                                              │
│  IndexedDB:                                                 │
│  - Database-style storage                                   │
│  - Asynchronous API                                         │
│  - Large storage capacity                                   │
│  - Supports complex data structures                         │
│                                                              │
│  Cache API:                                                 │
│  - HTTP response caching                                    │
│  - Service worker integration                               │
│  - Query-based retrieval                                    │
│  - Automatic cache management                               │
│                                                              │
│  Web SQL (deprecated):                                      │
│  - SQL database                                             │
│  - Asynchronous API                                         │
│  - Deprecated in favor of IndexedDB                         │
└─────────────────────────────────────────────────────────────┘

Offline Sync Strategies

Sync Patterns

┌─────────────────────────────────────────────────────────────┐
│              Offline Sync Strategies                        │
├─────────────────────────────────────────────────────────────┤
│  Last Write Wins:                                           │
│  - Simple conflict resolution                               │
│  - Timestamp-based                                          │
│  - May lose data                                            │
│  - Good for: Simple data, low conflict                     │
│                                                              │
│  Operational Transform:                                     │
│  - Collaborative editing                                    │
│  - Transform operations                                    │
│  - Complex implementation                                   │
│  - Good for: Real-time collaboration                       │
│                                                              │
│  CRDT (Conflict-free Replicated Data Types):                │
│  - Automatic conflict resolution                            │
│  - No coordination needed                                   │
│  - Complex data structures                                  │
│  - Good for: Distributed systems                           │
│                                                              │
│  Merge Conflicts:                                           │
│  - User-assisted resolution                                 │
│  - Conflict detection                                       │
│  - User interface for resolution                            │
│  - Good for: User-editable data                            │
│                                                              │
│  Queue-based Sync:                                          │
│  - Queue offline actions                                    │
│  - Process sequentially                                     │
│  - Track sync status                                        │
│  - Good for: Action-based sync                             │
└─────────────────────────────────────────────────────────────┘

Sync Implementation

javascript
// ✅ Good: Offline sync with IndexedDB
class OfflineSync {
  constructor(db, apiClient) {
    this.db = db;
    this.apiClient = apiClient;
  }

  async sync() {
    // Get pending changes
    const pendingChanges = await this.db.getAll('pendingChanges');

    for (const change of pendingChanges) {
      try {
        // Attempt to sync
        const result = await this.apiClient.sync(change);

        // Mark as synced
        await this.db.delete('pendingChanges', change.id);

        // Update local cache
        await this.db.put('cache', result);
      } catch (error) {
        // Handle error
        console.error('Sync failed:', error);

        // Retry later
        if (this.shouldRetry(error)) {
          await this.db.update('pendingChanges', change.id, {
            retryCount: (change.retryCount || 0) + 1,
          });
        }
      }
    }
  }

  async queueChange(record, action) {
    // Queue change for later sync
    await this.db.put('pendingChanges', {
      record,
      action,
      timestamp: Date.now(),
      retryCount: 0,
    });
  }
}

Offline UI Patterns

Offline Indicators

html
<!-- ✅ Good: Offline indicator -->
<div class="offline-indicator" id="offlineIndicator">
  <span class="offline-icon">wifi_off</span>
  <span class="offline-text">You're offline</span>
</div>

<script>
  // Monitor network status
  window.addEventListener('online', () => {
    document.getElementById('offlineIndicator').style.display = 'none';
    // Trigger sync
    offlineSync.sync();
  });

  window.addEventListener('offline', () => {
    document.getElementById('offlineIndicator').style.display = 'block';
  });
</script>

Offline Actions Queue

html
<!-- ✅ Good: Offline action queue -->
<div class="action-queue" id="actionQueue">
  <h3>Pending Actions</h3>
  <ul id="queueList"></ul>
</div>

<script>
  // Display pending actions
  function displayQueue() {
    const queueList = document.getElementById('queueList');
    queueList.innerHTML = '';

    offlineSync.getPendingActions().forEach((action) => {
      const li = document.createElement('li');
      li.textContent = `${action.type}: ${action.description}`;
      queueList.appendChild(li);
    });
  }
</script>

Service Workers

Service Worker Registration

javascript
// ✅ Good: Service worker registration
if ('serviceWorker' in navigator) {
  window.addEventListener('load', () => {
    navigator.serviceWorker
      .register('/sw.js')
      .then((registration) => {
        console.log('SW registered:', registration);
      })
      .catch((error) => {
        console.log('SW registration failed:', error);
      });
  });
}

Service Worker Cache Strategy

javascript
// ✅ Good: Service worker cache strategy
self.addEventListener('install', (event) => {
  event.waitUntil(
    caches.open('app-cache').then((cache) => {
      return cache.addAll([
        '/',
        '/styles/main.css',
        '/scripts/app.js',
        '/images/logo.png',
      ]);
    })
  );
});

self.addEventListener('fetch', (event) => {
  event.respondWith(
    caches.match(event.request).then((cachedResponse) => {
      if (cachedResponse) {
        return cachedResponse;
      }

      return fetch(event.request).then((response) => {
        // Cache the response
        const responseClone = response.clone();
        caches.open('app-cache').then((cache) => {
          cache.put(event.request, responseClone);
        });

        return response;
      });
    })
  );
});

Real-World Impact

Before this skill:

  • Applications fail when offline
  • No data persistence
  • Poor user experience
  • Data loss
  • Manual sync required

After this skill:

  • Applications work offline
  • Automatic data persistence
  • Excellent user experience
  • No data loss
  • Automatic sync

Cross-References

  • mobile-performance - For mobile optimization
  • testing-strategy - For offline testing
  • api-design - For offline-first APIs

References

よくある質問

AIスキル「Offline First Development」では何ができますか?

Use when implementing offline-first applications, managing local storage, implementing data synchronization, handling conflicts, and creating offline UI patterns. Includes IndexedDB, localStorage, service workers, and offline state management. Based on offline-first development best practices.

TypingMindでOffline First Developmentを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Offline First Developmentはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにOffline First Developmentをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/offline-first-developmentを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Offline First Developmentを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Offline First Developmentで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもOffline First Developmentを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Offline First Development」は無料ですか?

はい。Omar-ObandoがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇