Agent Skillsmuratgur/ordinus › ipc-contract-design

ipc-contract-design

GitHub

用于设计和管理 Ordinus 应用的 IPC 通信契约,确保主进程与渲染器间交互的类型安全、显式且稳定。涵盖通道命名、Zod 校验、预处理桥接及 API 暴露规范,防止反模式并保障安全。

.codex/skills/ipc-contract-design/SKILL.md muratgur/ordinus

触发场景

添加或修改 window.ordinus API 定义 IPC 通道名称或共享类型 实现 ipcMain 处理器 更新 Zod 校验 Schema

安装

npx skills add muratgur/ordinus --skill ipc-contract-design -g -y
更多选项

非标准路径

npx skills add https://github.com/muratgur/ordinus/tree/master/.codex/skills/ipc-contract-design -g -y

不安装直接使用

npx skills use muratgur/ordinus@ipc-contract-design

指定 Agent (Claude Code)

npx skills add muratgur/ordinus --skill ipc-contract-design -a claude-code -g -y

安装 repo 全部 skill

npx skills add muratgur/ordinus --all -g -y

预览 repo 内 skill

npx skills add muratgur/ordinus --list

SKILL.md

Frontmatter
{
    "name": "ipc-contract-design",
    "description": "Design and maintain Ordinus typed IPC contracts. Use when adding or changing window.ordinus APIs, ipcMain handlers, ipc channel names, shared request\/response types, Zod schemas, preload bridge methods, or renderer calls into main process."
}

IPC Contract Design

Objective

Keep Ordinus IPC small, typed, explicit, and stable enough for the renderer to act as a safe UI over main-process capabilities.

Contract Shape

  • Define channel names in src/shared/ipc.ts.
  • Define shared request/response schemas and types in src/shared/contracts.ts.
  • Register handlers in main process modules, not renderer.
  • Expose renderer-facing methods through window.ordinus in preload.
  • Use feature-shaped methods such as workspace.selectFolder() instead of generic transport methods.

Workflow

  1. Name the user-facing capability before creating an IPC method.
  2. Add or update shared types and Zod schemas.
  3. Add the IPC channel constant.
  4. Implement the main handler and validate untrusted input.
  5. Add the narrow preload method that invokes that channel.
  6. Consume the method in renderer through window.ordinus.
  7. Run typecheck, lint, and build.

Guidelines

  • Keep method names domain-oriented: app.getInfo, db.getStatus, workspace.selectFolder.
  • Prefer one explicit method over a generic catch-all channel.
  • Keep renderer errors user-readable and main errors diagnostic enough to debug.
  • When IPC responses drive renderer status, empty states, or error copy, align user-visible naming with DESIGN.md.
  • Do not add IPC for future features until there is an immediate caller.
  • Do not return secrets, raw environment details, or unrestricted local paths unless the UI truly needs them.

Anti-Patterns

  • window.ordinus.invoke(channel, payload).
  • Passing raw command strings from renderer to main.
  • Duplicating response shapes separately in main and renderer.
  • Letting renderer decide privileged policy such as workspace boundaries or executable paths.

版本历史

  • f507122 当前 2026-07-05 18:19

同 Skill 集合

.agents/skills/lavish/SKILL.md
.claude/skills/code-review-and-quality/SKILL.md
.claude/skills/code-simplification/SKILL.md
.claude/skills/documentation-and-adrs/SKILL.md
.claude/skills/electron-secure-boundary/SKILL.md
.claude/skills/grill-me/SKILL.md
.claude/skills/idea-discovery/SKILL.md
.claude/skills/ipc-contract-design/SKILL.md
.claude/skills/ordinus-ui-system/SKILL.md
.claude/skills/provider-runtime-adapter/SKILL.md
.claude/skills/shadcn-project-workflow/SKILL.md
.claude/skills/sqlite-minimal-persistence/SKILL.md
.codex/skills/code-review-and-quality/SKILL.md
.codex/skills/code-simplification/SKILL.md
.codex/skills/documentation-and-adrs/SKILL.md
.codex/skills/electron-secure-boundary/SKILL.md
.codex/skills/grill-me/SKILL.md
.codex/skills/idea-discovery/SKILL.md
.codex/skills/ordinus-ui-system/SKILL.md
.codex/skills/provider-runtime-adapter/SKILL.md
.codex/skills/shadcn-project-workflow/SKILL.md
.codex/skills/sqlite-minimal-persistence/SKILL.md

元信息

文件数
0
版本
acdff6f
Hash
12d81031
收录时间
2026-07-05 18:19

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 13:36
浙ICP备14020137号-1 $访客地图$