Command Palette

Search for a command to run...

Назад к скиллам
скилл № 20544

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от 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
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • 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), без исполняемых скриптов.

Похожие скиллы

Сравнить desktop-electron с