<< All versions
Skill v1.0.0
currentLLM-judged scan95/100inawy/nawy/nawy-pwa
──Details
PublishedOctober 23, 2026 at 06:32 PM
Content Hashsha256:5cc201e9d63a1091...
Git SHAb1bb9c469686
──Files
Files (1 file, 4.0 KB)
SKILL.md4.0 KBactive
SKILL.md · 49 lines · 4.0 KB
version: "1.0.0" name: nawy-pwa description: Nawy PWA rules: service worker caching and safe updates, offline behavior, manifest, automatic daily reminders and notifications, and portable static deployment. Use when touching service-worker.js, caching, install, notifications or hosting.
Nawy PWA
Offline first
- After the first load, every core flow works with no network: view, add, edit, complete, archive, export.
- The app shell is precached. Data comes from IndexedDB, never from the network.
- Network features (backup, sync, game link) fail quietly and never block the UI.
Service worker
- Cache name carries a version (
nawy-shell-vN). Onactivate, delete old caches. - Precache the shell; use stale-while-revalidate for non-critical assets; never cache API or provider responses as app data.
- Update flow: never call
skipWaiting()ininstall. A new worker installs and waits; the page shows an "update ready" banner (also on load when a worker is already waiting). Only the user's tap sendsSKIP_WAITING, and the page reloads only for that tap, never with an unsent draft (drafts live only in the input) and never in other tabs or on first install. - With a build tool, precache the hashed asset list generated at build time, not a hand-written list.
- Always keep a working offline fallback for navigation requests.
- After any service worker change, test: first install, update from the previous version, and offline reload.
Manifest and install
- Complete manifest: name, short_name,
lang,dir: "rtl", icons including maskable,display: standalone,start_url,scope. - Use relative paths and a configurable base path so the app deploys at a domain root or a subpath.
Reminders and notifications
- Reminders are automatic at platform-appropriate times. There is no user-set reminder time. The decision is
decideReminder()in the Core (page and service worker share it). System notifications only between 07:00 and 20:59 device time, at most 3 a day with 3 hours between them, no pinned intention needed (decision 048); never at night, and a skipped run is not counted. The notification has a «تم ✓» action that marks the pinned intention achieved from the service worker viaachieveRecord()(decision 016); keep that transformation in the Core. - They must work when the app is open, in the foreground or background, and where the browser allows it. Where the platform does not allow background delivery, degrade gracefully and never promise it.
- Ask for notification permission in context, after the user shows intent, never on first load.
- Push (server-sent) is an optional service. It is postponed until a simple serverless, no-cost option exists. Local scheduling and in-app reminders must work without it.
- Notification code sits behind a
Notifierinterface so providers can change.
Deployment portability
text
build -> dist/ -> any static host
- No host-specific code in the app (no Vercel/Netlify/Cloudflare APIs in Core).
- HTTPS is required for service workers; document the headers needed (
Cache-Controlforservice-worker.jsshould allow quick updates). - Keep a release archive of each deployed build so any version can be re-hosted.
- Manifest
theme_colorandbackground_colorequal the dark theme color (#0F1115), matching the darktheme-colormeta: the OS paints the status bar and splash from the manifest before the page's own meta tags apply, so a brand color there shows as a flash (decision 038). - Deploy only through
.github/workflows/pages.yml: tests gate the deploy, andnpm run buildpublishes_site/without dev files. - A container is the portability fallback:
Dockerfile(samebuild-site.jsstep, nginx) anddocker/nginx.conf(service-worker.jsandindex.htmlwithno-cache)..github/workflows/container.ymlbuilds and runs the image and executesscripts/smoke-site.mjsagainst it; the same script checks any host (node scripts/smoke-site.mjs <url>). New dev-only root files must be added toEXCLUDEinscripts/build-site.js.