When to use this skill
Use this skill whenever the user wants to:
- Install and set up Electron EGG in a project
- Create Electron desktop applications
- Use Electron EGG core features
- Configure Electron EGG
- Handle main process and renderer process communication
- Use Electron EGG API methods
- Build and package Electron applications
- Troubleshoot Electron EGG issues
How to use this skill
This skill is organized to match the Electron EGG official documentation structure (https://www.kaka996.com/, https://www.kaka996.com/pages/987b1c/, https://www.kaka996.com/pages/a99b72/). When working with Electron EGG:
Identify the topic from the user's request:
- Installation/安装 →
examples/guide/installation.md
- Quick Start/快速开始 →
examples/guide/quick-start.md
- Features/功能特性 →
examples/features/
- API/API 文档 →
api/
Load the appropriate example file from the examples/ directory:
Guide (使用文档):
examples/guide/intro.md - Introduction to Electron EGG
examples/guide/installation.md - Installation guide
examples/guide/quick-start.md - Quick start guide
examples/guide/project-structure.md - Project structure
examples/guide/configuration.md - Configuration
examples/guide/build.md - Build and package
Features (功能特性):
examples/features/main-process.md - Main process
examples/features/renderer-process.md - Renderer process
examples/features/ipc-communication.md - IPC communication
examples/features/window-management.md - Window management
examples/features/menu.md - Menu
examples/features/tray.md - System tray
examples/features/auto-updater.md - Auto updater
examples/features/plugin-system.md - Plugin system
Follow the specific instructions in that example file for syntax, structure, and best practices
Important Notes:
- Electron EGG is based on Electron and Egg.js
- Main process and renderer process separation
- IPC communication between processes
- Each example file includes key concepts, code examples, and key points
Reference API documentation in the api/ directory when needed:
api/main-api.md - Main process API
api/renderer-api.md - Renderer process API
api/ipc-api.md - IPC API
api/window-api.md - Window API
api/config-api.md - Configuration API
API Files:
api/main-api.md - Application class, BrowserWindow, ipcMain, app methods
api/renderer-api.md - ipcRenderer, contextBridge, DOM APIs
api/ipc-api.md - IPC communication methods and events
api/window-api.md - Window creation and management
api/config-api.md - Configuration options and environment variables
Use templates from the templates/ directory:
templates/installation.md - Installation templates
templates/project-setup.md - Project setup templates
templates/configuration.md - Configuration templates
1. Understanding Electron EGG
Electron EGG is a desktop application development framework based on Electron and Egg.js, providing a complete development toolchain and best practices.
Key Concepts:
- Electron: Cross-platform desktop application framework
- Egg.js: Node.js enterprise application framework
- Main Process: Main application process
- Renderer Process: UI rendering process
- IPC: Inter-process communication
- Plugin System: Extensible plugin architecture
2. Installation
Using npm:
npm install electron-egg
Using yarn:
yarn add electron-egg
Using pnpm:
pnpm add electron-egg
3. Basic Setup
// main.js
const { Application } = require('electron-egg')
const app = new Application({
// Configuration
})
app.start()
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 EGG API documentation structure (https://www.kaka996.com/pages/a99b72/):
Main Process API (api/main-api.md)
- Application class and methods
- BrowserWindow creation and management
- ipcMain IPC handling
- Application lifecycle hooks
Renderer Process API (api/renderer-api.md)
- ipcRenderer IPC communication
- contextBridge for secure API exposure
- DOM APIs available in renderer
- Event handling
IPC API (api/ipc-api.md)
- IPC communication methods (ipcMain, ipcRenderer)
- Message sending and receiving
- Async and sync IPC
- Event handling and channels
Window API (api/window-api.md)
- BrowserWindow creation and options
- Window management methods
- Window events
- Window lifecycle
Configuration API (api/config-api.md)
- Configuration file structure
- App info configuration
- Window configuration
- Plugin configuration
- Environment variables
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
- Separate processes: Keep main process and renderer process code separate
- Use IPC: Use IPC for inter-process communication
- Handle errors: Properly handle errors in both processes
- Security: Follow Electron security best practices
- Performance: Optimize application performance
- Build configuration: Configure build and package properly
- Plugin system: Use plugin system for extensibility
Resources
Keywords
Electron EGG, electron-egg, Electron, Egg.js, desktop application, 桌面应用, 主进程, 渲染进程, IPC, 进程间通信, 窗口管理, 菜单, 系统托盘, 自动更新, 插件系统, main process, renderer process, inter-process communication, window management, menu, system tray, auto updater, plugin system
1---2name: electron-egg3description: Provides comprehensive guidance for Electron EGG framework including project structure, main/renderer processes, IPC, window management, and desktop app development. Use when the user asks about Electron EGG, needs to create Electron applications with EGG, or work with Electron EGG patterns.4license: Complete terms in LICENSE.txt5---6
7## When to use this skill
8
9Use this skill whenever the user wants to:
10- Install and set up Electron EGG in a project
11- Create Electron desktop applications
12- Use Electron EGG core features
13- Configure Electron EGG
14- Handle main process and renderer process communication
15- Use Electron EGG API methods
16- Build and package Electron applications
17- Troubleshoot Electron EGG issues
18
19## How to use this skill
20
21This skill is organized to match the Electron EGG official documentation structure (https://www.kaka996.com/, https://www.kaka996.com/pages/987b1c/, https://www.kaka996.com/pages/a99b72/). When working with Electron EGG:
22
231. **Identify the topic** from the user's request:
24 - Installation/安装 → `examples/guide/installation.md`
25 - Quick Start/快速开始 → `examples/guide/quick-start.md`
26 - Features/功能特性 → `examples/features/`
27 - API/API 文档 → `api/`
28
292. **Load the appropriate example file** from the `examples/` directory:
30
31 **Guide (使用文档)**:
32 - `examples/guide/intro.md` - Introduction to Electron EGG
33 - `examples/guide/installation.md` - Installation guide
34 - `examples/guide/quick-start.md` - Quick start guide
35 - `examples/guide/project-structure.md` - Project structure
36 - `examples/guide/configuration.md` - Configuration
37 - `examples/guide/build.md` - Build and package
38
39 **Features (功能特性)**:
40 - `examples/features/main-process.md` - Main process
41 - `examples/features/renderer-process.md` - Renderer process
42 - `examples/features/ipc-communication.md` - IPC communication
43 - `examples/features/window-management.md` - Window management
44 - `examples/features/menu.md` - Menu
45 - `examples/features/tray.md` - System tray
46 - `examples/features/auto-updater.md` - Auto updater
47 - `examples/features/plugin-system.md` - Plugin system
48
493. **Follow the specific instructions** in that example file for syntax, structure, and best practices
50
51 **Important Notes**:
52 - Electron EGG is based on Electron and Egg.js
53 - Main process and renderer process separation
54 - IPC communication between processes
55 - Each example file includes key concepts, code examples, and key points
56
574. **Reference API documentation** in the `api/` directory when needed:
58 - `api/main-api.md` - Main process API
59 - `api/renderer-api.md` - Renderer process API
60 - `api/ipc-api.md` - IPC API
61 - `api/window-api.md` - Window API
62 - `api/config-api.md` - Configuration API
63
64 **API Files:**
65 - `api/main-api.md` - Application class, BrowserWindow, ipcMain, app methods
66 - `api/renderer-api.md` - ipcRenderer, contextBridge, DOM APIs
67 - `api/ipc-api.md` - IPC communication methods and events
68 - `api/window-api.md` - Window creation and management
69 - `api/config-api.md` - Configuration options and environment variables
70
715. **Use templates** from the `templates/` directory:
72 - `templates/installation.md` - Installation templates
73 - `templates/project-setup.md` - Project setup templates
74 - `templates/configuration.md` - Configuration templates
75
76### 1. Understanding Electron EGG
77
78Electron EGG is a desktop application development framework based on Electron and Egg.js, providing a complete development toolchain and best practices.
79
80**Key Concepts**:
81- **Electron**: Cross-platform desktop application framework
82- **Egg.js**: Node.js enterprise application framework
83- **Main Process**: Main application process
84- **Renderer Process**: UI rendering process
85- **IPC**: Inter-process communication
86- **Plugin System**: Extensible plugin architecture
87
88### 2. Installation
89
90**Using npm**:
91
92```bash
93npm install electron-egg
94```
95
96**Using yarn**:
97
98```bash
99yarn add electron-egg
100```
101
102**Using pnpm**:
103
104```bash
105pnpm add electron-egg
106```
107
108### 3. Basic Setup
109
110```javascript
111// main.js
112const { Application } = require('electron-egg')
113
114const app = new Application({
115 // Configuration
116})
117
118app.start()
119```
120
121
122### Doc mapping (one-to-one with official documentation)
123
124- `examples/` → https://www.kaka996.com/pages/987b1c/
125- `api/` → https://www.kaka996.com/pages/a99b72/
126
127## Examples and Templates
128
129This skill includes detailed examples organized to match the official documentation structure. All examples are in the `examples/` directory (see mapping above).
130
131**To use examples:**
132- Identify the topic from the user's request
133- Load the appropriate example file from the mapping above
134- Follow the instructions, syntax, and best practices in that file
135- Adapt the code examples to your specific use case
136
137**To use templates:**
138- Reference templates in `templates/` directory for common scaffolding
139- Adapt templates to your specific needs and coding style
140
141## API Reference
142
143Detailed API documentation is available in the `api/` directory, organized to match the official Electron EGG API documentation structure (https://www.kaka996.com/pages/a99b72/):
144
145### Main Process API (`api/main-api.md`)
146- Application class and methods
147- BrowserWindow creation and management
148- ipcMain IPC handling
149- Application lifecycle hooks
150
151### Renderer Process API (`api/renderer-api.md`)
152- ipcRenderer IPC communication
153- contextBridge for secure API exposure
154- DOM APIs available in renderer
155- Event handling
156
157### IPC API (`api/ipc-api.md`)
158- IPC communication methods (ipcMain, ipcRenderer)
159- Message sending and receiving
160- Async and sync IPC
161- Event handling and channels
162
163### Window API (`api/window-api.md`)
164- BrowserWindow creation and options
165- Window management methods
166- Window events
167- Window lifecycle
168
169### Configuration API (`api/config-api.md`)
170- Configuration file structure
171- App info configuration
172- Window configuration
173- Plugin configuration
174- Environment variables
175
176**To use API reference:**
1771. Identify the API you need help with
1782. Load the corresponding API file from the `api/` directory
1793. Find the API signature, parameters, return type, and examples
1804. Reference the linked example files for detailed usage patterns
1815. All API files include links to relevant example files in the `examples/` directory
182
183## Best Practices
184
1851. **Separate processes**: Keep main process and renderer process code separate
1862. **Use IPC**: Use IPC for inter-process communication
1873. **Handle errors**: Properly handle errors in both processes
1884. **Security**: Follow Electron security best practices
1895. **Performance**: Optimize application performance
1906. **Build configuration**: Configure build and package properly
1917. **Plugin system**: Use plugin system for extensibility
192
193## Resources
194
195- **Official Documentation**: https://www.kaka996.com/
196- **Usage Guide**: https://www.kaka996.com/pages/987b1c/
197- **API Documentation**: https://www.kaka996.com/pages/a99b72/
198- **Gitee Repository**: https://gitee.com/dromara/electron-egg
199
200## Keywords
201
202Electron EGG, electron-egg, Electron, Egg.js, desktop application, 桌面应用, 主进程, 渲染进程, IPC, 进程间通信, 窗口管理, 菜单, 系统托盘, 自动更新, 插件系统, main process, renderer process, inter-process communication, window management, menu, system tray, auto updater, plugin system