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 ee-core
Using yarn:
yarn add ee-core
Using pnpm:
pnpm add ee-core
3. Basic Setup
// main.js
const { Application } = require('ee-core')
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
能力边界
✅ 适用场景
- 当你需要使用此技能对应的技术栈时
- 当项目需要遵循最佳实践时
- 当需要快速上手或深入理解核心概念时
⚠️ 需要注意
- 复杂业务逻辑需要结合具体场景调整
- 性能优化需要根据实际数据量评估
❌ 不适用场景
常见陷阱 (Gotchas)
- 版本兼容性:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异
- 配置文件格式:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查
- 环境变量:确保所有必要的环境变量已正确设置,敏感信息不要硬编码
- 依赖冲突:多版本共存时注意依赖冲突,使用 lock 文件锁定版本
- 性能陷阱:大数据量场景下注意性能优化,避免 N+1 查询等常见问题
使用流程
Step 1: 环境准备
确保开发环境已安装必要的依赖和工具。
Step 2: 配置初始化
根据项目需求进行基础配置。
Step 3: 核心功能使用
按照示例代码实现核心功能。
Step 4: 测试验证
运行测试确保功能正常。
Step 5: 部署上线
完成开发后进行部署和监控。
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---67## When to use this skill89Use this skill whenever the user wants to:10- Install and set up Electron EGG in a project11- Create Electron desktop applications12- Use Electron EGG core features13- Configure Electron EGG14- Handle main process and renderer process communication15- Use Electron EGG API methods16- Build and package Electron applications17- Troubleshoot Electron EGG issues1819## How to use this skill2021This 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:22231. **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/`28292. **Load the appropriate example file** from the `examples/` directory:3031 **Guide (使用文档)**:32 - `examples/guide/intro.md` - Introduction to Electron EGG33 - `examples/guide/installation.md` - Installation guide34 - `examples/guide/quick-start.md` - Quick start guide35 - `examples/guide/project-structure.md` - Project structure36 - `examples/guide/configuration.md` - Configuration37 - `examples/guide/build.md` - Build and package3839 **Features (功能特性)**:40 - `examples/features/main-process.md` - Main process41 - `examples/features/renderer-process.md` - Renderer process42 - `examples/features/ipc-communication.md` - IPC communication43 - `examples/features/window-management.md` - Window management44 - `examples/features/menu.md` - Menu45 - `examples/features/tray.md` - System tray46 - `examples/features/auto-updater.md` - Auto updater47 - `examples/features/plugin-system.md` - Plugin system48493. **Follow the specific instructions** in that example file for syntax, structure, and best practices5051 **Important Notes**:52 - Electron EGG is based on Electron and Egg.js53 - Main process and renderer process separation54 - IPC communication between processes55 - Each example file includes key concepts, code examples, and key points56574. **Reference API documentation** in the `api/` directory when needed:58 - `api/main-api.md` - Main process API59 - `api/renderer-api.md` - Renderer process API60 - `api/ipc-api.md` - IPC API61 - `api/window-api.md` - Window API62 - `api/config-api.md` - Configuration API6364 **API Files:**65 - `api/main-api.md` - Application class, BrowserWindow, ipcMain, app methods66 - `api/renderer-api.md` - ipcRenderer, contextBridge, DOM APIs67 - `api/ipc-api.md` - IPC communication methods and events68 - `api/window-api.md` - Window creation and management69 - `api/config-api.md` - Configuration options and environment variables70715. **Use templates** from the `templates/` directory:72 - `templates/installation.md` - Installation templates73 - `templates/project-setup.md` - Project setup templates74 - `templates/configuration.md` - Configuration templates7576### 1. Understanding Electron EGG7778Electron EGG is a desktop application development framework based on Electron and Egg.js, providing a complete development toolchain and best practices.7980**Key Concepts**:81- **Electron**: Cross-platform desktop application framework82- **Egg.js**: Node.js enterprise application framework83- **Main Process**: Main application process84- **Renderer Process**: UI rendering process85- **IPC**: Inter-process communication86- **Plugin System**: Extensible plugin architecture8788### 2. Installation8990**Using npm**:9192```bash93npm install ee-core94```9596**Using yarn**:9798```bash99yarn add ee-core100```101102**Using pnpm**:103104```bash105pnpm add ee-core106```107108### 3. Basic Setup109110```javascript111// main.js112const { Application } = require('ee-core')113114const app = new Application({115 // Configuration116})117118app.start()119```120121122### Doc mapping (one-to-one with official documentation)123124- `examples/` → https://www.kaka996.com/pages/987b1c/125- `api/` → https://www.kaka996.com/pages/a99b72/126127## Examples and Templates128129This skill includes detailed examples organized to match the official documentation structure. All examples are in the `examples/` directory (see mapping above).130131**To use examples:**132- Identify the topic from the user's request133- Load the appropriate example file from the mapping above134- Follow the instructions, syntax, and best practices in that file135- Adapt the code examples to your specific use case136137**To use templates:**138- Reference templates in `templates/` directory for common scaffolding139- Adapt templates to your specific needs and coding style140141## API Reference142143Detailed API documentation is available in the `api/` directory, organized to match the official Electron EGG API documentation structure (https://www.kaka996.com/pages/a99b72/):144145### Main Process API (`api/main-api.md`)146- Application class and methods147- BrowserWindow creation and management148- ipcMain IPC handling149- Application lifecycle hooks150151### Renderer Process API (`api/renderer-api.md`)152- ipcRenderer IPC communication153- contextBridge for secure API exposure154- DOM APIs available in renderer155- Event handling156157### IPC API (`api/ipc-api.md`)158- IPC communication methods (ipcMain, ipcRenderer)159- Message sending and receiving160- Async and sync IPC161- Event handling and channels162163### Window API (`api/window-api.md`)164- BrowserWindow creation and options165- Window management methods166- Window events167- Window lifecycle168169### Configuration API (`api/config-api.md`)170- Configuration file structure171- App info configuration172- Window configuration173- Plugin configuration174- Environment variables175176**To use API reference:**1771. Identify the API you need help with1782. Load the corresponding API file from the `api/` directory1793. Find the API signature, parameters, return type, and examples1804. Reference the linked example files for detailed usage patterns1815. All API files include links to relevant example files in the `examples/` directory182183## Best Practices1841851. **Separate processes**: Keep main process and renderer process code separate1862. **Use IPC**: Use IPC for inter-process communication1873. **Handle errors**: Properly handle errors in both processes1884. **Security**: Follow Electron security best practices1895. **Performance**: Optimize application performance1906. **Build configuration**: Configure build and package properly1917. **Plugin system**: Use plugin system for extensibility192193## Resources194195- **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-egg199200## Keywords201202Electron EGG, electron-egg, Electron, Egg.js, desktop application, 桌面应用, 主进程, 渲染进程, IPC, 进程间通信, 窗口管理, 菜单, 系统托盘, 自动更新, 插件系统, main process, renderer process, inter-process communication, window management, menu, system tray, auto updater, plugin system203204## 能力边界205206### ✅ 适用场景207- 当你需要使用此技能对应的技术栈时208- 当项目需要遵循最佳实践时209- 当需要快速上手或深入理解核心概念时210211### ⚠️ 需要注意212- 复杂业务逻辑需要结合具体场景调整213- 性能优化需要根据实际数据量评估214215### ❌ 不适用场景216- 不相关的技术栈或框架217- 需要完全自定义的特殊场景218219## 常见陷阱 (Gotchas)2202211. **版本兼容性**:注意框架版本与依赖库的兼容性,不同版本 API 可能有差异2222. **配置文件格式**:配置文件格式错误是最常见的问题,建议使用编辑器的语法检查2233. **环境变量**:确保所有必要的环境变量已正确设置,敏感信息不要硬编码2244. **依赖冲突**:多版本共存时注意依赖冲突,使用 lock 文件锁定版本2255. **性能陷阱**:大数据量场景下注意性能优化,避免 N+1 查询等常见问题226227## 使用流程228229### Step 1: 环境准备230确保开发环境已安装必要的依赖和工具。231232### Step 2: 配置初始化233根据项目需求进行基础配置。234235### Step 3: 核心功能使用236按照示例代码实现核心功能。237238### Step 4: 测试验证239运行测试确保功能正常。240241### Step 5: 部署上线242完成开发后进行部署和监控。