Command Palette

Search for a command to run...

Назад к скиллам
скилл № 23308

mobile-networking

Use when the user asks about mobile networking: REST or GraphQL clients, Retrofit, OkHttp, URLSession, Dio, interceptors, token refresh, retries, pagination…

БесплатноБез исполняемых скриптов
j4flmaoот j4flmao★ 47 звёзд на GitHub

Установить mobile-networking в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Mobile Networking

Purpose

Design mobile networking layers with offline-first architecture, caching strategy, retry logic, pagination, and authentication interceptors.

Agent Protocol

Trigger

User request includes: mobile network, api client mobile, rest mobile, graphql mobile, offline first, api caching mobile, retry mobile, pagination mobile, background sync, api interceptor.

Input Context

  • Platform (iOS, Android, Flutter, React Native)
  • API type (REST, GraphQL, gRPC)
  • Current library (Retrofit, Apollo, Dio, Axios, URLSession)
  • Offline requirements

Output Artifact

A markdown document containing:

  • Network layer architecture
  • Client setup with interceptors
  • Caching strategy
  • Offline-first data flow
  • Pagination approach

Response Format

No preamble. No postamble. No explanations.

Max Response Length

4096 tokens

Decision Trees

API Style Selection

What API style does the backend expose?
├── REST (standard CRUD, simple endpoints)
│   ├── iOS → URLSession + async/await or Alamofire
│   ├── Android → Retrofit + OkHttp
│   ├── Flutter → Dio or http
│   └── React Native → Axios or fetch
├── GraphQL (flexible queries, real-time subs)
│   ├── iOS → Apollo iOS
│   ├── Android → Apollo Kotlin
│   ├── Flutter → graphql_flutter
│   └── React Native → Apollo Client
├── gRPC (high-performance, streaming)
│   ├── Need protobuf codegen and HTTP/2
│   └── Limited mobile adoption; prefer REST/GraphQL for most apps
└── WebSocket (real-time, bidirectional)
    ├── iOS → URLSessionWebSocketTask
    └── Android → OkHttp WebSocket

Caching Strategy

How fresh must the data be?
├── Real-time (chat, live scores) → No cache, invalidate on new data
├── Recent (feeds, listings) → Stale-while-revalidate (5 min TTL)
├── Reference (settings, product catalog) → Cache-first (24h TTL)
└── Offline-critical (map tiles, articles) → Preload + persistent cache

Pagination Type

API response structure?
├── Has next/prev page tokens → Cursor-based (infinite scroll, preferred)
├── Offset + limit → Offset-based (page number, can skip)
├── HasMore boolean with last ID → Keyset pagination (efficient for large data)
└── Sort by timestamp → Time-based pagination (before/after timestamp)

Offline-First Strategy

Is connectivity reliable?
├── Mostly online (social, messaging) → Network-first, cache fallback
├── Sometimes offline (news, reference) → Cache-first, background refresh
├── Often offline (field work, travel) → Offline-first with sync queue
└── Must work offline (aviation, medical) → Pre-sync all data, local-first

Workflow

Step 1: Set Up HTTP Client

Configure platform-specific client with base URL, timeouts, and default headers.

Step 2: Add Interceptors

Implement auth token injection, retry on 401, request logging, and error transformation.

Step 3: Implement Offline-First Strategy

Build cache-check-first flow: return cached data then refresh in background, with network failure fallback to cache.

Step 4: Implement Pagination

Use cursor-based pagination with configurable page size, hasMore flag, and append behavior for infinite scroll.

Step 5: Configure Background Sync

Queue failed write operations for retry when connectivity resumes, with conflict resolution strategy.

Rules

  • Network layer must be fully abstracted behind repository interfaces
  • Auth token refresh must be transparent — interceptors handle 401 → refresh → retry
  • Offline-first: always show cached data immediately, refresh in background
  • Pagination must track loading state per page, not globally
  • All network errors must be mapped to domain-specific error types
  • Cache staleness TTL must be configurable per data type
  • Retry idempotent requests with capped exponential backoff and jitter for transient failures (connection errors, 408, 429, 502, 503, 504; honour Retry-After)
  • Certificate pinning only with a rotation plan (pin SPKI hashes with backup pins, remote kill switch); for most apps platform TLS plus ATS / network security config is the baseline
  • Never log sensitive data (tokens, passwords, PII)

REST Client Setup

Flutter — Dio

import 'package:dio/dio.dart';

final dio = Dio(BaseOptions(
  baseUrl: 'https://api.example.com',
  connectTimeout: const Duration(seconds: 10),
  receiveTimeout: const Duration(seconds: 10),
  sendTimeout: const Duration(seconds: 10),
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  },
));

dio.interceptors.add(AuthInterceptor());
dio.interceptors.add(RetryInterceptor());
dio.interceptors.add(LogInterceptor(requestBody: true, error: true));

React Native — Axios

import axios, { AxiosInstance, AxiosError } from 'axios';

const api: AxiosInstance = axios.create({
  baseURL: 'https://api.example.com',
  timeout: 10000,
  headers: { 'Content-Type': 'application/json' },
});

api.interceptors.request.use(async (config) => {
  const token
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/caching.md
  • references/graphql-mobile.md
  • references/mobile-networking-patterns.md
  • references/network-layer-architecture.md
  • references/offline-first.md
  • references/rest-client.md

FAQ

Что делает скилл mobile-networking?

Use when the user asks about mobile networking: REST or GraphQL clients, Retrofit, OkHttp, URLSession, Dio, interceptors, token refresh, retries, pagination or response caching on device. Produces a typed API client layer with timeouts and error handling. Not for offline sync design (use mobile-offline-first) or certificate pinning (use mobile-security).

Как установить скилл mobile-networking?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mobile-networking запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mobile-networking с