π¦ ClawHub
Electron
by @ivangdavila
Build Electron desktop apps with secure architecture and common pitfall avoidance.
TERMINAL
clawhub install electronπ About This Skill
name: Electron description: Build Electron desktop apps with secure architecture and common pitfall avoidance. metadata: {"clawdbot":{"emoji":"β‘","requires":{"bins":["npm"]},"os":["linux","darwin","win32"]}}
Security Non-Negotiables
nodeIntegration: false is mandatory β renderer with Node.js access means XSS = full system compromisecontextIsolation: true is mandatory β separates preload context from renderereval() or new Function() in renderer β defeats all security boundariesPreload Script Rules
contextBridge.exposeInMainWorld() is the only safe bridge β raw ipcRenderer exposure is vulnerableArchitecture Traps
webPreferences locked after window creation β can't enable nodeIntegration latershow: false then ready-to-show β prevents white flash, looks more nativeNative Module Pain
electron-rebuild after every Electron upgrade β version mismatch = runtime crashPackaging Pitfalls
app.setAppUserModelId() β silent failure without itPlatform-Specific Issues
file:// protocol β use custom protocol (app://) or local server--universal flag β ships both Intel and ARMMemory and Performance
win.destroy() explicitly when donebackgroundThrottling: false if timers matter when minimizedDebugging
--inspect flag, connect via chrome://inspectwebContents.openDevTools() or keyboard shortcutelectron-log for persistent logs β console.log vanishes on restart