cycosoft/Eyas / .agents/skills/electron-core-standards
electron-core-standards
VerifiedArchitectural standards and IPC communication patterns for the Electron main process in Eyas.
Reusable Skill: Electron Core Standards
Overview
The core process is responsible for system-level operations, file I/O, and the management of the Electron lifecycle. It must remain decoupled from the Vue frontend.
When to Use
- Trigger when implementing or modifying main-process logic in
src/eyas-core/. - Trigger when designing new IPC channels between core and interface.
Instructions
1. IPC (Inter-Process Communication)
- Naming Pattern: Use a kebab-case
category-actionpattern (e.g.,test-server-start,modal-close). - Typed Channels: All IPC channel names must be cast to
ChannelNamefromsrc/types/primitives.js. - Unidirectional Flow: Favor
send/receivepatterns overinvoke/handlewhere possible for simpler state synchronization.
2. Architecture
- Functional Modules: Group logic into functional modules (e.g.,
test-server,menu-template). - Entry Point:
src/eyas-core/index.tsshould act as the orchestrator, proxying calls to specialized modules. - No Window Polling: Do not attempt to read state directly from the
BrowserWindow. Use IPC listeners to update local core state.
3. Rules & Constraints
- ESM Standard: Follow NodeNext resolution. Imports MUST include the
.jsextension. - No UI Logic: Formatting, display strings, and UI state should live in the
src/eyas-interface/. The core process deals only with raw data and system commands. - Error Handling: All system calls (FS, Network) must be wrapped in try/catch blocks with appropriate logging via the Eyas logging system.
4. Object Liveness Guards (CRITICAL)
Electron objects stored in CoreContext ($appWindow, $eyasLayer, $testLayer) can be destroyed while still being truthy. Optional chaining (?.) only guards against null/undefined — it does NOT prevent TypeError: Object has been destroyed.
Always apply a two-part guard before operating on these objects:
// ✅ Correct — checks both null AND destroyed state
if (!ctx.$eyasLayer || ctx.$eyasLayer.webContents.isDestroyed()) { return; }
// ✅ Correct — for conditional property access
const appWindow = ctx.$appWindow;
const size = (appWindow && !appWindow.isDestroyed()) ? appWindow.getContentSize() : fallback;
// ❌ Wrong — truthy check alone; a destroyed object is still truthy
if (!ctx.$eyasLayer) { return; }
// ❌ Wrong — optional chaining does NOT catch destroyed objects
ctx.$eyasLayer?.webContents.send(`event`);
When this matters: Any IPC handler that fires asynchronously (e.g., after install-update closes $appWindow) may race against object destruction. Guard every access.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 193k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 193k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 193k | Updated | Claude CodeCodex | Verified | Install |