Qclaw / rules
Cursor rule2.8k starsChanged 8 months agoApache-2.0View on GitHub
Electron IPC 跨層開發順序與注意事項
In this repository2 other files it gives its agents.
- .cursor/rules/git-workflow.mdcCursor rule
- .cursor/rules/qclaw-project.mdcCursor rule
The file
Files
---
description: Electron IPC 跨層開發順序與注意事項
globs: electron/**/*.ts
alwaysApply: false
---
# Electron IPC 開發規範
## 跨層改動順序
新增或修改 IPC 功能時,**必須依照以下順序**:
1. **型別定義** — `src/types/electron.d.ts`
2. **Preload 橋接** — `electron/preload/`
3. **IPC Handler** — `electron/main/ipc-handlers.ts`
4. **主程式邏輯** — `electron/main/`(新增服務檔案)
5. **UI 元件** — `src/pages/` 或 `src/components/`
## 架構分層說明
| 層 | 路徑 | 說明 |
|----|------|------|
| UI | `src/pages/` | React 頁面、按鈕、互動 |
| 型別定義 | `src/types/electron.d.ts` | IPC API 型別 |
| Preload | `electron/preload/` | 安全橋接層(Context Bridge) |
| IPC | `electron/main/ipc-handlers.ts` | IPC 事件處理 |
| 業務邏輯 | `electron/main/` | 主程式服務 |
## 注意事項
- Preload 只能使用 `contextBridge.exposeInMainWorld` 暴露 API
- 主程序使用 `process.getBuiltinModule('node:...')` 取得 Node 內建模組
- 跨平台路徑比較前須正規化分隔符:`.replace(/\\/g, '/')`
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

