Skip to content
Agentmart
Submit a tool

electron-app-dev

老王我搞Electron好多年了,这玩意儿写跨平台应用真tm香! Electron桌面应用开发专家。精通electron-vite、TypeScript、React、IPC通信、窗口管理、原生功能集成等Electron全栈开发技术。 适用场景: - 创建electron-vite + TypeScript +…

Skill by aAAaqwq

IndexedMIT★ 111
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/aaaaqwq-electron-app-dev

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

老王我搞Electron好多年了,这玩意儿写跨平台应用真tm香! Electron桌面应用开发专家。精通electron-vite、TypeScript、React、IPC通信、窗口管理、原生功能集成等Electron全栈开发技术。 适用场景: - 创建electron-vite + TypeScript + React项目 - 实现安全的IPC通信 - 窗口管理(创建、控制、多窗口、状态持久化) - 原生功能(系统托盘、菜单、通知、文件对话框) - electron-builder打包分发 - 自动更新和代码签名 所有代码遵循最新Electron安全最佳实践:contextIsolation开启、nodeIntegration关闭、sandbox模式开启、contextBridge安全暴露IPC。

Use cases: frontend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/electron-app-dev

What's inside

Skill name
electron-app-dev
Description
老王我搞Electron好多年了,这玩意儿写跨平台应用真tm香! Electron桌面应用开发专家。精通electron-vite、TypeScript、React、IPC通信、窗口管理、原生功能集成等Electron全栈开发技术。 适用场景: - 创建electron-vite + TypeScript + React项目 - 实现安全的IPC通信 - 窗口管理(创建、控制、多窗口、状态持久化) - 原生功能(系统托盘、菜单、通知、文件对话框) - electron-builder打包分发 - 自动更新和代码签名 所有代码遵循最新Electron安全最佳实践:contextIsolation开启、nodeIntegration关闭、sandbox模式开启、contextBridge安全暴露IPC。
License
MIT
Instructions
532 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts
  • Instructions read files in your home folder (~/.ssh, ~/.aws…)

Agent Skills spec issues

  • body: 532 lines (spec recommends under 500)
  • body: contains an absolute path from the author's machine

Files (6)

  • SKILL.md
  • ipc-patterns.md · references/
  • native-features.md · references/
  • packaging.md · references/
  • window-management.md · references/
  • create_electron_app.py · scripts/

SKILL.md (first lines)

# ⚡ Electron 桌面应用开发专家

老王我搞Electron好多年了,这玩意儿写跨平台应用真tm香!

## 快速开始:创建新项目

使用内置脚本创建最佳实践Electron项目:

```bash
python "C:/Users/Administrator/.claude/skills/electron-app-dev/scripts/create_electron_app.py" my-app
cd my-app
npm install
npm run dev
```

**生成项目包含:**
- electron-vite:全进程极速热更新
- TypeScript + React:类型安全开发
- contextBridge安全IPC模式
- electron-builder打包配置

---

## 核心安全原则(不可妥协)

永远强制执行这些安全配置:

```typescript
webPreferences: {
  preload: path.join(__dirname, '../preload/index.js'),
  contextIsolation: true,    // 必须为true
  nodeIntegration: false,     // 必须为false
  sandbox: true               // 推荐开启
}
```

**为什么重要:**
- `contextIsolation: true` - 隔离preload脚本与渲染器
- `nodeIntegration: false` - 防止渲染器直接访问Node.js
- `sandbox: true` - 进一步限制渲染器进程能力

---

## IPC通信模式

### 唯一正确方式:contextBridge + 白名单

**Preload (preload/index.ts):**
```typescript
const SEND_CHANNELS = ['app-ready']
const INVOKE_CHANNELS = ['get-app-info', 'save-file']

contextBridge.exposeInMainWorld('electronAPI', {
  send: (channel, ...args) => {
    if (SEND_CHANNELS.includes(channel)) {
      ipcRenderer.send(channel, ...args)
    }
  },
  invoke: async (channel, ...args) => {
    if (INVOKE_CHANNELS.includes(channel)) {
      return await ipcRenderer.invoke(channel, ...args)
    }
    return Promise.reject(new Error(`Invalid channel: ${channel}`))
  }
})
```

**Main Process (main/index.ts):**
```typescript
function validateSender(frame: Electron.WebFrameMain | null): boolean {
  if (!frame) return false
  const url = new URL(frame.url)
  const allowedHosts = ['localhost', 'yourdomain.com']
  return allowedHosts.includes(url.hostname) || url.protocol === 'file:'
}

ipcMain.handle('get-app-info', (event) => {
  if (!validateSender(event.senderFrame)) return null
  return { name: app.getName(), version: app.getVersion() }
})
```

---

## 常见坑与解决方案(老王血泪经验)

### 1. 白屏问题(DevTools可以加载但正常不行)

**症状:** 开发环境正常,打包后白屏

**原因:** 协议问题或路径错误

```typescript
// ❌ 错误写法
win.loadURL('http://localhost:5173')

// ✅ 正确写法
if (app.isPackaged) {
  win.loadFile(path.join(__dirname, '../renderer/index.html'))
} else {
  win.loadURL('http://localhost:5173')
}

// ✅ 生产环境加载方案
win.loadFile(path.join(__dirname, '../renderer/index.html'))
win.webContents.openDevTools()  // 先看看能不能加载
```

### 2. 内存泄漏(IPC监听器没移除)

**症状:** 应用用久了越来越卡

```typescript
// ❌ 错误写法
useEffect(() => {
  window.electronAPI.on('update', callback)
  // 没有清理函数!
}, [])

From aAAaqwq/AGI-Super-Team, MIT.

More from aAAaqwq/AGI-Super-Team

Signals

Stars
111
Forks
25
Open issues
1
Last commit (this folder)
Apr 21, 2026 (6 months ago)
Last release
Sep 20, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from aAAaqwq

Cite this page

electron-app-dev skill. Agent Mart. https://agentmart.dev/skills/aaaaqwq-electron-app-dev (last updated 2026-10-24)