Home / Market / safari extension expert

safari extension expert

Build, port, and debug Safari Web Extensions (Manifest V3) and native Swift app bridges for macOS and iOS. Scope host permissions, handle non-persistent backgrounds, and test native messaging.

skill★ 509210 dlgithubCC-BY-4.0 content; MIT code; upstream exceptions applyInstall in CosmosUpstream Source

Documentation & Preview

--- name: safari-extension-expert description: "Build, port, and debug Safari Web Extensions (Manifest V3) and native Swift app bridges for macOS and iOS. Scope host permissions, handle non-persistent backgrounds, and test native messaging." category: development risk: safe source: self source_type: self date_added: "2026-11-30" author: ShianMike tags: [safari, webextension, manifest-v3, swift, macos, ios, browser-extension]

---

Safari Extension Expert

When to Use

Prerequisites

Identify target platforms (macOS, iOS, iPadOS, visionOS), minimum Safari and OS versions, whether an existing WebExtension codebase is being converted via xcrun safari-web-extension-converter, and whether the extension requires native messaging or shared App Group storage. Inspect manifest.json, background/content scripts, and Xcode extension target Info.plist / entitlements before editing.

Design Safari-compatible Manifest V3 and permissions

  1. Target Manifest V3. background is optional (content-script-only or popup-only extensions do not need a background worker); when declared, it must be non-persistent ("background": { "service_worker": "background.js", "type": "module" }, or non-persistent "scripts" or "page"). Safari suspends idle background contexts aggressively, so persist state in browser.storage.local / browser.storage.session rather than module globals.
  2. Prefer Promise-based browser.* APIs (or a small runtime abstraction) and check platform-specific manifest compatibility carefully: Safari supports chrome_url_overrides.newtab on macOS, but does not support bookmarks or history URL overrides (nor newtab on iOS), and Chrome-only APIs such as offscreen or sidePanel behave differently or are unavailable in Safari.
  3. Scope host_permissions to the narrowest required origins or rely on activeTab. Safari prompts users explicitly per website (and per tab on iOS) and treats <all_urls> or *://*/* with high user friction and App Store review scrutiny.
  4. Keep content-script DOM access isolated, declare web_accessible_resources narrowly, and validate every message crossing the content-script ↔ background boundary.

Bridge cleanly to the native Swift host app

Verify locally and on macOS/iOS targets

Example

> Validate a Safari MV3 manifest.json against portability mistakes (persistent: true, unsupported chrome_url_overrides keys or iOS newtab, <all_urls>) while allowing valid manifests without a background key or with macOS newtab, and test a sendNativeMessage bridge wrapper across success and unavailable-host paths.

Run the worked Safari WebExtension contract test with Node.js's built-in test runner (node --test).

Limitations

Safety and Side Effects

Request the minimum permissions and host_permissions needed. Never embed API secrets or signing credentials in extension JS bundles or manifest.json. Obtain authorization before modifying Xcode signing identities, provisioning profiles, or App Store Connect submissions.

Related Skills and Documentation