一键导入
offline-first-development
Build offline-capable applications with IndexedDB, service workers, background sync, and conflict resolution patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build offline-capable applications with IndexedDB, service workers, background sync, and conflict resolution patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Build USSD applications for African markets — menu design, session management, multi-operator integration, and user experience patterns for feature phones.
Generate AI Act Article 50 compliant disclosure notices, metadata tags, and content marking for AI-generated text, images, audio, and video.
Analyze contracts to identify key clauses, risks, obligations, deadlines, and parties. Multi-language support with focus on French and EU commercial law.
Detect and classify technical debt in AI-generated code — patterns specific to LLM outputs, shallow implementations, missing edge cases, and accumulation signals.
Navigate French notarial acts — fee calculation (emoluments), succession, donation, SCI creation, property transfer, and regulated fee schedules.
Structure a job search for the French/European market — CV format europass, cover letter VOUS-MOI-NOUS, job evaluation scoring, interview prep STAR, salary negotiation with French conventions.
| name | offline-first-development |
| description | Build offline-capable applications with IndexedDB, service workers, background sync, and conflict resolution patterns. |
| version | 1.0.0 |
| last-updated | 2026-04-17 |
| model_tested | claude-sonnet-4-6 |
| category | offline |
| platforms | ["claude-code","codex","gemini-cli","cursor","copilot","windsurf","cline"] |
| language | en |
| geo_relevance | ["global","africa"] |
| priority | medium |
| dependencies | {"mcp":[],"skills":[],"apis":[],"data":[]} |
| update_sources | [{"url":"https://web.dev/articles/offline-cookbook","check_frequency":"yearly","last_checked":"2026-04-21"}] |
| license | MIT |
| 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.
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 mutations
| 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 |
| 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 |
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"
}
// 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;
}
}