electron
БесплатноБез исполняемых скриптовНе проверенElectron framework for building cross-platform desktop applications with JavaScript, HTML, and CSS. Covers architecture, IPC, security, packaging…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Electron Core Knowledge
Deep Knowledge: Use
mcp__documentation__fetch_docswith technology:electronfor comprehensive API documentation.
When NOT to Use This Skill
- Tauri applications - Use the
tauriskill for Rust-based desktop apps - Web applications only - Electron is for desktop apps, not web deployment
- Mobile applications - Electron doesn't support iOS/Android natively
- CLI tools - Use Node.js directly for command-line applications
Architecture
Process Model
┌─────────────────────────────────────────────────────────────┐
│ Main Process │
│ - Node.js Runtime (full access) │
│ - Electron APIs (app, BrowserWindow, ipcMain, dialog) │
└──────────────────────────┬──────────────────────────────────┘
│ IPC Channel
┌──────────────────────────▼──────────────────────────────────┐
│ Preload Script │
│ - Executes before renderer │
│ - Uses contextBridge to expose safe APIs │
└──────────────────────────┬──────────────────────────────────┘
│ contextBridge.exposeInMainWorld()
┌──────────────────────────▼──────────────────────────────────┐
│ Renderer Process │
│ - Chromium Runtime (standard Web APIs) │
│ - No direct Node.js access (by default) │
│ - window.electronAPI (exposed via preload) │
└─────────────────────────────────────────────────────────────┘
Project Structure
electron-app/
├── src/
│ ├── main/ # Main process
│ │ ├── index.ts # Entry point
│ │ ├── window.ts # Window management
│ │ ├── ipc/ # IPC handlers
│ │ └── updater.ts # Auto-updates
│ ├── preload/
│ │ ├── index.ts # Main preload
│ │ └── types.d.ts # Type declarations
│ └── renderer/ # Frontend app
├── resources/ # App icons
├── electron-builder.yml # Packaging config
└── package.json
IPC Communication Essentials
Preload Script
// src/preload/index.ts
import { contextBridge, ipcRenderer } from 'electron';
const electronAPI = {
openFile: () => ipcRenderer.invoke('dialog:openFile'),
saveFile: (content: string) => ipcRenderer.invoke('dialog:saveFile', content),
getVersion: () => ipcRenderer.invoke('app:getVersion'),
};
contextBridge.exposeInMainWorld('electronAPI', electronAPI);
// Event subscriptions
contextBridge.exposeInMainWorld('electronEvents', {
onMenuAction: (callback: (action: string) => void) => {
const handler = (_e: any, action: string) => callback(action);
ipcRenderer.on('menu:action', handler);
return () => ipcRenderer.removeListener('menu:action', handler);
},
});
Main Process Handlers
// src/main/ipc/index.ts
import { ipcMain, dialog, app } from 'electron';
export function registerIpcHandlers() {
ipcMain.handle('dialog:openFile', async () => {
const result = await dialog.showOpenDialog({
properties: ['openFile'],
});
return result.canceled ? null : result.filePaths[0];
});
ipcMain.handle('app:getVersion', () => app.getVersion());
}
Full Reference: See ipc-security.md for complete IPC patterns and type-safe setup.
Security Essentials
Secure BrowserWindow
const win = new BrowserWindow({
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true, // REQUIRED
nodeIntegration: false, // REQUIRED
sandbox: true, // Recommended
webSecurity: true, // NEVER disable
},
});
// Content Security Policy
win.webContents.session.webRequest.onHeadersReceived((details, callback) => {
callback({
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': [
"default-src 'self'",
"script-src 'self'",
"connect-src 'self' https://api.example.com",
].join('; '),
},
});
});
Security Checklist
-
contextIsolation: true- Isolate preload from renderer -
nodeIntegration: false- No Node.js APIs in renderer -
sandbox: true- OS-level process sandboxing - Never expose raw
ipcRendererto renderer - Validate ALL inputs in
ipcMain.handle()handlers - Use
safeStorageAPI for credentials
Full Reference: See ipc-security.md for complete security configuration.
Packaging Quick Start
Electron Builder (electron-builder.yml)
appId: com.company.app
productName: My Application
mac:
hardenedRuntime: true
target: [dmg, zip]
win:
target: [nsis, portable]
linux:
target: [AppImage, deb]
publish:
provider: gith
Установить electron в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditВложенные файлы
FAQ
Что делает скилл electron?
Electron framework for building cross-platform desktop applications with JavaScript, HTML, and CSS. Covers architecture, IPC, security, packaging, auto-updates, and backend integration patterns. USE WHEN: user mentions "Electron", "desktop app", "cross-platform application", asks about "IPC", "main process", "renderer process", "Electron packaging", "auto-updates", "code signing", "Electron security" DO NOT USE FOR: Tauri applications - use `tauri` skill instead
Как установить скилл electron?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл electron запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This 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…
от Anthropic