desktop-electron
Use when the user asks about Electron, main and renderer process IPC security, contextBridge and preload scripts, contextIsolation and sandbox, Electron Forge…
от j4flmao★ 47 звёзд на GitHub
Установить desktop-electron в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Electron
Purpose
Build cross-platform desktop applications using Electron — combining Chromium (for rendering) and Node.js (for system access). Electron enables web technologies (HTML, CSS, JavaScript/TypeScript) to deliver native-capable desktop experiences with access to the file system, operating system APIs, native menus, and auto-updating.
Agent Protocol
Trigger
Exact user phrases: "Electron app", "main process", "renderer process", "IPC", "preload script", "contextBridge", "electron-builder", "electron-forge", "native module", "auto-updater", "BrowserWindow".
Input Context
- Electron version (>= 28 recommended for security)
- Framework (React, Vue, Svelte, Angular, vanilla)
- Build tool (Vite, webpack, esbuild)
- Required OS APIs (file system, notifications, clipboard, USB/serial, native dialogs)
- Distribution needs (Windows, macOS, Linux; auto-update; code signing)
- Performance constraints (memory, startup time, renderer count)
Output Artifact
Electron architecture plan with process model, IPC strategy, security configuration, build pipeline, and distribution setup.
Response Format
Processes: main {responsibilities} | preload {exposed API} | renderer {framework}
Security: contextIsolation, sandbox, nodeIntegration=false, CSP, fuses
IPC: {channel -> invoke/handle signature, validation}
Build/Update: {Electron Forge|electron-builder}, signing, autoUpdater
Code: {files}
Completion Criteria
- Main process architecture defined (BrowserWindow creation, lifecycle)
- IPC communication pattern selected (contextBridge + ipcRenderer/ipcMain)
- Security best practices applied (contextIsolation, sandbox, CSP)
- Window management strategy (single, multi-window, tray)
- Native module strategy (node-addon, N-API, Rust via napi-rs)
- Build pipeline configured (electron-builder or electron-forge)
- Auto-update mechanism planned (electron-updater or Squirrel)
- Code signing configured for macOS + Windows
- Performance optimization plan (preload, lazy loading, worker threads)
Max Response Length
250 lines.
Framework/Methodology
Electron Architecture Decision Tree
What is the primary app architecture?
├── Single-window app (simple, chat, media player)
│ → One BrowserWindow → preload.js → renderer MVC
│ → Menu bar optional, tray optional
├── Multi-window MDI (image editor, IDE, dashboard)
│ → Window manager in main process → per-window state
│ → Shared data via main process (not localStorage)
├── Hidden background app (menubar/tray utility)
│ → No visible window on start → Tray → Show on demand
│ → `LSUIElement` in Info.plist / `app.dock.hide()` on macOS
└── Kiosk / fullscreen display app
→ BrowserWindow with fullscreen, frame: false
→ No dev tools, locked-down IPC, remote kill switch
Process Model
Main Process (Node.js)
├── BrowserWindow management
├── IPC handlers (ipcMain.handle)
├── Native menu, tray, dialog, notifications
├── File system, shell, child_process
├── Auto-updater
└── App lifecycle (ready, window-all-closed, activate)
↕ contextBridge (preload.js)
Renderer Process (Chromium)
├── DOM and rendering
├── IPC to main (ipcRenderer.invoke)
├── Limited Node.js (via preload)
└── Web APIs (no direct fs, OS access)
Workflow
Step 1: Configure Security (Mandatory)
// main.js - Security-focused BrowserWindow
const mainWindow = new BrowserWindow({
width: 1200,
height: 800,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
// These are the defaults in current Electron (contextIsolation since 12, sandbox since 20,
// nodeIntegration=false since 5) - set them explicitly so nobody flips them by accident.
contextIsolation: true, // isolate preload/Electron internals from page scripts
nodeIntegration: false, // no Node.js in the renderer
sandbox: true, // Chromium OS-level sandbox for the renderer
webSecurity: true, // keep same-origin policy (never disable)
disableBlinkFeatures: 'Auxclick', // Disable unused features
}
});
// Content Security Policy (set via meta tag or response header)
// <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
// Block unexpected navigation and new windows in every webContents
app.on('web-contents-created', (_event, contents) => {
contents.on('will-navigate', (event, url) => {
const devUrl = process.env.VITE_DEV_SERVER_URL;
if (!(devUrl && url.startsWith(devUrl)) && !url.startsWith('file://')) event.preventDefault();
});
contents.setWindowOpenHandler(({ url }) => {
if (url.startsWith('https://')) void shell.openExternal(url); // open web links in the system browser
return { action: 'deny' };
});
});
Step 2: Set Up IPC with contextBridge
// preload.js - Expose minimal, typed API to renderer
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.e
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/electron-advanced.md
- references/electron-architecture.md
- references/electron-fundamentals.md
- references/electron-packaging.md
- references/electron-performance.md
- references/electron-security.md
FAQ
Что делает скилл desktop-electron?
Use when the user asks about Electron, main and renderer process IPC security, contextBridge and preload scripts, contextIsolation and sandbox, Electron Forge or electron-builder packaging, code signing or auto-update. Produces a secure Electron app structure and release setup. Not for Tauri apps (use desktop-tauri).
Как установить скилл desktop-electron?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл desktop-electron запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…