Syntic
← All skills
EngineeringFreeCommunityv1.0.0

Electron Developer

Use when building or reviewing an Electron desktop application — IPC design, native OS integration, performance, security hardening, or auto-update flows.

About this skill

Use when building or reviewing an Electron desktop application — IPC design, native OS integration, performance, security hardening, or auto-update flows.

SKILL.md

electron-developer.SKILL.md

Place it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review the contents and run it in a controlled environment first.

SKILL.md
---
name: Electron Developer
description: Use when building or reviewing an Electron desktop application — IPC design, native OS integration, performance, security hardening, or auto-update flows.
category: Engineering
version: 1.0.0
tools: []
---

# Electron Developer

Build performant, secure desktop applications that feel native. Understand the process model deeply and design IPC boundaries that prevent security vulnerabilities while keeping the UI responsive.

## Process Architecture

1. Decide what belongs in the main process (file system, native menus, system tray, window management) versus the renderer process (UI, user interaction, display).
2. Design the IPC contract between main and renderer as a typed API surface, with request/response schemas for every channel.
3. Use `contextBridge.exposeInMainWorld` to create a minimal, typed API surface — never expose `ipcRenderer` directly.
4. Enable `contextIsolation: true` and `sandbox: true` on every `BrowserWindow`; disable `nodeIntegration` in all renderer processes.
5. Use preload scripts as the single bridge point, kept thin with only `ipcRenderer.invoke` calls.

## IPC Communication Patterns

- Use `ipcMain.handle` / `ipcRenderer.invoke` for request-response patterns — returns a Promise and keeps async flow clean.
- Use `webContents.send` / `ipcRenderer.on` for push notifications from main to renderer (progress updates, system events).
- Validate all data crossing the IPC boundary; never trust input from the renderer process.
- Batch frequent IPC calls — send one call with an array of 50 file stats, not 50 individual calls.
- Use `MessagePort` for high-throughput communication between renderer processes without routing through main.

## Native Integration

- Use `@electron/remote` sparingly; prefer explicit IPC over remote module convenience.
- Implement native menus with `Menu.buildFromTemplate`, using role-based items for standard actions (copy, paste, quit).
- Use `Tray` for background applications — show status with tray icon changes and context menus.
- Implement deep linking with `app.setAsDefaultProtocolClient`, handling protocol URLs in the `open-url` event.
- Use `nativeTheme` to detect and respond to OS theme changes, synced with the app's theme system.

## Performance Optimization

- Measure startup time from `app.on('ready')` to first meaningful paint; target under 1 second for the window to appear.
- Defer non-critical initialization — load plugins, check updates, and sync data after the window is visible.
- Use `win.webContents.setBackgroundThrottling(false)` only for windows that need real-time updates when hidden.
- Profile renderer memory with Chrome DevTools; watch for detached DOM nodes and growing event listener counts.
- Use Web Workers for CPU-intensive renderer tasks; use `utilityProcess` for heavy computation in the main process.

## Auto-Update and Distribution

- Use `electron-updater` with differential updates to minimize download size.
- Sign applications with valid code signing certificates for macOS (Developer ID) and Windows (EV certificate).
- Use `electron-builder` for cross-platform packaging, with `afterSign` hooks for notarization on macOS.
- Implement update channels — stable, beta, alpha — and let users opt into pre-release channels.
- Test the full update flow: download, verify signature, install, restart, and downgrade scenarios.

## Security Hardening

- Set a strict Content Security Policy in the `<meta>` tag or via `session.defaultSession.webRequest`.
- Never load remote content in the main window; use a sandboxed `<webview>` or `BrowserView` if external content is needed.
- Disable `allowRunningInsecureContent`, `experimentalFeatures`, and `enableBlinkFeatures`.
- Audit dependencies with `npm audit` and strip dev-only code from production builds.

## Before Completing a Task

- Verify the application on macOS, Windows, and Linux, confirming native integrations work on each platform.
- Check that IPC channels are properly typed and validated in both main and preload scripts.
- Verify the auto-update flow works with a staged rollout to a test environment.
- Confirm `electron-builder` produces distributable packages with valid code signing.

Install

Syntic App

  1. 1Create a dedicated folder for this skill in your local skills library.
  2. 2Place SKILL.md into that folder.
  3. 3Restart Syntic and invoke this skill on matching tasks.

Syntic Code (CLI)

  1. 1Save SKILL.md in your local Syntic Code skills directory.
  2. 2Keep related files in the same skill folder.
  3. 3Run in a safe environment and validate outputs.