- Home
- Skills
- Mobile Development
- Data Fetching for Mobile Apps: Loading, Errors, Caching, Offline
More screenshots
Works with the AI Agents you already use
Data Fetching for Mobile Apps: Loading, Errors, Caching, Offline
Build a mobile app's data layer once: one fetch wrapper, a status-based error taxonomy, honest loading, empty, error, and offline states, and drafts that survive failed saves.
$5
Data Fetching for Mobile Apps: Loading, Errors, Caching, Offline
Example session with this skill installed
My plant-care app's watering list goes blank on the subway, shows the wrong home screen on cold start sometimes, and a failed save wipes the plant note. Help me fix the data layer.
- Read your context and instructions
- Compiled the data fetching
PLAN (fictional Sprout & Stone plant-care app, invented for this demo) — Watering list screen: reads one list, freshness minutes, offline shows yesterday's list with an offline notice. State plan applied: skeleton rows on first load; list on success; "No plants due — add one" when empty; banner plus retry when a refresh fails over cached plants; full error state only when the first fetch fails. BLANK ON THE SUBWAY — diagnosed: the screen treated a failed refresh as a full error and discarded cached data. Fix: cached content stays, failure becomes a banner; connectivity signal separates offline from failed, so the subway shows the offline notice over yesterday's list, never a blank screen. WRONG HOME SCREEN — diagnosed: the first screen judged sign-in before stored session state loaded. Fix: render nothing until stored state loads; cold starts now land correctly every time. WIPED NOTE — diagnosed: the save handler cleared the form on any failure. Fix: one wrapper, typed errors; a failed save keeps the draft, shows the problem inline, and offers retry; optimistic edits roll back to the last confirmed value. AUTH — token expiry mid-session now runs one single-flight refresh, other requests wait and replay once; a failed refresh routes to sign-in without looping. RUBRIC — states 2, errors 2, cache 2, auth 2, mutations 2, cleanup 2. Verified: airplane mode, forced save failure, killed mid-refresh, expired token — all honest states, no blank screens, no lost drafts. Environment check in the same review: no secrets in client-baked variables, required keys fail fast at startup.
Connects securely to your tools. The creator never sees your data.
About this skill
Every networked screen follows the same arc — request, state, failure, refresh, cleanup — and this skill builds that arc once as shared plumbing instead of letting every screen invent its own broken version. It starts with a per-screen data contract: what each screen reads and writes, how fresh the data must be, and whether it must work offline. One fetch wrapper checks status, parses the body once, and raises a typed error; screens branch on status codes through a full taxonomy (401 refresh-and-replay, 403 permission, 404 not-found, 409 conflict, 422 validation, 429 backoff, 5xx retryable) instead of on message text. The four screen states are designed honestly, including the overlaps: loading is never shown as empty, a failed refresh over cached data is a banner rather than a full-screen error, empty states name the cause and the next action, and first paint waits for stored state so cold starts never flash the wrong screen. Machinery is chosen by the job — cache library for shared data, a small hook for one-off fetches, route loaders for web-only route data — with cache timing in minutes and retries for safe reads only. Auth runs through one wrapper with single-flight token refresh, mutations keep drafts on failure with a written conflict rule, offline is a distinct state with cached data underneath, and secrets stay out of client-baked variables. Includes a per-screen state plan, a wrapper contract, a six-dimension readiness rubric, and a complete invented worked example.
- It designs the data layer and reviews your implementation; it cannot run your app or test it on a device itself — the pre-ship checks run on your side.
- Backend behavior (status codes, idempotency of writes) must match the contract you describe; if the API returns mixed success and error shapes, the wrapper normalizes them only as far as you document them.
- Cache timing and offline expectations are set from the freshness needs you state; wrong inputs there produce wrong timings, honestly labeled in the plan.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 3 days ago
Permissions
No special permissions declared or detected