agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/frameworks/electron/SKILL.md

electron

Skill15 starsChanged 42 days agoMITView on GitHub

Expert Electron assistance covering Main and Renderer processes, IPC communication, preload scripts, and packaging. Use when building cross-platform desktop applications with web technologies.

  • Installs packages

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use dep-refs, feature-boundary-planner and 6 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • betacatslingSkill

    dep-refs

    Use when needs to inspect TypeScript export references in the z-code workspace, list exports from a file, verify whether an export is unused before deletion, investigate who imports a symbol during refactors, or combine pnpm knip unused-export results with pnpm dep:refs symbol-level reference tracing.

    Also in 5 projects that use this

  • betacatslingSkill

    feature-boundary-planner

    Map a ZCode behavior change to current UI surfaces, state owners, protocol commands, persistence, and validation. Use for impact analysis, product-boundary planning, or an implementation handoff grounded in the checked-out source.

    Also in 5 projects that use this

  • Cartograf666Skill

    architecture-governance

    Bootstrap, document, enforce, and review a project's architecture through layer responsibilities, dependency direction, architecture manifests, legacy baselines, Change Envelopes, cross-layer approval policy, and deterministic architecture checks. Use when starting a project, auditing an existing codebase, planning cross-layer work, preventing architecture erosion, reviewing structural changes, or deciding whether implementation may expand into another layer.

    Also in 5 projects that use this

  • ZCodium-projectSkill

    e2e-case-lifecycle

    Plan, maintain, replay, and promote ZCode desktop E2E cases and their fixtures, coverage matrices, and CI admission evidence.

    Also in 3 projects that use this

  • ZCodium-projectSkill

    zcode-large-task-fixture

    Generate, verify, or remove large synthetic ZCode task fixtures in local ~/.zcode persistence for UI/session performance testing. Use when testing big conversation/task rendering, task list performance, snapshot recovery, tool-call rendering, reasoning, patches, todos, and model usage without spending time chatting manually.

    Also in 3 projects that use this

  • VercelSkill

    ai-elements

    Build AI chat interfaces using ai-elements components — conversations, messages, tool displays, prompt inputs, and more. Use when the user wants to build a chatbot, AI assistant UI, or any AI-powered chat interface.

    Also in 5 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 21 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always set contextIsolation: true and nodeIntegration: false in webPreferences.

    line 139
  2. Very specific:

    Use ipcMain.handle() and ipcRenderer.invoke() for asynchronous request-response IPC.

    line 141

“Common” is measured: kept by at least 6 in 10 of the 21 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Electron

Electron bundles Chromium and Node.js into a desktop app. It is the industry standard (VS Code, Slack, Discord) despite the file size.

When to Use

  • Cross-Platform Desktop Applications: Building native macOS, Windows, and Linux apps using web technologies (HTML, CSS, JS).
  • Desktop Software Requiring Deep OS Integration: System tray menus, native notifications, file system access, and global hotkeys.
  • High-Performance Offline Desktop Tools: IDEs (VS Code), communication tools (Slack), and media editors.
  • Enterprise Desktop Packaging: Code-signing, auto-updating, and multi-architecture builds (x64, arm64).

Quick Start

// main.js
const { app, BrowserWindow } = require("electron");
const path = require("path");

function createWindow() {
  const win = new BrowserWindow({
    width: 1000,
    height: 700,
    webPreferences: {
      preload: path.join(__dirname, "preload.js"),
      contextIsolation: true,
      nodeIntegration: false,
    },
  });
  win.loadFile("index.html");
}

app.whenReady().then(createWindow);

Core Concepts

Secure Main and Renderer Architecture with Context Isolation

Enforcing security boundaries via preload scripts:

// main.js (Main Process)
const { app, BrowserWindow, ipcMain } = require("electron");
const path = require("path");

function createWindow() {
  const win = new BrowserWindow({
    width: 1200,
    height: 800,
    webPreferences: {
      preload: path.join(__dirname, "preload.js"),
      contextIsolation: true, // Enforce security isolation
      nodeIntegration: false, // Disable raw Node in renderer
      sandbox: true,
    },
  });

  win.loadFile("index.html");
}

ipcMain.handle("read-app-version", async () => {
  return app.getVersion();
});

app.whenReady().then(createWindow);

Preload Script & ContextBridge

Exposing safe, audited IPC channels to renderer window:

// preload.js (Preload Script)
const { contextBridge, ipcRenderer } = require("electron");

contextBridge.exposeInMainWorld("electronAPI", {
  getAppVersion: () => ipcRenderer.invoke("read-app-version"),
  onFileSaved: (callback) => {
    ipcRenderer.on("file-saved", (_event, value) => callback(value));
  },
});

Renderer Process Invocation

Calling native desktop capabilities from client frontend:

// renderer.ts (Frontend / React / Vue / Vanilla)
declare global {
  interface Window {
    electronAPI: {
      getAppVersion: () => Promise<string>;
      onFileSaved: (callback: (path: string) => void) => void;
    };
  }
}

async function initUI() {
  const version = await window.electronAPI.getAppVersion();
  const versionDisplay = document.getElementById("app-version");
  if (versionDisplay) {
    versionDisplay.textContent = `v${version}`;
  }
}

initUI();

Common Patterns

Secure IPC Communication with Context Bridge

Problem: Enabling Renderer processes to communicate with OS APIs without creating remote code execution vulnerabilities.

Solution: Expose strictly typed APIs via contextBridge in preload.js:

// preload.js
const { contextBridge, ipcRenderer } = require("electron");

contextBridge.exposeInMainWorld("electronAPI", {
  openFile: () => ipcRenderer.invoke("dialog:openFile"),
});

// main.js: ipcMain.handle("dialog:openFile", async () => { ... });

Best Practices

Do:

  • Always set contextIsolation: true and nodeIntegration: false in webPreferences.
  • Enforce Content Security Policy (CSP) headers in all loaded HTML files to prevent XSS execution.
  • Use ipcMain.handle() and ipcRenderer.invoke() for asynchronous request-response IPC.
  • Validate and sanitize all IPC arguments received from renderer processes.

Don't:

  • Enable webSecurity: false or disable certificate validation.
  • Expose entire Node.js modules (e.g. fs, child_process) through contextBridge.
  • Block the Main process event loop with heavy computation; delegate work to utility processes.

Troubleshooting

ErrorCauseSolution
require is not defined in renderer processnodeIntegration: false and contextIsolation: true enabled (secure default).Expose necessary Node functions through preload.js with contextBridge.
Error: Cannot find module 'electron'Electron installed globally instead of local devDependencies.Run npm install --save-dev electron in project directory.
White screen on app launch in productionAsset paths relative to file system failing when packaged.Use hash routing or ensure relative paths (./) in build output.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.