{"data":{"slug":"github-lobehub-lobehub-agents-skills-desktop-959257c80f46","title":"Implement Desktop Features with Electron","summary":"Add new features to an Electron desktop application by creating controllers, defining IPC types, and implementing renderer services. The process includes logging, testing, and referencing detailed guides for specific tasks.","url":"https:\/\/skillshunter.net\/skills\/github-lobehub-lobehub-agents-skills-desktop-959257c80f46","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-lobehub-lobehub-agents-skills-desktop-959257c80f46","markdown_url":"https:\/\/skillshunter.net\/skills\/github-lobehub-lobehub-agents-skills-desktop-959257c80f46.md","download_url":"https:\/\/skillshunter.net\/skills\/github-lobehub-lobehub-agents-skills-desktop-959257c80f46\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the Electron environment is set up with TypeScript support. Create a controller in `apps\/desktop\/src\/main\/controllers\/`, define IPC types in `packages\/electron-client-ipc\/src\/types\/`, and implement a renderer service in `src\/services\/electron\/`. The first deliverable is a registered controller with an IPC method.","instructions":"---\nname: desktop\ndescription: Electron desktop development guide \u2014 IPC handlers, controllers, preload scripts, window\/menu management.\ndisable-model-invocation: true\n---\n\n# Desktop Development Guide\n\n## Architecture Overview\n\nLobeHub desktop is built on Electron with main-renderer architecture:\n\n1. **Main Process** (`apps\/desktop\/src\/main`): App lifecycle, system APIs, window management\n2. **Renderer Process**: Reuses web code from `src\/`\n3. **Preload Scripts** (`apps\/desktop\/src\/preload`): Securely expose main process to renderer\n\nBoth processes log to `<userData>\/logs\/{main,renderer}.jsonl` in dev and packaged\nbuilds (`apps\/desktop\/src\/main\/utils\/structuredLog\/`); read them with\n`pnpm --dir apps\/desktop logs list|query|follow` (filters: `--level`, `--since`,\n`--operation op_\u2026`, `--topic tpc_\u2026`) instead of `tail`ing files.\n\n## Adding New Desktop Features\n\n### 1. Create Controller\n\nLocation: `apps\/desktop\/src\/main\/controllers\/`\n\n```typescript\nimport { ControllerModule, IpcMethod } from '@\/controllers';\n\nexport default class NewFeatureCtr extends ControllerModule {\n  static override readonly groupName = 'newFeature';\n\n  @IpcMethod()\n  async doSomething(params: SomeParams): Promise<SomeResult> {\n    \/\/ Implementation\n    return { success: true };\n  }\n}\n```\n\nRegister in `apps\/desktop\/src\/main\/controllers\/registry.ts`.\n\n### 2. Define IPC Types\n\nLocation: `packages\/electron-client-ipc\/src\/types\/<domain>.ts`, re-exported from `types\/index.ts`\n\n```typescript\nexport interface SomeParams {\n  \/* ... *\/\n}\nexport interface SomeResult {\n  success: boolean;\n  error?: string;\n}\n```\n\n### 3. Create Renderer Service\n\nLocation: `src\/services\/electron\/`\n\n```typescript\nimport { ensureElectronIpc } from '@\/utils\/electron\/ipc';\n\nconst ipc = ensureElectronIpc();\n\nexport const newFeatureService = async (params: SomeParams) => {\n  return ipc.newFeature.doSomething(params);\n};\n```\n\n### 4. Implement Store Action\n\nLocation: `src\/store\/`\n\n### 5. Add Tests\n\nLocation: beside the controller, `apps\/desktop\/src\/main\/controllers\/<Name>Ctr.test.ts` (`source-layout` \u00a72)\n\n## Detailed Guides\n\nSee `references\/` for specific topics:\n\n- **Feature implementation**: `references\/feature-implementation.md`\n- **Local tools workflow**: `references\/local-tools.md`\n- **Menu configuration**: `references\/menu-config.md`\n- **Window management**: `references\/window-management.md`\n","use_cases":["Adding a new feature to the Electron desktop application","Creating an IPC handler for communication between main and renderer processes","Implementing a renderer service for Electron desktop functionality"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/lobehub\/lobehub\/blob\/54382b5c8e81544da454fa6d7b50f461a562c1ee\/.agents\/skills\/desktop\/SKILL.md","source_commit":"54382b5c8e81544da454fa6d7b50f461a562c1ee","license":null,"version":null,"listing_approved_at":"2026-11-22","created_at":"2026-11-21T11:11:18.000000Z","updated_at":"2026-11-22T11:17:05.000000Z","seo_title":"Implement Desktop Features with Electron","seo_description":"Learn how to add new features to the Electron desktop application by creating controllers, defining IPC types, and implementing renderer services with step-by-step guides","seo_keywords":["Electron desktop development","IPC communication in Electron","Adding features to Electron desktop app","Electron controller implementation","Renderer service in Electron"]}}