.gemini/skills/offline-first/SKILL.md
PWA patterns and offline functionality in LivestockAI
npx skillsauth add captjay98/gemini-livestockai 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.
LivestockAI is designed to work offline in areas with unreliable internet connectivity.
Always show sync status to users:
● Synced - Green dot, all data uploaded
◐ Syncing... - Animated, upload in progress
○ Offline (3) - Gray dot, 3 items pending
⚠ Sync Failed - Red, tap to retry
The PWA manifest is in public/manifest.json:
{
"name": "LivestockAI",
"short_name": "LivestockAI",
"start_url": "/",
"display": "standalone",
"theme_color": "#10b981"
}
User Action → IndexedDB (local) → Sync Queue → Server (when online)
import { persistQueryClient } from '@tanstack/react-query-persist-client'
import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister'
const persister = createSyncStoragePersister({
storage: window.localStorage,
})
persistQueryClient({
queryClient,
persister,
})
// app/components/offline-indicator.tsx
export function OfflineIndicator() {
const isOnline = useOnlineStatus()
const pendingCount = usePendingSync()
if (isOnline && pendingCount === 0) {
return <span className="text-green-500">● Synced</span>
}
if (!isOnline) {
return (
<span className="text-gray-500">
○ Offline {pendingCount > 0 && `(${pendingCount})`}
</span>
)
}
return <span className="text-blue-500">◐ Syncing...</span>
}
┌─────────────────────────────────────────────┐
│ ⚠️ Failed to save feed record │
│ │
│ Check your connection and try again. │
│ │
│ [Retry] [Save Offline] │
└─────────────────────────────────────────────┘
rugged-utility - Sync status indicatorstanstack-query - Query persistencedata-ai
Input validation patterns with Zod in LivestockAI server functions
testing
Unit testing patterns with Vitest in LivestockAI
tools
Server → Service → Repository pattern for feature organization
data-ai
Server-side rendering and server functions with TanStack Start in LivestockAI