Mobile Offline Support

Mobile Offline Support

Teaches a coding agent to build offline-first mobile apps with local storage, background sync and conflict resolution for React Native, Android and iOS.

Skill files5 files

references/

templates/

SKILL.md101 lines
1
---
2
name: mobile-offline-support
3
description: >
4
Implement offline-first mobile apps with local storage, sync strategies, and
5
conflict resolution. Covers AsyncStorage, Realm, SQLite, and background sync
6
patterns.
7
---
8
9
# Mobile Offline Support
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Design offline-first mobile applications that provide seamless user experience regardless of connectivity.
22
23
## When to Use
24
25
- Building apps that work without internet connection
26
- Implementing seamless sync when connectivity returns
27
- Handling data conflicts between device and server
28
- Reducing server load with intelligent caching
29
- Improving app responsiveness with local storage
30
31
## Quick Start
32
33
Minimal working example:
34
35
```javascript
36
import AsyncStorage from '@react-native-async-storage/async-storage';
37
import NetInfo from '@react-native-community/netinfo';
38
39
class StorageManager {
40
static async saveItems(items) {
41
try {
42
await AsyncStorage.setItem(
43
'items_cache',
44
JSON.stringify({ data: items, timestamp: Date.now() })
45
);
46
} catch (error) {
47
console.error('Failed to save items:', error);
48
}
49
}
50
51
static async getItems() {
52
try {
53
const data = await AsyncStorage.getItem('items_cache');
54
return data ? JSON.parse(data) : null;
55
} catch (error) {
56
console.error('Failed to retrieve items:', error);
57
return null;
58
}
59
}
60
61
// ... (see reference guides for full implementation)
62
```
63
64
## Reference Guides
65
66
Detailed implementations in the `references/` directory:
67
68
| Guide | Contents |
69
|---|---|
70
| [React Native Offline Storage](references/react-native-offline-storage.md) | React Native Offline Storage |
71
| [iOS Core Data Implementation](references/ios-core-data-implementation.md) | iOS Core Data Implementation |
72
| [Android Room Database](references/android-room-database.md) | Android Room Database |
73
74
## Best Practices
75
76
### ✅ DO
77
78
- Implement robust local storage
79
- Use automatic sync when online
80
- Provide visual feedback for offline status
81
- Queue actions for later sync
82
- Handle conflicts gracefully
83
- Cache frequently accessed data
84
- Implement proper error recovery
85
- Test offline scenarios thoroughly
86
- Use compression for large data
87
- Monitor storage usage
88
89
### ❌ DON'T
90
91
- Assume constant connectivity
92
- Sync large files frequently
93
- Ignore storage limitations
94
- Force unnecessary syncing
95
- Lose data on offline mode
96
- Store sensitive data unencrypted
97
- Accumulate infinite queue items
98
- Ignore sync failures silently
99
- Sync in tight loops
100
- Deploy without offline testing
101

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 11,974 prompts

More by @OpenSourceBuffGuy

See all
Op Stripe Card Editorial prompt image

Op Stripe Card Editorial

Defines a JSON style spec for editorial posters that combine playing-card layout, optical black ink ribbons, monumental serif type and a crisp colour photo of a person on light paper.

image-prompt, json-prompt, placeholders, structured-output, style-reference, poster, editorial, typography, fashion-shoot, portrait, photorealistic, black-and-white, limited-palette, text-rendering, vertical-format, widescreen, symmetry, minimalist, vintage, for-designers, for-photographers, long-form, advanced

Dataverse Python Error Handling prompt image

Dataverse Python Error Handling

Teaches the coding agent how to handle errors and troubleshoot with the Dataverse SDK for Python, including auth, throttling and transient failures.

rule-file, best-practices, debugging, troubleshooting, python, api, authentication, performance-optimization, code, for-developers, cheat-sheet, power-apps, microsoft-365, advanced, long-form, observability, conditional-logic, dataverse

A/B Test Analysis prompt image

A/B Test Analysis

Teaches an AI agent to design and analyse A/B tests in Python, covering sample size, significance testing, effect size and interpreting results.

agent-skill, ab-testing, statistics, data-analysis, data-science, python, pandas, numpy, jupyter, estimation, data-visualization, marketing, for-data-analysts, for-marketers, for-product-managers, code, step-by-step-guide, advanced, long-form, report

Reviews

Loading reviews…

Discussion

Loading comments…