electron
Skill1 starsChanged 4 months agoMITView on GitHub
Electron-specific expertise — the main/renderer/preload process model and which code belongs in each, the non-negotiable security baseline (`contextIsolation: true`, `nodeIntegration: false`, `sandbox: true`, a minimal `contextBridge` surface, CSP, `setWindowOpenHandler`/`will-navigate` guards, validated `shell.openExternal`), IPC done as `ipcRenderer.invoke`/`ipcMain.handle` with per-channel validated arguments instead of a generic "run this" bridge, keeping the main process off blocking work, correct userData/file paths, and packaging concerns (asar, native module rebuilds, code signing, auto-update). Use when `package.json` lists `electron`, `electron-builder`, `electron-forge`, or `electron-vite`, when a `main`/`preload` entry or `BrowserWindow` appears in the repo, or when asked directly (Thai or English) to สร้าง/แก้ไข desktop app ด้วย Electron. Not a replacement for frontend-dev's UI work or react's component rules — the renderer is still a web app and those still apply; this skill covers what is specific to running it as a desktop process with OS access.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- Quad4-Software/skillstheir own version, first seen Oct 3, 2026
- BytePioneer-AI/codex-hosttheir own version, first seen Oct 2, 2026
- skillpie/ZCodeOnlinetheir own version, first seen Sep 29, 2026
- ccbud/CCBuddytheir own version, first seen Sep 24, 2026
- ZCodium-project/ZCodiumtheir own version, first seen Sep 20, 2026
- vercel-labs/agent-browsertheir own version, first seen Sep 16, 2026
Used with
Projects with it also use architecture-governance, dep-refs and 3 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.
ZCodium-projectSkillarchitecture-governance
Apply the repository's architecture policy to code changes by generating a bounded context package, checking module and layer boundaries, and reporting baseline-aware violations. Use for any code change; skip for documentation-only work.
Also in 4 projects that use this
ZCodium-projectSkilldep-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 4 projects that use this
VercelSkillai-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 4 projects that use this
VercelSkillvercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Also in 3 projects that use this
- +1 more from ZCodium-project
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- vercel-labs/agent-browser★ 44ksame name
- BytePioneer-AI/codex-host★ 2.7ksame name
- opral/flashtype★ 294same name
- ZCodium-project/ZCodium★ 215same name
- ccbud/CCBuddy★ 8same name
- flpbalada/fb-skills★ 8same name
- wende/macbeth★ 4same name
- JayAI623/claude-code-config★ 2same name
- skillpie/ZCodeOnline★ 2same name
- Quad4-Software/skills★ 1same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- agent-flowSkill
- dev-testingSkill
- dry-and-corSkill
- firebaseSkill
- flutterSkill
- google-authSkill
- html-cssSkill
- mysqlSkill
- nodejsSkill
- postgresSkill
- reactSkill
- sqliteSkill
- stack-briefingSkill
- supabaseSkill
- tailwindSkill
- tursoSkill
- typescriptSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
21 rules. 0 are common, 6 are distinctive, and 15 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 19
Check package.json for electron, electron-builder, electron-forge, or electron-vite, and locate the main entry, the preload script(s), and …
- Very specific: line 64
Only load content you control.
- Very specific: line 73
Never enable webviewTag or enableRemoteModule (removed in modern versions) unless there's no alternative, and never accept webPreferences …
- Distinctive: line 76
Run Electronegativity (or the equivalent checklist) before shipping, and keep the Electron version current — an out-of-date Electron pins …
- Very specific: line 82
Use ipcRenderer.invoke / ipcMain.handle for request-response, and webContents.send / ipcRenderer.on for main→renderer events.
- Very specific: line 95
Check event.senderFrame/the sender's URL in handlers when multiple windows or frames exist with different privileges.
- Very specific: line 97
Don't expose ipcRenderer itself, require, or any Node module on window.
- Very specific: line 99
Keep secrets (API keys, tokens) in the main process, and never in renderer code or localStorage — a packaged app is an unpacked archive to …
- Very specific: line 110
Create windows with show: false and show them on the ready-to-show event to avoid a white flash.
- Very specific: line 116
Write user data under app.getPath('userData'), never next to the executable — the install directory is read-only for a normal user on …
- Distinctive: line 139
Don't ship devtools-open, verbose logging of user data, or development URLs in the production build.
- Very specific: line 159
Don't set nodeIntegration: true, contextIsolation: false, sandbox: false, or webSecurity: false — not even "temporarily" in development.
- Very specific: line 161
Don't expose ipcRenderer, require, fs, or a generic invoke through contextBridge.
- Distinctive: line 163
Don't trust IPC arguments, and don't accept a filesystem path from the renderer without resolving and bounding it.
- Very specific: line 165
Don't load third-party web content in a privileged window, and don't pass an unvalidated URL to shell.openExternal.
- Distinctive: line 167
Don't embed API keys or secrets in the app — a packaged build is readable.
- Distinctive: line 168
Don't block the main process.
- Very specific: line 169
Don't write files next to the executable instead of userData.
- Distinctive: line 170
Don't ship an unsigned build or an update channel without signature verification.
- Very specific: line 172
Don't treat asar as protection, and don't leave the Electron version behind on an old Chromium.
- Very specific: line 174
Don't restate renderer-side UI rules here — frontend-dev, skills/react/SKILL.md, and skills/html-css/SKILL.md own those.
“Common” is measured: kept by at least 6 in 10 of the 12 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.
Files
Electron
A desktop shell around a Chromium renderer and a Node main process. Inside
the renderer, everything in skills/html-css/SKILL.md,
skills/react/SKILL.md, and skills/tailwind/SKILL.md still applies —
it is a web UI. The main process is Node, so skills/nodejs/SKILL.md
applies there. What this skill adds is the part that has no web equivalent:
a process boundary that is also a trust boundary, because the renderer
runs remote-influenced content with an OS-privileged process on the other
side of it.
Step 1 — Confirm Electron and find the three entry points
Check package.json for electron, electron-builder, electron-forge,
or electron-vite, and locate the main entry, the preload script(s), and
the renderer root. Read the existing BrowserWindow options before adding a
window — this is where the security posture of the whole app is set, and
copying a window's options forward is how an insecure setting spreads. Note
the Electron major version; the security defaults changed across versions
and older tutorials assume the unsafe ones.
Step 2 — What belongs in which process
- Main: window lifecycle, menus, tray, dialogs, filesystem, child processes, auto-update, anything touching the OS. One instance, and it owns all privilege.
- Preload: the only bridge. Runs before the page loads with access to a
limited Node surface, and exposes a specific, named API to the
renderer via
contextBridge. - Renderer: the UI. Treat it as untrusted — it renders content that may include remote data, and any XSS there becomes a request across the bridge.
- Business logic that needs OS access lives in main and is invoked through a named IPC channel; don't move it to the renderer by widening the bridge.
Step 3 — The security baseline (non-negotiable)
Every BrowserWindow gets:
webPreferences: {
contextIsolation: true, // default since Electron 12 — never turn off
nodeIntegration: false, // default since Electron 5 — never turn on
sandbox: true,
preload: path.join(__dirname, 'preload.js'),
}nodeIntegration: truewith any remote content is remote code execution.contextIsolation: falselets page script reach the preload's scope and prototype-pollute the bridge. If either appears in the repo, that is a finding forsecurity-auditor, not a style preference.webSecurity: false,allowRunningInsecureContent, and disabled certificate-error handling are the same category — never used to "fix" CORS or a self-signed certificate in development, because they ship.- Set a Content Security Policy on the loaded document (no
unsafe-eval/unsafe-inline), and don't load application code over plainhttp:in production. - Only load content you control.
loadURLof a third-party site inside your privileged app puts their JavaScript one bridge away from your handlers; use the system browser instead. setWindowOpenHandlershould deny by default and pass vetted URLs toshell.openExternal; add awill-navigatehandler that blocks navigation away from your own origin.shell.openExternalwith an unvalidated string is a command-execution primitive (file:, and OS-specific schemes). Allowlisthttps:(andmailto:if needed) and reject everything else.- Never enable
webviewTagorenableRemoteModule(removed in modern versions) unless there's no alternative, and never acceptwebPreferencesfrom page content. - Run Electronegativity (or the equivalent checklist) before shipping, and keep the Electron version current — an out-of-date Electron pins an out-of-date Chromium with published CVEs.
Step 4 — IPC design
- Use
ipcRenderer.invoke/ipcMain.handlefor request-response, andwebContents.send/ipcRenderer.onfor main→renderer events. Avoid the fire-and-forgetsend/onpair for anything that needs a result. - Expose narrow, purpose-named functions across the bridge —
saveInvoice(data), notinvoke(channel, …args)orreadFile(path). A generic passthrough hands the renderer everything the main process can do and makes the bridge pointless. - Validate every argument in the main process handler: type, shape, and
range. Treat IPC input exactly like an HTTP request body — same schema
validation, same reasoning as
skills/typescript/SKILL.md's boundary rule. - Any path from the renderer must be resolved and confirmed to sit under an allowed root; a bridged "read this file" is a full filesystem read otherwise.
- Check
event.senderFrame/the sender's URL in handlers when multiple windows or frames exist with different privileges. - Don't expose
ipcRendereritself,require, or any Node module onwindow. - Keep secrets (API keys, tokens) in the main process, and never in renderer
code or
localStorage— a packaged app is an unpacked archive to anyone who wants to look. Anything that must remain secret belongs on a server, not in the app.
Step 5 — Responsiveness and lifecycle
- The main process is single-threaded and blocking it freezes every
window, including their animations and input. No sync filesystem calls, no
CPU-heavy loops — same rules as
skills/nodejs/SKILL.md, with a more visible symptom. - Create windows with
show: falseand show them on theready-to-showevent to avoid a white flash; restore window bounds from persisted state rather than always centering. - Handle
window-all-closedandactivateper platform (macOS apps stay alive with no windows), and useapp.requestSingleInstanceLock()for a single-instance app. - Write user data under
app.getPath('userData'), never next to the executable — the install directory is read-only for a normal user on Windows and inside a signed bundle on macOS. - Guard
will-quit/before-quitto flush pending writes; a database or settings file written on quit needs the async work to actually complete.
Step 6 — Build, packaging, and updates
- Pick one toolchain (electron-builder or Forge) and keep the config in the repo. Renderer bundling is a normal frontend build; the main/preload bundle has different externals and must not be tree-shaken as browser code.
asar: truepackages sources into one archive — it is not encryption and not obfuscation; it only stops casual browsing.- Native modules must be built against Electron's ABI
(
electron-rebuild/the toolchain's hook), not the system Node. "Works in dev, crashes in the packaged app" is usually this. - Code sign and notarize (macOS) / sign (Windows) — an unsigned app is blocked or warned about, and auto-update mostly requires signing.
- Auto-update must fetch over HTTPS from a source you control with signature
verification (
electron-updateror Squirrel). An unsigned or unauthenticated update channel is a remote code execution channel into every user's machine. - Don't ship devtools-open, verbose logging of user data, or development URLs in the production build; gate them on the packaged flag.
Step 7 — Self-check before reporting done
Confirm every BrowserWindow sets contextIsolation: true,
nodeIntegration: false, sandbox: true, and a preload, and that no
webSecurity: false or remote-content load slipped in. Confirm the
contextBridge surface is a list of named operations with no generic invoke,
and every ipcMain.handle validates its arguments and any path. Confirm
setWindowOpenHandler/will-navigate deny by default and shell.
openExternal is allowlisted. Confirm nothing synchronous or CPU-bound runs
in the main process during interaction, user data goes to
app.getPath('userData'), and native modules are rebuilt for Electron.
Then actually launch the packaged (not just the dev) app and drive one
real user task per skills/dev-testing/SKILL.md, treating an uncaught
renderer console error or a main-process exception as a failure.
What not to do
- Don't set
nodeIntegration: true,contextIsolation: false,sandbox: false, orwebSecurity: false— not even "temporarily" in development. - Don't expose
ipcRenderer,require,fs, or a genericinvokethroughcontextBridge. - Don't trust IPC arguments, and don't accept a filesystem path from the renderer without resolving and bounding it.
- Don't load third-party web content in a privileged window, and don't pass
an unvalidated URL to
shell.openExternal. - Don't embed API keys or secrets in the app — a packaged build is readable.
- Don't block the main process; every window freezes with it.
- Don't write files next to the executable instead of
userData. - Don't ship an unsigned build or an update channel without signature verification.
- Don't treat
asaras protection, and don't leave the Electron version behind on an old Chromium. - Don't restate renderer-side UI rules here —
frontend-dev,skills/react/SKILL.md, andskills/html-css/SKILL.mdown those.
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
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.

