Web Workers
БесплатноБез исполняемых скриптовНе проверенUse when moving expensive browser work off the main thread with Web Workers, SharedWorker, worker pools, Comlink, transferable objects, Vite/Webpack worker…
от bovinphang827 установок в других каталогахОб этом скилле
Web Workers
Purpose
Move expensive calculations off the main thread and keep input, scrolling, and animations responsive.
Procedure
- Confirm the bottleneck first: consider workers only if the task exceeds about 10ms, user input delay is obvious, FPS drops, or large file parsing/image processing/encryption calculation.
- Choose a communication model: use
postMessagefor simple tasks, use Comlink for functional RPC, use Worker pool for a large number of parallel small tasks, and use SharedWorker for cross-Tab synchronization. - Design the message protocol: request/response types, error types, cancellation or timeout strategies must be clear.
- Prioritize Transferable Objects when transferring large objects; don’t let structured cloning swallow up the benefits brought by Worker.
terminate()when a component or page is unloaded and verify main thread improvements through Profiler, Performance panel or FPS metrics.
Detailed reference
- Load references/basic-worker.md when you need native Worker files, build tool imports, React lifecycle encapsulation and cleanup examples.
- Load references/advanced-workers.md when Transferable Objects, Comlink, Worker pool, SharedWorker, CSP and SharedArrayBuffer considerations are required.
Constraints
- Cannot access DOM,
window,document,alert()or synchronizelocalStoragewithin Worker. - High frequency communication may be slower than main thread calculations; measure first then split.
- Worker files must be loaded from the same source and are subject to
worker-srcCSP restrictions. - Large binary data is transferred first, and the original reference will become invalid after the transfer.
- Each Worker has an independent JS heap and must actively manage life cycle and memory.
Expected Output
Computationally intensive operations are performed on a background thread, main thread input and scrolling resume smoothly, error and cancellation paths are clear, and workers are terminated on unloading without memory leaks.
Установить Web Workers в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Web Workers?
Use when moving expensive browser work off the main thread with Web Workers, SharedWorker, worker pools, Comlink, transferable objects, Vite/Webpack worker integration, or UI responsiveness fixes. Do not use for lightweight synchronous work or DOM manipulation; Chinese triggers include Web Worker, background thread, main thread blocking.
Как установить скилл Web Workers?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Web Workers запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic