kjuhwa/skills-hub/powersync-custom-sharedworker-override
Claude Code and agent skill by kjuhwa/skills-hub
- community
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-overrideSKILL.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
- Add a Vite alias and matching
tsconfig.jsonpathsentry namedpowersync-web-internalpointing atnode_modules/@powersync/web/lib/src.SharedSyncImplementationis@internaland not in the public exports map, so you need the compiled lib path. - Subclass
SharedSyncImplementationand override onlygenerateStreamingImplementation()— the oneprotectedmethod that controls which storage adapter is used. Copy the parent body, replacenew SqliteBucketStorage(...)withnew TransformableBucketStorage(...)and attach your middleware before returning. - Write a SharedWorker entry file that mirrors PowerSync's original
SharedSyncImplementation.worker.tsbut instantiates your subclass. - 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. - 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.
- Every time you upgrade
@powersync/web, diffSharedSyncImplementation.generateStreamingImplementation()against your override; silent API drift is the main failure mode.
Counter / Caveats
- Safari / iOS / Tauri cannot run this path:
OPFSCoopSyncVFSdoes not support SharedWorker, Tauri'stauri://protocol blocksimport.meta.url-based worker loading, and iOS WKWebView crashes with SharedWorker. KeepenableMultiTabs: false+ the main-thread transformer path for those environments. - Using an internal import path trades public-API stability for feature access. Upgrades of
@powersync/webmay 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 workssrc/db/powersync/worker/ThunderboltSharedSyncImplementation.ts— the subclasssrc/db/powersync/worker/ThunderboltSharedSyncImplementation.worker.ts— the worker entryvite.config.ts:73-82—powersync-web-internalalias
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
- SKILL.md in the repositoryCheckingskills/powersync/powersync-custom-sharedworker-override/SKILL.md
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
[](https://verified-skill.com/skills/kjuhwa/skills-hub/powersync-custom-sharedworker-override)