mindrally/skills

electron-development

Electron development guidelines for building cross-platform desktop applications with JavaScript/TypeScript

All-time #9435 Trending #7247 Hot #2272 First seen Jan 25, 2026
8-week activity · all time api

Installation

$ npx skills add mindrally/skills --skill electron-development

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from mindrally/skills · top by installs.

npx skills add mindrally/skills

Browse all from mindrally/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 258
Default branch main
Open issues 0
Status Active

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 4,050 B
  • docs SUMMARY.md 135 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1,100 installs

SKILL.md

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

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

Preload Scripts

// 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

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

IPC Communication

Main Process

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

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

Window Management

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

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