AgentSkillsCN

hono-ipc-setup

为 Electron 设置基于 Hono 的类型安全 IPC。当你需要实现 IPC,或从 ipcRenderer 迁移到类型安全 RPC 时,此技能将为你提供专业支持。

SKILL.md
--- frontmatter
name: hono-ipc-setup
description: Set up Hono-based type-safe IPC for Electron. Use when implementing IPC or migrating from ipcRenderer to type-safe RPC.
allowed-tools: Read, Write, Edit, Glob, Grep, Bash(npm:*), Bash(pnpm:*)

Hono Electron IPC Setup

Resources

TopicFile
Why shared/ directorySHARED-DIRECTORY.md
Factory pattern with DIFACTORY-PATTERN.md
Hono RPC API referenceREFERENCE.md

Directory Structure

code
src/
├── shared/callable/        # Factory, app creation, types.d.ts
├── main/callable/          # Service injection
└── renderer/src/adapters/  # Type-safe hc client

Quick Start

bash
pnpm add hono @hono/zod-validator zod
typescript
// Type export: src/shared/callable/types.d.ts
export type CallableType = ReturnType<typeof createApp>;

// Client: src/renderer/src/adapters/client.ts
export const client = hc<CallableType>('http://internal.localhost', { ... });

Related Skills