plasmo
БесплатноБез исполняемых скриптовНе проверенPlasmo is a framework for building browser extensions with React and TypeScript: it generates the Manifest V3 file from your code, bundles popups, content…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Plasmo
Overview
Plasmo is a build framework for browser extensions. File names are the configuration: popup.tsx becomes the popup, files in contents/ become content scripts, background.ts becomes the service worker, options.tsx the options page. The manifest.json is generated, with overrides in package.json. plasmo dev rebuilds with live reload into build/chrome-mv3-dev; plasmo build writes build/chrome-mv3-prod. Companion packages: @plasmohq/storage and @plasmohq/messaging.
Maintenance note: the latest npm releases are plasmo 0.90.5 (May 2025), @plasmohq/storage 1.15.0 and @plasmohq/messaging 0.7.2. If a user is starting a new project and open to alternatives, WXT is another actively used extension framework; do not migrate an existing Plasmo project unprompted.
Instructions
Project setup
pnpm create plasmo # interactive; or: pnpm create plasmo --with-tailwindcss my-extension
cd my-extension
pnpm dev # then load build/chrome-mv3-dev via chrome://extensions > Load unpacked
pnpm build # production bundle in build/chrome-mv3-prod
pnpm package # same plus a .zip for store upload
pnpm build --target=firefox-mv2 # firefox-mv3 is experimental
Everything lives at the project root by default; a src/ directory is optional (follow the docs' src guide to enable it). Permissions and manifest overrides go under manifest in package.json:
{ "manifest": { "host_permissions": ["https://github.com/*"], "permissions": ["alarms", "contextMenus"] } }
Use .env.chrome / .env.firefox and process.env.PLASMO_BROWSER for target-specific values; only PLASMO_PUBLIC_* variables reach client code.
Popup
// popup.tsx
import { useStorage } from "@plasmohq/storage/hook"
function IndexPopup() {
const [enabled, setEnabled] = useStorage<boolean>("isEnabled", true)
return (
<div style={{ padding: 16, width: 320 }}>
<h2>Repo Notes</h2>
<button onClick={() => setEnabled(!enabled)}>{enabled ? "Enabled" : "Disabled"}</button>
</div>
)
}
export default IndexPopup
Content scripts and content-script UI
A .tsx file in contents/ that default-exports a React component is mounted into the page inside a Shadow DOM (overlay on document.body unless you export an anchor).
// contents/repo-overlay.tsx
import cssText from "data-text:~contents/repo-overlay.css"
import type { PlasmoCSConfig, PlasmoGetOverlayAnchor, PlasmoGetStyle } from "plasmo"
export const config: PlasmoCSConfig = {
matches: ["https://github.com/*"],
run_at: "document_idle"
}
// Styles for the shadow DOM must be injected here
export const getStyle: PlasmoGetStyle = () => {
const style = document.createElement("style")
style.textContent = cssText
return style
}
export const getOverlayAnchor: PlasmoGetOverlayAnchor = async () =>
document.querySelector(".repository-content")
export default function RepoOverlay() {
const copy = () => {
const name = document.querySelector("[itemprop='name'] a")?.textContent?.trim()
return navigator.clipboard.writeText(name ?? "")
}
return <button className="repo-btn" onClick={copy}>Copy repo name</button>
}
Other exports: getInlineAnchor / getInlineAnchorList / getOverlayAnchorList (anchor types are "inline" or "overlay"), getRootContainer (replaces the Shadow DOM, which disables getStyle), render. The css array in config applies to the host page itself, not the shadow root; use it only for things like @font-face. A content script without UI is a .ts file exporting config and running its code at top level. Use world: "MAIN" in config to run in the page's JS context (no extension APIs there).
Background service worker and messaging
@plasmohq/messaging handlers are files in background/messages/<name>.ts; sendToBackground calls them by file name. There is no sendToContentScript in this package: use chrome.tabs.sendMessage(tabId, ...) for background-or-popup to content script.
// background/messages/save-item.ts
import type { PlasmoMessaging } from "@plasmohq/messaging"
import { Storage } from "@plasmohq/storage"
const storage = new Storage({ area: "local" })
const handler: PlasmoMessaging.MessageHandler<{ url: string; title: string }> = async (req, res) => {
const items = (await storage.get<object[]>("savedItems")) ?? []
items.push({ ...req.body, savedAt: Date.now() })
await storage.set("savedItems", items)
chrome.action.setBadgeText({ text: String(items.length) })
res.send({ success: true, count: items.length })
}
export default handler
// from a content script or popup
import { sendToBackground } from "@plasmohq/messaging"
const { count } = await sendToBackground({ name: "save-item", body: { url: location.href, title: document.title } })
Long-lived connections use `background/ports/<n
Установить plasmo в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл plasmo?
Plasmo is a framework for building browser extensions with React and TypeScript: it generates the Manifest V3 file from your code, bundles popups, content scripts, background workers and options pages, and gives you hot reload. Use when a user asks to "build a Chrome extension", "create a browser extension with React", "add a content script UI", "use Plasmo storage or messaging", or "package an extension for the Chrome Web Store or Firefox".
Как установить скилл plasmo?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл plasmo запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic