electron-main-preload-generator
БесплатноБез исполняемых скриптовНе проверенGenerate secure main process and preload script boilerplate with proper context isolation, IPC patterns, and security best practices for Electron applications
от a5c-ai★ 1 947 звёзд на GitHubОб этом скилле
electron-main-preload-generator
Generate secure Electron main process and preload scripts with proper context isolation, secure IPC patterns, and comprehensive security best practices. This skill creates production-ready boilerplate that follows Electron security guidelines.
Capabilities
- Generate secure main process (
main.js/main.ts) with proper window configuration - Create preload scripts with context-isolated IPC bridge
- Implement secure IPC patterns with channel whitelisting
- Configure Content Security Policy (CSP) headers
- Set up secure BrowserWindow options with sandbox enabled
- Generate TypeScript type definitions for IPC channels
- Implement permission handlers for sensitive APIs
Input Schema
{
"type": "object",
"properties": {
"projectPath": {
"type": "string",
"description": "Path to the Electron project root"
},
"language": {
"enum": ["javascript", "typescript"],
"default": "typescript"
},
"features": {
"type": "array",
"items": {
"enum": [
"contextIsolation",
"sandbox",
"csp",
"ipcChannels",
"permissionHandler",
"protocolHandler",
"deepLinking",
"autoUpdater",
"tray",
"multiWindow"
]
},
"default": ["contextIsolation", "sandbox", "csp", "ipcChannels"]
},
"ipcChannels": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"direction": { "enum": ["toMain", "toRenderer", "bidirectional"] },
"description": { "type": "string" },
"requestSchema": { "type": "object" },
"responseSchema": { "type": "object" }
},
"required": ["name", "direction"]
},
"description": "Define IPC channels for the application"
},
"windowConfig": {
"type": "object",
"properties": {
"width": { "type": "number", "default": 1200 },
"height": { "type": "number", "default": 800 },
"minWidth": { "type": "number" },
"minHeight": { "type": "number" },
"frame": { "type": "boolean", "default": true },
"transparent": { "type": "boolean", "default": false },
"titleBarStyle": { "enum": ["default", "hidden", "hiddenInset", "customButtonsOnHover"] }
}
},
"cspPolicy": {
"type": "object",
"properties": {
"defaultSrc": { "type": "array", "items": { "type": "string" } },
"scriptSrc": { "type": "array", "items": { "type": "string" } },
"styleSrc": { "type": "array", "items": { "type": "string" } },
"imgSrc": { "type": "array", "items": { "type": "string" } },
"connectSrc": { "type": "array", "items": { "type": "string" } }
}
}
},
"required": ["projectPath"]
}
Output Schema
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": { "type": "string" },
"type": { "enum": ["main", "preload", "types", "utils"] },
"description": { "type": "string" }
}
}
},
"securityChecklist": {
"type": "array",
"items": {
"type": "object",
"properties": {
"check": { "type": "string" },
"status": { "enum": ["implemented", "recommended", "optional"] },
"details": { "type": "string" }
}
}
},
"warnings": { "type": "array", "items": { "type": "string" } }
},
"required": ["success", "files"]
}
Usage Instructions
- Analyze existing project: Check for existing main/preload files and framework usage
- Determine security requirements: Based on application features and data sensitivity
- Generate main process: Create secure BrowserWindow configuration
- Generate preload script: Implement context-isolated IPC bridge
- Generate type definitions: If TypeScript, create IPC channel types
- Validate security: Run security checklist
Generated File Structure
src/
main/
main.ts # Main process entry point
ipc-handlers.ts # IPC handler implementations
window-manager.ts # Multi-window management (optional)
protocol-handler.ts # Custom protocol registration (optional)
permission-handler.ts # Permission request handling
preload/
preload.ts # Preload script with contextBridge
api.ts # Exposed API definitions
shared/
ipc-channels.ts # IPC channel definitions
types.ts # Shared TypeScript types
Code Templates
Secure Main Process
import { app, BrowserWindow, session, ipcMain } from 'electron';
import path from 'path';
// Security: Disable remote module (deprecated but check)
app.disableHardwareAcceleration(); // Optiona
Установить electron-main-preload-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBashGlobGrepВложенные файлы
FAQ
Что делает скилл electron-main-preload-generator?
Generate secure main process and preload script boilerplate with proper context isolation, IPC patterns, and security best practices for Electron applications
Как установить скилл electron-main-preload-generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл electron-main-preload-generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic