muxy-extension
Best-practice guide for authoring a Muxy extension — how it should look and behave so it reads as a native part of the app. Covers theming (follow the theme, never hardcode colors), the sizing scale, and which surface to use.
Install / Use
npx skills add muxy-app/extensionsInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
MarketingSupported Platforms
Skill content
View source on GitHubname: muxy-extension description: Best-practice guide for authoring a Muxy extension — how it should look and behave so it reads as a native part of the app. Covers theming (follow the theme, never hardcode colors), the sizing scale, and which surface to use. Mechanics (manifest fields, permissions, the window.muxy API) live in the linked docs.
Muxy Extension Guide
A Muxy extension is an npm + Vite project: source under src/, an entry HTML that vite build emits into dist/, and Muxy reads dist/ when present (otherwise the project folder). The manifest is the "muxy" object in package.json. There is no fixed folder layout — every entry/background/icon path is an arbitrary relative path inside the build output (the vanilla starter kit emits its panel to panel/index.html); package.json and dist/ are the only names Muxy fixes. During development you don't copy into the config folder — Load Unpacked in the Extensions modal points Muxy at any folder (your git checkout is the install).
This skill is the guidance layer — how an extension should look and behave. For the API and manifest mechanics (every field, the permission strings, the full window.muxy surface, events, scripts), read the reference docs. Start from the LLM-friendly index, which lists every page and links to its raw Markdown source:
Append /plain to any docs URL for the raw Markdown of that page (e.g. https://muxy.app/docs/extensions/manifest/plain).
The goal of everything below: an extension should be indistinguishable from a native Muxy surface. Match the theme and match the scale, and it will be.
Pick the right surface
- Showing something to the user → a UI page (tab, panel, or popover). Page scripts get the full
window.muxyAPI. - Reacting durably to events, coordinating multiple webviews, or running shell commands headlessly → a
background.jsscript. Most extensions don't need one. - One-shot logic from the palette → a
runScriptcommand, not a hidden tab. Itsmuxy.*calls are synchronous (return values directly — noawait). It hastabs/panes/projects/worktrees/files/git/exec/dialog/modal/topbar/statusbar/notifications, but nothttp,events,remote,panels, orpopover. It can open a modal and act on the choice inline — no page or background listener needed.
Don't open a hidden tab to run logic, and don't put durable event-driven work in tab JS where closing the tab loses it. Use muxy.events.emit('extension.<name>', payload) plus a background listener when a webview needs to ask background.js for shared or long-lived work.
Theme — follow it, never hardcode
Muxy ships paired light/dark themes and a user-chosen accent. Every extension webview inherits CSS custom properties on document.documentElement that track the live theme and update automatically when the user switches it.
Rules:
- No hex literals for chrome. Use
var(--muxy-…)for every color. The only exception is decorative art meant to be theme-independent. - The variables already invert for light/dark — never sniff the color scheme to pick a color. Only branch on
muxy.theme.colorSchemefor things a variable can't express (e.g. swapping a logo image). --muxy-accentis the only saturated color. Use it sparingly — primary action, focus ring, one key number — so it stays distinctive. Text on an accent fill should be--muxy-backgroundto stay legible in both themes.- Depth comes from
--muxy-surface+--muxy-border+--muxy-hover, not from new colors. Cards, inputs, code blocks, and buttons all share the one surface color. - Re-read the theme for JS-drawn color. Canvas/SVG that doesn't pick up CSS variables must redraw in
muxy.onThemeChange(theme => …). - Popovers leave the body transparent (
body { background: transparent; }) — they sit over native macOS popover material that is already light/dark-aware. Tabs and panels do paint--muxy-backgroundon the body.
The variables (the complete injected set):
| Variable | Use for |
| --- | --- |
| --muxy-background | Page background |
| --muxy-foreground | Primary text |
| --muxy-foreground-muted | Secondary text, labels, captions |
| --muxy-surface | Cards, inputs, code blocks, buttons |
| --muxy-border | 1px borders and dividers |
| --muxy-hover | Hover state for buttons / rows |
| --muxy-accent | Primary action, links, focus rings |
| --muxy-accent-soft | Translucent accent for badges/highlights |
| --muxy-diff-add / --muxy-diff-remove / --muxy-diff-hunk | Diff / success / error / hunk colors |
| --muxy-topbar-height | The app's tab-bar height (see Sizing) |
(muxy.theme.colorScheme gives "light"/"dark" in JS; there is no --muxy-color-scheme CSS var.)
Sizing — match the app's scale
Muxy's native views are built from one scale of values, and all of them scale with the user's interface-scale setting (Settings → Interface). Pick from this scale rather than inventing numbers, so your surface tracks scale changes the way native views do. These are the base (100%) values in px:
Spacing (padding, gap, margin) — 2 · 4 · 6 · 8 · 10 · 12 · 16 · 20 · 24 · 32. No in-between values. Panel rows and content pad 10px left/right; an icon-and-label gap is 8px; adjacent icon buttons sit 4px apart.
Font sizes — 10 caption · 11 footnote/section labels (often uppercased) · 12 body (paths, row text) · 13 controls · 14 titles (weight 600) · 16+ headings. Body is 12, not 13. Use the system font for UI; "SF Mono", Menlo, monospace for code, counts, and hashes.
Icons — 12–14px glyphs at weight 600 (a thinner default weight is the most common reason an extension's icons look foreign). Custom SVG strokes are 1.5px, round caps/joins.
Controls — an icon button is a 24×24 hit target wrapping a 13–14px glyph; text buttons are 28px tall with 10px horizontal padding.
Radii — 4 chips/badges · 6 buttons/inputs · 8 cards/panels · 10 large containers. Buttons are 4–6, not 5.
Topbar height is the exception — never hardcode it. It scales with interface scale and is injected pre-scaled as --muxy-topbar-height. A tab fills its whole region, so render your own topbar to match native tabs (so split panes line up): use that variable for the height and keep box-sizing: content-box so the 1px border-bottom lands on the same line as native tabs. Omit the topbar for edge-to-edge content.
Declare the scale once at the top of your stylesheet and reference it everywhere, so there are no stray magic numbers:
:root {
--s1:2px; --s2:4px; --s3:6px; --s4:8px; --s5:10px;
--s6:12px; --s7:16px; --s8:20px; --s9:24px; --s10:32px;
--font-caption:10px; --font-footnote:11px; --font-body:12px;
--font-emphasis:13px; --font-title:14px;
--icon-sm:12px; --icon:14px; --control:24px;
--radius:6px; --radius-card:8px; --row-height:34px;
}
Behavior
- Least privilege. Declare a permission only when you add the call that needs it.
- Use
muxy.gitfor repository work (status, diff incl.{ raw: true }, repoInfo, log, branches, PRs incl.pr.number/pr.diff, tags, init, checkout/cherryPick/revert, branchdelete/deleteRemote, worktrees incl.worktree.switchToandpr.checkoutWorktree) instead of shelling out viamuxy.exec— it's the app's own git core, returns structured data, and caches reads. Reads needgit:read; writes needgit:writeand prompt for consent. Reads are cached per project/worktree (HEAD/index aware); pass{ fresh: true }to bypass. Available to tabs, panels, popovers,runScriptcommands, and background scripts. See Git. - Use
muxy.filesfor workspace filesystem work (list, read, stat, write, mkdir, rename, move, delete) instead ofmuxy.exec— paths are sandboxed to the active worktree root and returned relative to it. Reads needfiles:read; writes needfiles:writeand prompt for consent. Pair with thefile.changedevent to stay reactive (e.g. a file tree). See Files. - Use
muxy.http.fetchto call external APIs from a tab/panel/popover instead of the webview'sfetch()— the request goes out via native code, so it is not CORS-blocked, and a panel needs nobackground.js(no subprocess) just to reach the network. Pass(url, { method?, headers?, body?, timeoutMs? })andawait{ status, headers, body, truncated }. No manifest permission; the first call to a host prompts for consent, "Allow & remember" whitelists that host. Private/loopback hosts (localhost,127.*,192.168.*,169.254.*,.local, …) are blocked.muxy.httpis a webview-only surface — neither background scripts norrunScriptcommands havefetch; they shell out viamuxy.exec(['curl', …]). See HTTP. - Use
muxy.modal.openfor a list picker (the native searchable picker overlay) instead of building your own — pass{ items: [{ id, title, subtitle? }], placeholder?, onSelect(choice) }; the choice (ornullif dismissed) arrives inonSelect. Muxy owns the search, navigation, and open/close. No permission needed. Available on every surface: onrunScript/backgroundmodal.openreturns immediately and you read the result inonSelect; on webview pages you can alsoawaitit. It has no shortcut of its own: bind a palettecommandwith adefaultShortcut(its action can be therunScriptthat opens the modal, or aneventabackground.jslistener reacts to). For large lists (a file picker over a big repo), passitemsas a functionitems(emit)instead of an array — the picker opens instantly and you stream rows withemit(batch)while Muxy filters them natively, so typing never calls back into your code and the UI can't hang. See Modal. - Use
extension.*events for webview ↔ background communication — pages and background scripts canmuxy.events.subscribe('extension.<name>', handler)andmuxy.events.emit('extension.<name>', payload). These events are same-extension only, need no permission, and are not listed in the manifesteventsarray. A webview emit is relayed through the extension'sbackground.js, so it rejects when no background script is running — webviews can't reach each other directly. Workspace events (pane.*,file.changed, etc.) still require manifestevents. - Update bar items live with
muxy.topbar.set/muxy.statusbar.set— pass{ id, icon?, visible? }(topbar) or{ id, icon?, text?, visible? }(statusbar) frombackground.jsor any page to swap the icon/text or show/hide without reloading;text: nullclears back to the manifest value. Decide visibility at runtime: declare the item with"visible": falseand callmuxy.topbar.show(id)/.hide(id)(ormuxy.statusbar.show(id)/.hide(id)) when it applies. The item must be declared intopbarItems/statusBarItems; needspanels:write. Good for live indicators (e.g. a PR badge that only appears inside a repo). See Topbar / Status bar. - Retitle a tab live with
muxy.tabs.setTitle(title)/muxy.tabs.setIcon(icon)from the tab's own page to reflect changing state (e.g. an editor showing the open file).iconis"<sf-symbol>",{ symbol }, or{ svg };setTitle("")/setIcon(null)reset to the manifest defaults. Needstabs:write; runtime-only (resets on restart, so set it again on load). See Tabs. - Make hover and active states visible in both light and dark —
background: var(--muxy-hover); border-color: var(--muxy-accent);is the standard pattern. - **Respect `prefers
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
84.4kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
73.4kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
82.8k🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ
LocalAI
49.2kLocalAI is the open-source AI engine. Run any model - LLMs, vision, voice, image, video - on any hardware. No GPU required.
Security Score
Audited on Aug 26, 2026
