with one click
dev
// Develop and maintain the PWAFire PWA utilities library. Use when working on pwafire package, adding PWA APIs, fixing modules, writing tests, or contributing to the PWAFire codebase.
// Develop and maintain the PWAFire PWA utilities library. Use when working on pwafire package, adding PWA APIs, fixing modules, writing tests, or contributing to the PWAFire codebase.
| name | dev |
| description | Develop and maintain the PWAFire PWA utilities library. Use when working on pwafire package, adding PWA APIs, fixing modules, writing tests, or contributing to the PWAFire codebase. |
Use this skill when working on:
packages/pwafire/ source code{ ok: boolean, message: string, ...data? }Use sync when the underlying browser API is synchronous:
navigator.onLine, document.visibilityState, matchMedia().matchesnew BroadcastChannel(), postMessage(), close()connectivity, visibility, displayMode, broadcastUse async when the API returns a Promise or requires user interaction:
navigator.clipboard.*, navigator.share(), requestFullscreen(), file pickers, etc.Every PWA module function must use this structure (async when API is async):
export const apiName = async (...args) => {
try {
if (!featureAvailable) return { ok: false, message: "API not supported" };
const result = await someAPI(...args);
return { ok: true, message: "Success", ...data };
} catch (error) {
return {
ok: false,
message: error instanceof Error ? error.message : "Failed"
};
}
};
For sync APIs, omit async and await. Feature detection โ { ok: false, message: "API not supported" }
{ ok: true, message: "...", ...optionalData }"Failed to {action}" or "{API} API not supported"| Kind | Style | Examples |
|---|---|---|
| Functions/variables | camelCase | webShare, copyText |
| Files/directories | kebab-case | lazy-load, idle-detection |
| Constants | SCREAMING_SNAKE_CASE | MAX_RETRY_ATTEMPTS |
| Types | PascalCase | ResponseType, ConfigOptions |
check.webShare() for webShare()screenShare not screenSharingControlsThe 7 ESLint any warnings are expected. Do not fix by defining custom interfaces.
Affected modules: barcode, contacts, content-indexing, files, idle-detection, screen.
Use unknown and as any for experimental APIs without TypeScript definitions.
Do NOT:
Do:
cd packages/pwafire
npm run lint # 0 errors (7 warnings OK)
npm run build # CJS, ESM, DTS generated
npm test # All tests pass
<type>(<scope>) - <description>
PR titles use the same format as commit messages.
Examples: feat(notifications) - add support for notification actions, fix(lazy-load) - prevent CSS injection
packages/pwafire/src/
โโโ pwa/ # One module per feature (e.g. badging/, clipboard/)
โโโ check/ # Feature detection utilities
โโโ index.ts # Main entry
โโโ types.d.ts # Minimal type definitions
lib/ (build output)For full guidelines, see project docs:
Agents (style guides): docs/agents/
code-style.md - Formatting, type safetynaming-conventions.md - Naming rulesfile-organization.md - Module structurecommit-style.md - Commit and PR formattesting-style.md - Test patternsconsole.md - Console appAPIs: docs/apis/ - Unique API docs (passkey, broadcast, system)
system.md - Sync APIs (connectivity, visibility, displayMode)