skills/mobile/offline-first/SKILL.md
Local storage, data sync, and conflict resolution for offline-capable apps.
npx skillsauth add timequity/vibe-coder offline-firstInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Option | Use Case | |--------|----------| | AsyncStorage | Simple key-value | | MMKV | Fast key-value | | SQLite | Complex queries | | WatermelonDB | Large datasets, sync |
import { MMKV } from 'react-native-mmkv';
const storage = new MMKV();
// Store
storage.set('user', JSON.stringify(user));
storage.set('token', 'abc123');
// Retrieve
const user = JSON.parse(storage.getString('user') || '{}');
const token = storage.getString('token');
// Delete
storage.delete('token');
async function updateItem(id: string, data: Partial<Item>) {
// 1. Update local immediately
await localDb.update(id, { ...data, _synced: false });
// 2. Update UI
queryClient.setQueryData(['item', id], (old) => ({
...old,
...data,
}));
// 3. Sync to server
try {
await api.updateItem(id, data);
await localDb.update(id, { _synced: true });
} catch (error) {
// Queue for retry
await syncQueue.add({ type: 'update', id, data });
}
}
import NetInfo from '@react-native-community/netinfo';
NetInfo.addEventListener((state) => {
if (state.isConnected) {
syncQueue.processAll();
}
});
// Last-write-wins
if (serverItem.updatedAt > localItem.updatedAt) {
await localDb.update(id, serverItem);
} else {
await api.updateItem(id, localItem);
}
// Or: Manual resolution
if (hasConflict) {
showConflictResolver(serverItem, localItem);
}
function useNetworkStatus() {
const [isOnline, setIsOnline] = useState(true);
useEffect(() => {
return NetInfo.addEventListener((state) => {
setIsOnline(state.isConnected ?? false);
});
}, []);
return isOnline;
}
development
Hidden quality gate that runs before showing "Done!" to user - ensures all tests pass, build succeeds, and requirements met before claiming completion
data-ai
Use when about to claim work is complete or fixed - requires running verification commands and confirming output before making any success claims
tools
Generate UI components from natural language descriptions. Use when: user asks for a page, component, or UI element. Triggers: "create page", "add component", "show form", "make button", "страница", "компонент", "форма".
content-media
10 ready-to-use themes with colors and fonts for consistent styling. Use when: applying visual themes to pages, components, or design systems. Triggers: "theme", "color palette", "color scheme", "fonts", "branding", "visual identity", "design system colors".