Claude-skill-registry electron
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.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/electron" ~/.claude/skills/majiayu000-claude-skill-registry-electron-85a012 && rm -rf "$T"
skills/data/electron/SKILL.mdWhen 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/快速开始 →
orexamples/getting-started/installation.mdexamples/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
- Getting started/快速开始 →
-
Load the appropriate example file from the
directory:examples/Getting Started (快速开始) -
:examples/getting-started/
- Installing Electron and basic setupexamples/getting-started/installation.md
- Quick start tutorialexamples/getting-started/quick-start.md
Processes (进程) -
:examples/processes/
- Main process concepts and usageexamples/processes/main-process.md
- Renderer process conceptsexamples/processes/renderer-process.md
- Preload scripts usageexamples/processes/preload-scripts.md
- IPC communication patternsexamples/processes/ipc-communication.md
API Examples (API 示例) -
:examples/api/
- BrowserWindow usageexamples/api/browser-window.md
- Menu and context menuexamples/api/menu.md
- System trayexamples/api/tray.md
- File dialogsexamples/api/dialog.md
- ipcMain usageexamples/api/ipc-main.md
- ipcRenderer usageexamples/api/ipc-renderer.md
Advanced (高级) -
:examples/advanced/
- Application packagingexamples/advanced/packaging.md
- Security best practicesexamples/advanced/security.md
- Auto updaterexamples/advanced/auto-updater.md
- Native modulesexamples/advanced/native-modules.md
Tools (工具) -
:examples/tools/
- Electron Forge usageexamples/tools/electron-forge.md
- Electron Fiddle usageexamples/tools/electron-fiddle.md
-
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
directory when needed:api/
- app module APIapi/app.md
- BrowserWindow APIapi/browser-window.md
- ipcMain APIapi/ipc-main.md
- ipcRenderer APIapi/ipc-renderer.md
- Menu APIapi/menu.md
- Tray APIapi/tray.md
-
Use templates from the
directory:templates/
- Main process templatetemplates/main-process.md
- Preload script templatetemplates/preload-script.md
- Renderer process templatetemplates/renderer-process.md
- package.json templatetemplates/package-json.md
Doc mapping (one-to-one with official documentation)
→ https://www.electronjs.org/zh/docs/latest/examples/
→ https://www.electronjs.org/zh/docs/latest/api/appapi/
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
directory for common scaffoldingtemplates/ - 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 module APIapi/app.md
- BrowserWindow APIapi/browser-window.md
- ipcMain APIapi/ipc-main.md
- ipcRenderer APIapi/ipc-renderer.md
- Menu APIapi/menu.md
- Tray APIapi/tray.md
- Dialog APIapi/dialog.md
To use API reference:
- Identify the API you need help with
- Load the corresponding API file from the
directoryapi/ - 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
directoryexamples/
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
- Official Website: https://www.electronjs.org/zh/
- Documentation: https://www.electronjs.org/zh/docs/latest/
- API Reference: https://www.electronjs.org/zh/docs/latest/api/app
- Electron Forge: https://www.electronforge.io
- Electron Fiddle: https://www.electronjs.org/zh/fiddle
- GitHub Repository: https://github.com/electron/electron
Keywords
Electron, desktop app, main process, renderer process, preload, IPC, BrowserWindow, Menu, Tray, Dialog, packaging, electron-builder, electron-forge, electron-fiddle, cross-platform, 桌面应用, 主进程, 渲染进程, IPC 通信, 窗口, 菜单, 托盘, 打包