ipc-command

GitHub

用于在应用中新增 IPC 命令的端到端实现指南,涵盖 Zod 契约定义、主进程处理逻辑、渲染器调用及测试编写。

.claude/skills/ipc-command/SKILL.md NicholasFlemmer/styx-app

Trigger Scenarios

需要添加新的 IPC 命令 实现跨进程通信接口

Install

npx skills add NicholasFlemmer/styx-app --skill ipc-command -g -y
More Options

Non-standard path

npx skills add https://github.com/NicholasFlemmer/styx-app/tree/main/.claude/skills/ipc-command -g -y

Use without installing

npx skills use NicholasFlemmer/styx-app@ipc-command

指定 Agent (Claude Code)

npx skills add NicholasFlemmer/styx-app --skill ipc-command -a claude-code -g -y

安装 repo 全部 skill

npx skills add NicholasFlemmer/styx-app --all -g -y

预览 repo 内 skill

npx skills add NicholasFlemmer/styx-app --list

SKILL.md

Frontmatter
{
    "name": "ipc-command",
    "description": "Add a command end-to-end - zod schema in packages\/core\/src\/ipc\/contract.ts, main-process handler, typed renderer usage, contract test. Use for any new mutation (spawn session, grant, revoke, connect target, accept hunk...).",
    "allowed-tools": "Read, Grep, Glob, Edit, Write, Bash(pnpm:*)",
    "argument-hint": "<domain.command>"
}

IPC command: $ARGUMENTS

  1. Add '$0': { input: z…, output: z… } to packages/core/src/ipc/contract.ts (commands map). Output must not contain secrets.
  2. If state changes: add the machine event/effect first (/state-machine-change).
  3. Main: implement in apps/desktop/src/main/ipc/commands/<domain>.ts via registerCommand('$0', async (input, ctx) => …): parse → transaction → transition → execute effects via services → audit.append when applicable → the store publisher emits deltas.
  4. Renderer: call commands['$0'](input) from state/commands.ts; wait for the delta (no optimistic domain state).
  5. Tests: schema round-trip; handler test with in-memory SQLite + fake services; one renderer test that the CTA invokes it.
  6. pnpm typecheck && pnpm test.

Version History

  • 1d72019 Current 2026-10-18 15:23

Same Skill Collection

.claude/skills/db-migration/SKILL.md
.claude/skills/port-screen/SKILL.md
.claude/skills/provider-adapter/SKILL.md
.claude/skills/release/SKILL.md
.claude/skills/run-app/SKILL.md
.claude/skills/spec-lookup/SKILL.md
.claude/skills/state-machine-change/SKILL.md
.claude/skills/ui-component/SKILL.md
.claude/skills/visual-diff/SKILL.md

Metadata

Files
0
Version
1d72019
Hash
1abd6f14
Indexed
2026-10-18 15:23

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-19 05:41
浙ICP备14020137号-1