offline-first-development
Skill2 starsChanged 7 months agoMITView on GitHub
Build offline-capable applications with IndexedDB, service workers, background sync, and conflict resolution patterns.
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- africa-mobile-moneySkill
- africa-ussd-developmentSkill
- eu-ai-act-complianceSkill
- eu-ai-act-content-disclosureSkill
- eu-dora-complianceSkill
- eu-nis2-complianceSkill
- eu-regulatory-routerSkill
- gdpr-data-protectionSkill
- fr-open-data-explorerSkill
- devsecops-supply-chainSkill
- contract-analysisSkill
- invoice-processingSkill
- agent-eval-frameworkSkill
- tech-debt-detectorSkill
- skill-lifecycle-managementSkill
- context-engineeringSkill
- find-skillsSkill
- fr-comptabiliteSkill
- fr-droit-immobilierSkill
- fr-facturation-electroniqueSkill
- fr-fec-generatorSkill
- fr-fiscalite-investissementSkill
- fr-fiscalite-particulierSkill
- fr-notariatSkill
- fr-recherche-emploiSkill
- pii-detectionSkill
- api-resilience-patternsSkill
- skill-quality-linterSkill
- skill-security-auditSkill
- data-sovereignty-patternsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 133
Does not implement a specific sync protocol (CRDT, OT)
- Distinctive: line 134
Does not handle real-time collaboration (use dedicated tools)
- Distinctive: line 135
Does not manage authentication tokens offline (security concern)
- Distinctive: line 136
Does not provide a database library (guides architecture choices)
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Offline-First Development
When to Use
- Building apps for low-connectivity environments (rural, Africa, transit)
- Building PWAs that must work without internet
- Designing sync strategies for mobile apps
- Implementing local-first architectures
- Building for environments with unreliable connections
Core Principles
- Local-first: Data lives on the device. Server is backup, not source of truth.
- Sync on reconnect: Queue changes offline, sync when connection returns.
- Conflict resolution: Define merge strategy before building.
- Progressive enhancement: App works offline; online adds features.
Storage Options
| Storage | Size Limit | Persistence | Best For |
| IndexedDB | ~50% of disk | Persistent | Structured data, large datasets |
| Cache API | ~50% of disk | Persistent | HTTP responses, assets |
| localStorage | 5-10 MB | Persistent | Small key-value config |
| OPFS | ~50% of disk | Persistent | File-like access (new) |
Recommendation: IndexedDB for data, Cache API for assets, OPFS for files.
Service Worker Pattern
Install → Cache essential assets (app shell, fonts, icons)
Activate → Clean old caches
Fetch → Cache-first for assets, network-first for API data
Sync → Background sync for queued mutationsCaching Strategies
| Strategy | When | How |
| Cache-first | Static assets (CSS, JS, images) | Serve from cache, update in background |
| Network-first | API data | Try network, fall back to cache |
| Stale-while-revalidate | Semi-static (user profile) | Serve cache, update from network |
| Network-only | Real-time data (chat, payments) | No caching |
Sync Patterns
Optimistic Updates
- Apply change locally immediately
- Queue mutation for sync
- On reconnect: send queued mutations
- On conflict: apply resolution strategy
Conflict Resolution Strategies
| Strategy | When | How |
| Last-write-wins | Simple data, single user | Timestamp comparison |
| Server-wins | Authoritative server | Discard local on conflict |
| Client-wins | User autonomy priority | Overwrite server |
| Merge | Collaborative editing | Field-level merge |
| Manual | Critical data | Show conflict to user |
Queue Design
Mutation queue entry:
{
id: "uuid",
timestamp: "ISO-8601",
entity: "task",
entity_id: "uuid",
action: "create|update|delete",
payload: { ... },
retries: 0,
status: "pending|syncing|failed|synced"
}Connectivity Detection
// Basic
navigator.onLine // boolean (unreliable alone)
// Robust: combine with actual fetch test
async function isOnline() {
try {
const response = await fetch('/api/health', {
method: 'HEAD',
cache: 'no-store',
signal: AbortSignal.timeout(3000)
});
return response.ok;
} catch {
return false;
}
}Mobile-Specific Considerations
- Battery: Batch sync operations, avoid polling
- Bandwidth: Compress payloads, delta sync
- Storage quotas: Monitor usage, evict old data
- App lifecycle: Handle background/foreground transitions
What This Skill Does NOT Do
- Does not implement a specific sync protocol (CRDT, OT)
- Does not handle real-time collaboration (use dedicated tools)
- Does not manage authentication tokens offline (security concern)
- Does not provide a database library (guides architecture choices)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

