AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Getting Started

skill-ohvignas-claude-electron-skills-getting-started · by ohvignas

Use when starting a new Electron app or learning Electron from scratch — débuter avec Electron, créer/scaffolder une app desktop, "how do I start an Electron app", set up package.json `main`, `app.whenReady()`, create a `BrowserWindow`, `loadFile('index.html')`, wire a `preload.js`, run with `electron .` or `npm start`, understand main vs renderer vs preload, fix "app is not ready" / blank window…

No reviews yet
0 installs
21 views
0.0% view→install

Install

$ agentstack add skill-ohvignas-claude-electron-skills-getting-started

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-ohvignas-claude-electron-skills-getting-started)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Getting Started? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Getting Started with Electron

Overview

Electron builds cross-platform desktop apps (macOS, Windows, Linux) with HTML/CSS/JS by combining Chromium for the UI and Node.js for system access. Mental model: one main process (Node.js, controls lifecycle and windows) drives many renderer processes (web pages, no Node by default), and a preload script safely bridges the two.

When to use

  • Scaffolding a brand-new Electron app from an empty folder.
  • You need the minimal runnable skeleton: package.json main, main.js, index.html, optional preload.js.
  • Clarifying the main/renderer/preload split before writing real features.
  • You hit a blank window, "app is not ready", or require is not defined in the page.

When NOT to use: deep IPC patterns → process-model-ipc; window options → windows; security hardening → security; building installers → distribution.

Quick reference

| API | Purpose | |---|---| | package.json "main" | Entry script = the main process; defaults to index.js | | app.whenReady() | Promise; create windows only after it resolves | | new BrowserWindow(opts) | Open a window; width/height/webPreferences.preload | | win.loadFile('index.html') | Load a local HTML file into the renderer | | app.on('window-all-closed') | Quit, except on macOS (process.platform !== 'darwin') | | app.on('activate') | macOS: re-open a window when dock icon clicked with none open | | contextBridge.exposeInMainWorld() | Expose preload APIs to the renderer safely | | electron . / npm start | Run the app from the project root |

Example

Complete minimal app — four files that actually run (npm i -D electron, then npm start).

// package.json — "main" tells Electron which script is the main process
{
  "name": "my-electron-app",
  "version": "1.0.0",
  "main": "main.js",
  "scripts": { "start": "electron ." },
  "devDependencies": { "electron": "^42.0.0" }
}
// main.js — the MAIN process: Node.js, owns the app lifecycle
const { app, BrowserWindow } = require('electron/main')
const path = require('node:path')

const createWindow = () => {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    // preload runs before page JS, with Node access the renderer lacks
    webPreferences: { preload: path.join(__dirname, 'preload.js') }
  })
  win.loadFile('index.html')
}

// Windows must be created AFTER the app is ready, never before.
app.whenReady().then(() => {
  createWindow()
  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) createWindow() // macOS
  })
})

// macOS apps stay alive when all windows close; others quit.
app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit()
})
// preload.js — bridges main↔renderer; contextIsolation keeps it safe
const { contextBridge } = require('electron')
contextBridge.exposeInMainWorld('versions', {
  node: () => process.versions.node,
  electron: () => process.versions.electron
})

  
    
    
    Hello Electron
  
  
    Hello from Electron 👋
    
    
      // `versions` comes from preload via contextBridge, not Node directly.
      document.getElementById('info').innerText =
        `Node ${window.versions.node()} · Electron ${window.versions.electron()}`
    
  

Common mistakes

  • Creating a BrowserWindow before app.whenReady() → crash/empty window. Always create windows inside app.whenReady().then(...).
  • Calling require in the rendererrequire is not defined. The renderer has no Node by default (contextIsolation on); expose APIs through a preload + contextBridge instead.
  • Quitting on macOS — without the process.platform !== 'darwin' guard the app dies on window close, breaking macOS convention; pair it with the activate handler.
  • Wrong/missing main field → Electron can't find your entry script. It must point at main.js.
  • Relative preload path — use path.join(__dirname, 'preload.js'), not 'preload.js'.

Reference

Full API tables: [reference.md](reference.md)

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.