electron-api

Define Electron IPC interfaces, preload exposure, handlers, and preview stubs.

Updated Apr 26, 2026
One-click install
npx skills add https://github.com/lihonghuacgk/waveterm --skill electron-api-lihonghuacgk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: electron-api
Source: https://github.com/lihonghuacgk/waveterm/tree/main/.kilocode/skills/electron-api
Command: npx skills add https://github.com/lihonghuacgk/waveterm --skill electron-api-lihonghuacgk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Frontend code can directly access Electron main process features via IPC, enabling richer UI functionality in Wave Terminal.

Core Features & Use Cases

  • Guides defining a minimal Electron API surface: interface type, preload exposure, IPC handler, and a preview stub.
  • Supports three communication patterns: Sync, Async, and Fire-and-forget for various main-process tasks.
  • Timely realization of frontend-to-main integrations with clear separation of interface, preload, IPC, and preview.

Quick Start

Define the ElectronApi interface, expose it in the preload, implement the IPC handler, and add a preview stub.

Frequently Asked Questions about electron-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I expose Electron main process features to frontend code via IPC?

You can expose Electron main process features to frontend code by defining a TypeScript interface, using contextBridge in the preload script for secure exposure, and implementing matching IPC channel handlers in the main process.

What IPC communication patterns can I use for Electron frontend-to-main integration?

The supported IPC communication patterns for frontend-to-main integration are Sync, Async, and Fire-and-forget, allowing you to handle various main-process tasks with appropriate response behaviors.

How do I set up a minimal Electron API surface using contextBridge and preload?

Setting up a minimal Electron API surface involves a four-file pattern: defining the interface type, exposing it in the preload via contextBridge, implementing the IPC handler, and adding a no-op preview stub.

Why do I need a preview stub when defining an Electron API surface?

A no-op preview stub is required to keep the API surface synchronized across the interface definition, preload exposure, and IPC handlers, ensuring the frontend integration remains stable without executing main process logic.

Can I build frontend-to-main integrations in Wave Terminal using TypeScript interfaces?

Yes, you can build frontend-to-main integrations in Wave Terminal using TypeScript interfaces. The process requires defining interface types, exposing them via contextBridge, and implementing IPC channel handlers.