본문으로 건너뛰기
cccskills
무료GitHub에 공개

erpc-communication

Guides using eRPC (electron-tRPC) for inter-process communication (IPC) between Electron main and renderer processes. Triggered when handling Electron IPC or tRPC-based systems.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md2.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

eRPC Communication Guide

This skill provides mandatory instructions for implementing type-safe IPC using eRPC in this project.

1. Main Process Implementation

  • Route Definition: Must use the project's provided router utility to define tRPC routes.
  • Handler Initialization: Must use createIPCHandler from erpc/main to bind the router to Electron windows.
  • Context Injection: Should provide necessary instances (e.g., BrowserWindow or Tray) through createContext.
// Always initialize createIPCHandler within the app ready lifecycle
import { createIPCHandler } from 'erpc/main'

import { routers } from './rpcs'

createIPCHandler({
	createContext: async () => ({ win: mainWindow, tray: appTray }),
	router: routers,
	windows: [mainWindow]
})

2. Preload Script Configuration

  • Expose Bridge Interface: Must call exposeElectronTRPC() provided by erpc/main in the preload script.
  • Lifecycle: Should be called inside process.once('loaded').
import { exposeElectronTRPC } from 'erpc/main'

process.once('loaded', () => {
	exposeElectronTRPC()
})

3. Renderer Process Usage

  • Client Creation: Create tRPC client using ipcLink from erpc/renderer.
  • Type Safety: Always import Router type from main process to ensure complete end-to-end type safety.
import { createTRPCClient } from '@trpc/client'
import { ipcLink } from 'erpc/renderer'

import type { Router } from '@desktop/rpcs' // Import Router type from main process

export const trpc = createTRPCClient<Router>({
	links: [ipcLink()]
})

4. Routes and Endpoints Best Practices

  • Single Responsibility: Each route should correspond to a specific service in the main process (e.g., window, file, dialog).
  • Parameter Validation: It is strictly prohibited to write complex business logic in Router. Router is only responsible for validating input and output parameters; business logic must be delegated to Service (e.g., calling WindowService.open()).
  • Type Reference: For complex object parameters, type definitions must be placed under the packages/erpc package and shared between both ends, avoiding direct cross-package imports of entity logic.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Guides the generation, reading, and updating of agentmap.md files. This skill ensures a consistent and up-to-date codebase map for AI Agents.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MatrixAges/polywise6622026년 6월 11일 업데이트

Maintain package-level `agentmap.md` files as outline-level maps of the real file tree and core responsibilities. Use when package structure or responsibility boundaries change and the corresponding `agentmap.md` must be created or updated.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MatrixAges/polywise6622026년 6월 11일 업데이트

Interacts with local browser via Chrome DevTools Protocol (only triggered after user explicitly requests to inspect, debug, or interact with pages open in Chrome)

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MatrixAges/polywise6622026년 6월 11일 업데이트

css

무료

Guides styling implementation using TailwindCSS + CSS Modules. Triggered when handling component styles, layout design, or CSS patterns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MatrixAges/polywise6622026년 6월 11일 업데이트

Specialized for translating document files and their content into English. Triggered when localization, translation, or converting Chinese documents to English is requested.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MatrixAges/polywise6622026년 6월 11일 업데이트

i18n

무료

Guides internationalization (i18n) implementation using i18next with TypeScript. Triggered when handling localization, translation files, or multilingual support.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

MatrixAges/polywise6622026년 6월 11일 업데이트

MatrixAges의 스킬 모두 보기

이 스킬의 문제 신고