When to use this skill
Use this skill whenever the user wants to:
- Build cross-platform desktop applications with Electron
- Understand Electron architecture (main process, renderer process, preload)
- Implement IPC (Inter-Process Communication) between processes
- Create and manage BrowserWindow instances
- Implement menus, tray icons, and native features
- Package and distribute Electron applications
- Use Electron Forge for project scaffolding and building
- Debug and test Electron applications
- Implement security best practices
- Use Electron APIs (app, BrowserWindow, ipcMain, ipcRenderer, etc.)
How to use this skill
This skill is organized to match the Electron official documentation structure (https://www.electronjs.org/zh/docs/latest/, https://www.electronjs.org/zh/docs/latest/api/app). When working with Electron:
Identify the topic from the user's request:
- Getting started/快速开始 →
examples/getting-started/installation.md or examples/getting-started/quick-start.md
- Main process/主进程 →
examples/processes/main-process.md
- Renderer process/渲染进程 →
examples/processes/renderer-process.md
- IPC communication/IPC 通信 →
examples/processes/ipc-communication.md
- BrowserWindow/窗口 →
examples/api/browser-window.md
- Menu/菜单 →
examples/api/menu.md
- Packaging/打包 →
examples/advanced/packaging.md
- Security/安全 →
examples/advanced/security.md
Load the appropriate example file from the examples/ directory:
Getting Started (快速开始) - examples/getting-started/:
examples/getting-started/installation.md - Installing Electron and basic setup
examples/getting-started/quick-start.md - Quick start tutorial
Processes (进程) - examples/processes/:
examples/processes/main-process.md - Main process concepts and usage
examples/processes/renderer-process.md - Renderer process concepts
examples/processes/preload-scripts.md - Preload scripts usage
examples/processes/ipc-communication.md - IPC communication patterns
API Examples (API 示例) - examples/api/:
examples/api/browser-window.md - BrowserWindow usage
examples/api/menu.md - Menu and context menu
examples/api/tray.md - System tray
examples/api/dialog.md - File dialogs
examples/api/ipc-main.md - ipcMain usage
examples/api/ipc-renderer.md - ipcRenderer usage
Advanced (高级) - examples/advanced/:
examples/advanced/packaging.md - Application packaging
examples/advanced/security.md - Security best practices
examples/advanced/auto-updater.md - Auto updater
examples/advanced/native-modules.md - Native modules
Tools (工具) - examples/tools/:
examples/tools/electron-forge.md - Electron Forge usage
examples/tools/electron-fiddle.md - Electron Fiddle usage
Follow the specific instructions in that example file for syntax, structure, and best practices
Important Notes:
- All examples follow Electron latest API
- Examples use both CommonJS (require) and ES modules (import)
- Each example file includes key concepts, code examples, and key points
- Always check the example file for best practices and common patterns
- Electron supports Windows, macOS, and Linux
Reference API documentation in the api/ directory when needed:
api/app.md - app module API
api/browser-window.md - BrowserWindow API
api/ipc-main.md - ipcMain API
api/ipc-renderer.md - ipcRenderer API
api/menu.md - Menu API
api/tray.md - Tray API
Use templates from the templates/ directory:
templates/main-process.md - Main process template
templates/preload-script.md - Preload script template
templates/renderer-process.md - Renderer process template
templates/package-json.md - package.json template
Doc mapping (one-to-one with official documentation)
Examples and Templates
This skill includes detailed examples organized to match the official documentation structure. All examples are in the examples/ directory (see mapping above).
To use examples:
- Identify the topic from the user's request
- Load the appropriate example file from the mapping above
- Follow the instructions, syntax, and best practices in that file
- Adapt the code examples to your specific use case
To use templates:
- Reference templates in
templates/ directory for common scaffolding
- Adapt templates to your specific needs and coding style
API Reference
Detailed API documentation is available in the api/ directory, organized to match the official Electron API documentation structure:
Core APIs (api/)
api/app.md - app module API
api/browser-window.md - BrowserWindow API
api/ipc-main.md - ipcMain API
api/ipc-renderer.md - ipcRenderer API
api/menu.md - Menu API
api/tray.md - Tray API
api/dialog.md - Dialog API
To use API reference:
- Identify the API you need help with
- Load the corresponding API file from the
api/ directory
- Find the API signature, parameters, return type, and examples
- Reference the linked example files for detailed usage patterns
- All API files include links to relevant example files in the
examples/ directory
Best Practices
- Security: Never enable nodeIntegration in renderer process, use preload scripts
- Process separation: Keep main and renderer processes separate
- IPC communication: Use IPC for safe communication between processes
- Resource management: Properly clean up resources (windows, listeners)
- Error handling: Implement proper error handling and crash reporting
- Performance: Optimize for performance, use webContents for debugging
- Packaging: Use Electron Forge or electron-builder for packaging
- Auto updates: Implement auto-updater for production apps
- Native modules: Handle native module compatibility
- Cross-platform: Test on all target platforms
Resources
Keywords
Electron, desktop app, main process, renderer process, preload, IPC, BrowserWindow, Menu, Tray, Dialog, packaging, electron-builder, electron-forge, electron-fiddle, cross-platform, 桌面应用, 主进程, 渲染进程, IPC 通信, 窗口, 菜单, 托盘, 打包
Source: SeventeenLabs/relay — distributed by TomeVault.
1---2name: electron3description: Provides comprehensive guidance for Electron framework including main process, renderer process, IPC communication, window management, and desktop app development. Use when the user asks about Electron, needs to create desktop applications, implement Electron features, or build cross-platform desktop apps.4---56## When to use this skill78Use this skill whenever the user wants to:9- Build cross-platform desktop applications with Electron10- Understand Electron architecture (main process, renderer process, preload)11- Implement IPC (Inter-Process Communication) between processes12- Create and manage BrowserWindow instances13- Implement menus, tray icons, and native features14- Package and distribute Electron applications15- Use Electron Forge for project scaffolding and building16- Debug and test Electron applications17- Implement security best practices18- Use Electron APIs (app, BrowserWindow, ipcMain, ipcRenderer, etc.)1920## How to use this skill2122This skill is organized to match the Electron official documentation structure (https://www.electronjs.org/zh/docs/latest/, https://www.electronjs.org/zh/docs/latest/api/app). When working with Electron:23241. **Identify the topic** from the user's request:25 - Getting started/快速开始 → `examples/getting-started/installation.md` or `examples/getting-started/quick-start.md`26 - Main process/主进程 → `examples/processes/main-process.md`27 - Renderer process/渲染进程 → `examples/processes/renderer-process.md`28 - IPC communication/IPC 通信 → `examples/processes/ipc-communication.md`29 - BrowserWindow/窗口 → `examples/api/browser-window.md`30 - Menu/菜单 → `examples/api/menu.md`31 - Packaging/打包 → `examples/advanced/packaging.md`32 - Security/安全 → `examples/advanced/security.md`33342. **Load the appropriate example file** from the `examples/` directory:3536 **Getting Started (快速开始) - `examples/getting-started/`**:37 - `examples/getting-started/installation.md` - Installing Electron and basic setup38 - `examples/getting-started/quick-start.md` - Quick start tutorial3940 **Processes (进程) - `examples/processes/`**:41 - `examples/processes/main-process.md` - Main process concepts and usage42 - `examples/processes/renderer-process.md` - Renderer process concepts43 - `examples/processes/preload-scripts.md` - Preload scripts usage44 - `examples/processes/ipc-communication.md` - IPC communication patterns4546 **API Examples (API 示例) - `examples/api/`**:47 - `examples/api/browser-window.md` - BrowserWindow usage48 - `examples/api/menu.md` - Menu and context menu49 - `examples/api/tray.md` - System tray50 - `examples/api/dialog.md` - File dialogs51 - `examples/api/ipc-main.md` - ipcMain usage52 - `examples/api/ipc-renderer.md` - ipcRenderer usage5354 **Advanced (高级) - `examples/advanced/`**:55 - `examples/advanced/packaging.md` - Application packaging56 - `examples/advanced/security.md` - Security best practices57 - `examples/advanced/auto-updater.md` - Auto updater58 - `examples/advanced/native-modules.md` - Native modules5960 **Tools (工具) - `examples/tools/`**:61 - `examples/tools/electron-forge.md` - Electron Forge usage62 - `examples/tools/electron-fiddle.md` - Electron Fiddle usage63643. **Follow the specific instructions** in that example file for syntax, structure, and best practices6566 **Important Notes**:67 - All examples follow Electron latest API68 - Examples use both CommonJS (require) and ES modules (import)69 - Each example file includes key concepts, code examples, and key points70 - Always check the example file for best practices and common patterns71 - Electron supports Windows, macOS, and Linux72734. **Reference API documentation** in the `api/` directory when needed:74 - `api/app.md` - app module API75 - `api/browser-window.md` - BrowserWindow API76 - `api/ipc-main.md` - ipcMain API77 - `api/ipc-renderer.md` - ipcRenderer API78 - `api/menu.md` - Menu API79 - `api/tray.md` - Tray API80815. **Use templates** from the `templates/` directory:82 - `templates/main-process.md` - Main process template83 - `templates/preload-script.md` - Preload script template84 - `templates/renderer-process.md` - Renderer process template85 - `templates/package-json.md` - package.json template868788### Doc mapping (one-to-one with official documentation)8990- `examples/` → https://www.electronjs.org/zh/docs/latest/91- `api/` → https://www.electronjs.org/zh/docs/latest/api/app9293## Examples and Templates9495This skill includes detailed examples organized to match the official documentation structure. All examples are in the `examples/` directory (see mapping above).9697**To use examples:**98- Identify the topic from the user's request99- Load the appropriate example file from the mapping above100- Follow the instructions, syntax, and best practices in that file101- Adapt the code examples to your specific use case102103**To use templates:**104- Reference templates in `templates/` directory for common scaffolding105- Adapt templates to your specific needs and coding style106107## API Reference108109Detailed API documentation is available in the `api/` directory, organized to match the official Electron API documentation structure:110111### Core APIs (`api/`)112- `api/app.md` - app module API113- `api/browser-window.md` - BrowserWindow API114- `api/ipc-main.md` - ipcMain API115- `api/ipc-renderer.md` - ipcRenderer API116- `api/menu.md` - Menu API117- `api/tray.md` - Tray API118- `api/dialog.md` - Dialog API119120**To use API reference:**1211. Identify the API you need help with1222. Load the corresponding API file from the `api/` directory1233. Find the API signature, parameters, return type, and examples1244. Reference the linked example files for detailed usage patterns1255. All API files include links to relevant example files in the `examples/` directory126127## Best Practices1281291. **Security**: Never enable nodeIntegration in renderer process, use preload scripts1302. **Process separation**: Keep main and renderer processes separate1313. **IPC communication**: Use IPC for safe communication between processes1324. **Resource management**: Properly clean up resources (windows, listeners)1335. **Error handling**: Implement proper error handling and crash reporting1346. **Performance**: Optimize for performance, use webContents for debugging1357. **Packaging**: Use Electron Forge or electron-builder for packaging1368. **Auto updates**: Implement auto-updater for production apps1379. **Native modules**: Handle native module compatibility13810. **Cross-platform**: Test on all target platforms139140## Resources141142- **Official Website**: https://www.electronjs.org/zh/143- **Documentation**: https://www.electronjs.org/zh/docs/latest/144- **API Reference**: https://www.electronjs.org/zh/docs/latest/api/app145- **Electron Forge**: https://www.electronforge.io146- **Electron Fiddle**: https://www.electronjs.org/zh/fiddle147- **GitHub Repository**: https://github.com/electron/electron148149## Keywords150151Electron, desktop app, main process, renderer process, preload, IPC, BrowserWindow, Menu, Tray, Dialog, packaging, electron-builder, electron-forge, electron-fiddle, cross-platform, 桌面应用, 主进程, 渲染进程, IPC 通信, 窗口, 菜单, 托盘, 打包152153---154> Source: [SeventeenLabs/relay](https://github.com/SeventeenLabs/relay) — distributed by [TomeVault](https://tomevault.io).155<!-- tomevault:4.0:skill_md:2026-06-24 -->