templates/skills/frameworks/electron/SKILL.md
Language: TypeScript, JavaScript
npx skillsauth add hivellm/rulebook ElectronInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Language: TypeScript, JavaScript
Version: Electron 28+
// main.ts (Main Process)
import { app, BrowserWindow } from 'electron'
import path from 'path'
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 800,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
},
})
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
# Type check
npm run type-check
# Lint
npm run lint
# Tests
npm test
# Build
npm run build # Compile TypeScript
npm run package # Package app
npm run make # Create distributables
✅ DO:
❌ DON'T:
src/
├── main/
│ ├── main.ts # Main process
│ ├── preload.ts # Preload script
│ └── ipc/ # IPC handlers
├── renderer/
│ ├── index.html
│ ├── renderer.ts
│ └── components/
└── shared/
└── types.ts
// preload.ts
import { contextBridge, ipcRenderer } from 'electron'
contextBridge.exposeInMainWorld('electronAPI', {
sendMessage: (message: string) => ipcRenderer.send('message', message),
onReply: (callback: (reply: string) => void) =>
ipcRenderer.on('reply', (_event, reply) => callback(reply)),
})
// main.ts
import { ipcMain } from 'electron'
ipcMain.on('message', (event, message) => {
console.log(message)
event.reply('reply', 'Message received')
})
// renderer.ts
declare global {
interface Window {
electronAPI: {
sendMessage: (message: string) => void
onReply: (callback: (reply: string) => void) => void
}
}
}
window.electronAPI.sendMessage('Hello from renderer')
window.electronAPI.onReply((reply) => console.log(reply))
// ✅ Good security configuration
const win = new BrowserWindow({
webPreferences: {
contextIsolation: true, // ✅ MUST enable
nodeIntegration: false, // ✅ MUST disable
sandbox: true, // ✅ Enable sandbox
webSecurity: true, // ✅ Enable web security
allowRunningInsecureContent: false, // ✅ Block insecure content
},
})
// Content Security Policy
session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
callback({
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': ["default-src 'self'"]
}
})
})
<!-- ELECTRON:END -->research
Author a rulebook task spec interactively — research, draft, ask the user clarifying questions, confirm, then create the tasks in rulebook ready for /rulebook-driver. Use when the user wants to plan/spec a feature before implementing.
development
Behavioral guidelines to reduce common LLM coding mistakes — overcomplication, sloppy refactors, hidden assumptions, weak goals. Use when writing, reviewing, or refactoring code. Auto-applies; invoke explicitly via /karpathy-guidelines or 'follow karpathy discipline'.
data-ai
Autonomous AI agent loop for iterative task implementation (@hivehub/rulebook ralph)
data-ai
Use SQL Server for enterprise relational data storage with advanced features, high availability, and Windows integration.