kjuhwa/skills-hub/powersync-custom-sharedworker-override

Claude Code and agent skill by kjuhwa/skills-hub

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Ship a custom SharedWorker that extends PowerSync's internal SharedSyncImplementation so you can inject a custom BucketStorageAdapter (e.g. a TransformableBucketStorage) without giving up multi-tab sync efficiency.

Install

npx vskill@latest install kjuhwa/skills-hub/powersync-custom-sharedworker-override

SKILL.md

The same SKILL.md was published earlier as kjuhwa/skills-hub/powersync-custom-sharedworker-override.

When to use

You run PowerSync on Chrome/Edge/Firefox with enableMultiTabs: true, and you need the SharedWorker to use a custom BucketStorageAdapter (e.g. to decrypt sync data). The default SharedWorker hardcodes new SqliteBucketStorage(...) and ignores any adapter you configure on the main thread.

Steps

  1. Add a Vite alias and matching tsconfig.json paths entry named powersync-web-internal pointing at node_modules/@powersync/web/lib/src. SharedSyncImplementation is @internal and not in the public exports map, so you need the compiled lib path.
  2. Subclass SharedSyncImplementation and override only generateStreamingImplementation() — the one protected method that controls which storage adapter is used. Copy the parent body, replace new SqliteBucketStorage(...) with new TransformableBucketStorage(...) and attach your middleware before returning.
  3. Write a SharedWorker entry file that mirrors PowerSync's original SharedSyncImplementation.worker.ts but instantiates your subclass.
  4. Wire it up in the PowerSync database config: sync: { worker: () => new SharedWorker(new URL('./worker/YourSharedSyncImplementation.worker.ts', import.meta.url), { type: 'module', name: 'shared-sync-<dbFilename>' }) }. Vite detects this pattern and bundles the worker as a separate ES module chunk.
  5. Access side-channel data (like content keys) directly from IndexedDB inside the worker — transformer functions cannot be passed in at runtime because Comlink cannot serialize closures.
  6. Every time you upgrade @powersync/web, diff SharedSyncImplementation.generateStreamingImplementation() against your override; silent API drift is the main failure mode.

Counter / Caveats

  • Safari / iOS / Tauri cannot run this path: OPFSCoopSyncVFS does not support SharedWorker, Tauri's tauri:// protocol blocks import.meta.url-based worker loading, and iOS WKWebView crashes with SharedWorker. Keep enableMultiTabs: false + the main-thread transformer path for those environments.
  • Using an internal import path trades public-API stability for feature access. Upgrades of @powersync/web may silently move or rename files without TypeScript errors because the path is string-aliased.
  • Any middleware you need at runtime must be importable from worker code — no closures, no factory parameters, no runtime registration from the main thread.

Evidence

  • docs/powersync-sync-middleware.md:136-207 — why the multi-tab constraint exists and how the override works
  • src/db/powersync/worker/ThunderboltSharedSyncImplementation.ts — the subclass
  • src/db/powersync/worker/ThunderboltSharedSyncImplementation.worker.ts — the worker entry
  • vite.config.ts:73-82 — powersync-web-internal alias

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kjuhwa/skills-hub/powersync-custom-sharedworker-override/badge)](https://verified-skill.com/skills/kjuhwa/skills-hub/powersync-custom-sharedworker-override)

Something wrong with this skill or its page? Tell us.