electron-skills について
LlamaFarm Desktop 向けの Electron 開発ガイドです。プロセス構成、IPC、セキュリティ、パフォーマンスのパターンを扱い、TypeScript スキルを補完します。
主な機能
- 01メイン、プリロード、レンダラーパターン
- 02型安全な IPC の指針
- 03コンテキスト分離とプリロードの安全性
- 04ウィンドウと起動のパフォーマンス指針
活用シーン
- 01Electron プロセス間通信の設計
- 02プリロード API とレンダラーの安全性確認
- 03ウィンドウ管理と起動の最適化
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ llama-farm/ llamafarm --skill electron-skillsインストール後、Claude Code で/electron-skillsを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
electron.mdperformance.mdsecurity.md詳細
LlamaFarm Desktop 向け Electron スキル
LlamaFarm Desktop アプリケーション向けの Electron 28 + Electron Vite パターンです。
概要
このスキルは、メイン/レンダラープロセスのアーキテクチャ、IPC 通信、セキュリティ、パフォーマンスに関する Electron 固有のパターンを、typescript-skills に追加します。
技術スタック
| コンポーネント | 技術 | 目的 |
|---|---|---|
| フレームワーク | Electron 28 | デスクトップアプリケーションのフレームワーク |
| ビルド | electron-vite 2 | メイン/プリロード/レンダラー向けの Vite ベースのビルド |
| アップデート | electron-updater | GitHub リリース経由の自動アップデート |
| パッケージング | electron-builder | クロスプラットフォームのパッケージング(macOS/Win/Linux) |
アーキテクチャ
electron-app/
src/
main/ # Main process (Node.js context)
index.ts # App entry, lifecycle, IPC handlers
backend/ # CLI installer, model downloader
window-manager.ts
menu-manager.ts
logger.ts
preload/ # Preload scripts (bridge context)
index.ts # contextBridge API exposure
renderer/ # Renderer process (browser context)
index.html # Main window
splash.html # Splash screen
基本原則
- プロセスの分離 - メイン、プリロード、レンダラーは別々のコンテキストです
- コンテキストの分離 - 常に
contextBridge.exposeInMainWorldを使用します - レンダラーで Node を使用しない - 常に
nodeIntegration: falseにします - 型安全な IPC - チャネルの型とペイロードのスキーマを定義します
- デフォルトでセキュア - プリロードで公開する API を最小限にします
関連ドキュメント
- electron.md - IPC パターン、メイン/レンダラー間の通信
- security.md - コンテキストの分離、プリロードのセキュリティ、CSP
- performance.md - ウィンドウ管理、メモリ、起動
共通の TypeScript パターン
このスキルは typescript-skills を継承します:
- patterns.md - 慣用的な TypeScript
- typing.md - 厳密な型付け、ジェネリクス
- security.md - 入力検証、XSS 対策
クイックリファレンス
IPC ハンドラーパターン(メインプロセス)
ipcMain.handle('cli:info', async () => {
const isInstalled = await this.cliInstaller.isInstalled()
return {
isInstalled,
path: isInstalled ? this.cliInstaller.getCLIPath() : null
}
})
プリロードブリッジパターン
const api = {
cli: {
getInfo: () => ipcRenderer.invoke('cli:info')
},
platform: process.platform,
version: process.versions.electron
}
contextBridge.exposeInMainWorld('llamafarm', api)
BrowserWindow の設定
new BrowserWindow({
webPreferences: {
preload: path.join(__dirname, '../preload/index.js'),
nodeIntegration: false,
contextIsolation: true
}
})
チェックリストの概要
| カテゴリ | 重大 | 高 | 中 | 低 |
|---|---|---|---|---|
| IPC | 2 | 3 | 2 | 1 |
| セキュリティ | 4 | 3 | 2 | 1 |
| パフォーマンス | 1 | 3 | 3 | 2 |
コメント
Markdown 対応