Skill

electron-api

by wavetermdev

AI Summary

A structured guide for developers implementing new Electron APIs in Wave Terminal by showing exactly which four files to edit and how to wire up frontend-to-main-process communication. Essential for Wave Terminal contributors extending the application's capabilities.

Install

# Add to your project root as SKILL.md
curl -o SKILL.md "https://raw.githubusercontent.com/wavetermdev/waveterm/main/.kilocode/skills/electron-api/SKILL.md"

Description

Guide for adding new Electron APIs to Wave Terminal. Use when implementing new frontend-to-electron communications via preload/IPC.

Adding Electron APIs

Electron APIs allow the frontend to call Electron main process functionality directly via IPC.

Four Files to Edit

• frontend/types/custom.d.ts - TypeScript ElectronApi type • emain/preload.ts - Expose method via contextBridge • emain/emain-ipc.ts - Implement IPC handler • frontend/preview/preview-electron-api.ts - Add a no-op stub to keep the previewElectronApi object in sync with the ElectronApi type

Three Communication Patterns

• Sync - ipcRenderer.sendSync() + ipcMain.on() + event.returnValue = ... • Async - ipcRenderer.invoke() + ipcMain.handle() • Fire-and-forget - ipcRenderer.send() + ipcMain.on()

1. Define TypeScript Interface

In frontend/types/custom.d.ts: `typescript type ElectronApi = { captureScreenshot: (rect: Electron.Rectangle) => Promise<string>; // capture-screenshot }; `

Quality Score

B

Good

85/100

Standard Compliance75
Documentation Quality78
Usefulness82
Maintenance Signal100
Community Signal100
Scored Today

GitHub Signals

Stars17.9k
Forks799
Issues477
UpdatedToday
View on GitHub

Trust & Transparency

Open Source — Apache-2.0

Source code publicly auditable

Verified Open Source

Hosted on GitHub — publicly auditable

Actively Maintained

Last commit Today

17.9k stars — Strong Community

799 forks

My Fox Den

Community Rating

Works With

Claude Code