Agent Skills
› NicholasFlemmer/styx-app
› ipc-command
ipc-command
GitHub用于在应用中新增 IPC 命令的端到端实现指南,涵盖 Zod 契约定义、主进程处理逻辑、渲染器调用及测试编写。
Trigger Scenarios
需要添加新的 IPC 命令
实现跨进程通信接口
Install
npx skills add NicholasFlemmer/styx-app --skill ipc-command -g -y
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
- Add
'$0': { input: z…, output: z… }topackages/core/src/ipc/contract.ts(commandsmap). Output must not contain secrets. - If state changes: add the machine event/effect first (
/state-machine-change). - Main: implement in
apps/desktop/src/main/ipc/commands/<domain>.tsviaregisterCommand('$0', async (input, ctx) => …): parse → transaction → transition → execute effects via services →audit.appendwhen applicable → the store publisher emits deltas. - Renderer: call
commands['$0'](input)fromstate/commands.ts; wait for the delta (no optimistic domain state). - Tests: schema round-trip; handler test with in-memory SQLite + fake services; one renderer test that the CTA invokes it.
pnpm typecheck && pnpm test.
Version History
- 1d72019 Current 2026-10-18 15:23


