Skip to main content
skill CX Codex

electron-development — Claude Code skill: Electron app guidelines

A skill that gives the agent rules for building Electron desktop apps: process separation, IPC, window security.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill electron-development -a claude-code
Open on GitHub

What electron-development does

The skill lays out how an Electron project is put together and tells the agent where code belongs. It covers a src/ layout with main/, renderer/, preload/ and shared/ folders, plus examples for the main and renderer processes and IPC handlers built on ipcMain.handle and ipcMain.on.

Security gets its own section: contextIsolation: true, nodeIntegration: false, preload scripts that expose APIs through contextBridge with a channel allowlist, and a Content Security Policy header. There are also sections on window management, auto updates via electron-updater, native modules and packaging with electron-builder.

Use it whether you are starting an Electron app or already shipping one. For native dependencies it suggests electron-rebuild, and for tests it points at Spectron or Playwright. Nothing to install up front: this is a set of instructions for the agent, not a library.

What it helps with

  • split Electron code across main, renderer and preload
  • set up secure windows with contextIsolation and a preload script
  • wire renderer and main process through IPC channels
  • add auto updates with electron-updater
  • package installers with electron-builder

Example prompts for the agent

  • Restructure my Electron project using the electron-development layout
  • Check my BrowserWindow settings for security issues with electron-development
  • Add an IPC handler for reading a file the way electron-development describes

How to install electron-development

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill electron-development -a claude-code

2Manually: put the files in place

~/.claude/skills/electron-development/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/electron-development/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about electron-development

How do I install electron-development in Claude?

Run npx skills add Mindrally/skills --skill electron-development -a claude-code. The skill lands in ~/.claude/skills/electron-development/SKILL.md.

What does electron-development do?

It gives the agent guidelines for Electron desktop apps: project structure, IPC communication, window security and packaging.

Does the skill require extra dependencies?

No, it is plain instruction text for the agent. Packages like electron-updater and electron-builder are mentioned as part of the Electron project itself.

Source text

SKILL.md · Apache-2.0
---
name: electron-development
description: Electron development guidelines for building cross-platform desktop applications with JavaScript/TypeScript
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Electron Development Guidelines

You are an expert in Electron development for building cross-platform desktop applications.

## Core Principles

- Follow security best practices for Electron apps
- Separate main and renderer process concerns
- Use IPC for process communication
- Implement proper window management

## Project Structure

```
src/
├── main/              # Main process code
│   ├── index.ts      # Entry point
│   ├── ipc/          # IPC handlers
│   └── utils/        # Utilities
├── renderer/          # Renderer process code
│   ├── components/   # UI components
│   ├── pages/        # Application pages
│   └── styles/       # Stylesheets
├── preload/          # Preload scripts
│   └── index.ts     # Expose APIs to renderer
└── shared/           # Shared types and utilities
```

## Security Best Practices

### Context Isolation
```javascript
// main.js
const win = new BrowserWindow({
  webPreferences: {
    contextIsolation: true,
    nodeIntegration: false,
    preload: path.join(__dirname, 'preload.js')
  }
});
```

### Preload Scripts
```javascript
// preload.js
const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('electronAPI', {
  sendMessage: (channel, data) => {
    const validChannels = ['toMain'];
    if (validChannels.includes(channel)) {
      ipcRenderer.send(channel, data);
    }
  },
  onMessage: (channel, callback) => {
    const validChannels = ['fromMain'];
    if (validChannels.includes(channel)) {
      ipcRenderer.on(channel, (event, ...args) => callback(...args));
    }
  }
});
```

### Content Security Policy
```html
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
```

## IPC Communication

### Main Process
```javascript
const { ipcMain } = require('electron');

ipcMain.handle('read-file', async (event, filePath) => {
  const content = await fs.promises.readFile(filePath, 'utf-8');
  return content;
});

ipcMain.on('save-file', (event, { path, content }) => {
  fs.writeFileSync(path, content);
  event.reply('file-saved', { success: true });
});
```

### Renderer Process
```javascript
// Using exposed API from preload
const content = await window.electronAPI.readFile('/path/to/file');
```

## Window Management

```javascript
const { BrowserWindow } = require('electron');

function createWindow() {
  const win = new BrowserWindow({
    width: 1200,
    height: 800,
    minWidth: 800,
    minHeight: 600,
    webPreferences: {
      contextIsolation: true,
      preload: path.join(__dirname, 'preload.js')
    }
  });

  // Handle window events
  win.on('closed', () => {
    // Cleanup
  });

  // Load content
  if (process.env.NODE_ENV === 'development') {
    win.loadURL('http://localhost:3000');
    win.webContents.openDevTools();
  } else {
    win.loadFile('dist/index.html');
  }
}
```

## Auto Updates

```javascript
const { autoUpdater } = require('electron-updater');

autoUpdater.on('update-available', () => {
  // Notify user
});

autoUpdater.on('update-downloaded', () => {
  autoUpdater.quitAndInstall();
});

app.whenReady().then(() => {
  autoUpdater.checkForUpdatesAndNotify();
});
```

## Native Modules

- Use electron-rebuild for native dependencies
- Consider node-addon-api for custom modules
- Test native modules on all platforms
- Handle architecture differences (x64, arm64)

## Performance

- Minimize main process blocking
- Use web workers for heavy computation
- Implement lazy loading
- Profile with DevTools

## Testing

- Use Spectron or Playwright for E2E tests
- Unit test main process logic
- Test IPC handlers
- Test on all target platforms

## Building and Distribution

- Use electron-builder for packaging
- Configure proper app signing
- Set up auto-update infrastructure
- Test installers on all platforms

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Frontend and UI →

From the same set168

front-end-developer Turns your agent into a senior front-end developer: React, Next.js, TypeScript, Tailwind, accessibility. Useful when you want components written, not discussed. CX Codex +1 1,300installs lua Gives the agent a rulebook for Lua: tables, metatables, error handling, game loops and memory. Useful when your project is Lua or Love2D. CX Codex +1 1,300installs tauri-development The skill provides guidelines for building desktop applications with Tauri. It sets coding standards across Rust and TypeScript. CX Codex +1 1,300installs nextjs-typescript-tailwindcss-supabase A skill that steers your agent toward Next.js 14, TypeScript, TailwindCSS and Supabase: server components, error handling, readable code. CX Codex +1 1,300installs alpine-js Guidelines for building reactive Alpine.js interfaces with minimal JavaScript. Helps generate UI components paired with Tailwind CSS, Livewire, and Ghost CMS. CX Codex +1 1,300installs zod-schema-validation Guides agents on writing Zod schemas, inferring TypeScript types, and validating boundaries in APIs and UI forms. Keeps validation consistent across the codebase. CX Codex +1 1,200installs kafka-development A skill that hands your agent Kafka best practices: topics, partitions, producer and consumer settings, Schema Registry. Useful when you build event-driven code. CX Codex +1 1,200installs bootstrap Tells the agent how to build interfaces with Bootstrap: grid, components, utilities, form validation. Useful when you want no custom CSS. CX Codex +1 1,200installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor