Skip to main content
Agent skill

Desktop

Electron desktop development guide — IPC handlers, controllers, preload scripts, window/menu management.

All install options
Quick install · Personal (~/.claude/skills)Project / Cursor / Desktop →
mkdir -p ~/.claude/skills/desktop && curl -fsSL 'https://raw.githubusercontent.com/lobehub/lobehub/canary/.agents/skills/desktop/SKILL.md' -o ~/.claude/skills/desktop/SKILL.md

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use Desktop when an AI agent needs a reusable SKILL.md workflow for this job: Electron desktop development guide — IPC handlers, controllers, preload scripts, window/menu management.

When not to use it

Skip Desktop when the task is outside the coding category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
One-line install (Claude Code)
mkdir -p ~/.claude/skills/desktop && curl -fsSL 'https://raw.githubusercontent.com/lobehub/lobehub/canary/.agents/skills/desktop/SKILL.md' -o ~/.claude/skills/desktop/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/desktop/SKILL.md. For a shared project, commit the folder at .claude/skills/desktop/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the Desktop skill for this task: Use Desktop when this documented workflow matches the task. Confirm any required inputs or files before making changes.

What supports this recommendation?

68/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
70/100
Practical detail
68/100
Source evidence
63/100
Source signals
70/100
Model compatibility evidence
  • claudeuntested

    No model-specific signal or recorded compatibility test was found.

  • chatgptuntested

    No model-specific signal or recorded compatibility test was found.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# Desktop Development Guide

## Architecture Overview

LobeHub desktop is built on Electron with main-renderer architecture:

1. **Main Process** (`apps/desktop/src/main`): App lifecycle, system APIs, window management 2. **Renderer Process**: Reuses web code from `src/` 3. **Preload Scripts** (`apps/desktop/src/preload`): Securely expose main process to renderer

Both processes log to `<userData>/logs/{main,renderer}.jsonl` in dev and packaged builds (`apps/desktop/src/main/utils/structuredLog/`); read them with `pnpm --dir apps/desktop logs list|query|follow` (filters: `--level`, `--since`, `--operation op_…`, `--topic tpc_…`) instead of `tail`ing files.

## Adding New Desktop Features

### 1. Create Controller

Location: `apps/desktop/src/main/controllers/`

```typescript import { ControllerModule, IpcMethod } from '@/controllers';

export default class NewFeatureCtr extends ControllerModule { static override readonly groupName = 'newFeature';

@IpcMethod() async doSomething(params: SomeParams): Promise<SomeResult> { // Implementation return { success: true }; } } ```

Register in `apps/desktop/src/main/controllers/registry.ts`.

### 2. Define IPC Types

Location: `packages/electron-client-ipc/src/types/<domain>.ts`, re-exported from `types/index.ts`

```typescript export interface SomeParams { /* ... */ } export interface SomeResult { success: boolean; error?: string; } ```

### 3. Create Renderer Service

Location: `src/services/electron/`

```typescript import { ensureElectronIpc } from '@/utils/electron/ipc';

const ipc = ensureElectronIpc();

export const newFeatureService = async (params: SomeParams) => { return ipc.newFeature.doSomething(params); }; ```

### 4. Implement Store Action

Location: `src/store/`

### 5. Add Tests

Location: beside the controller, `apps/desktop/src/main/controllers/<Name>Ctr.test.ts` (`source-layout` §2)

## Detailed Guides

See `references/` for specific topics:

- **Feature implementation**: `references/feature-implementation.md` - **Local tools workflow**: `references/local-tools.md` - **Menu configuration**: `references/menu-config.md` - **Window management**: `references/window-management.md`

Intended uses

  • Use Desktop when this documented workflow matches the task.

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.