Skip to content

@crossplatformai/skills

Reusable Agent Skills for CrossPlatform.ai projects.

desktop-electron-dev-attach

49 linesSource

Interactively attach to an already-running Electron app through stable DESKTOP_CDP_PORT for local development or requested desktop happy-path verification with Playwright or OpenCode MCP.

Desktop Electron Dev Attach

Use this guidance only for interactive attachment to an already-running desktop app. Load test-layer-fit instead when designing a scripted Electron suite, its application lifecycle, or its cleanup ownership.

Port Contract

  • DESKTOP_DEV_PORT is the renderer dev server port for apps/desktop.
  • DESKTOP_CDP_PORT is the Electron CDP / remote-debugging attach port for Playwright Electron and OpenCode MCP.
  • Keep DESKTOP_CDP_PORT unique across simultaneously running desktop apps to avoid CDP collisions.
  • Concrete port values live in the target repo's .env, .env.example, nearest app AGENTS.md, or repo guidance. Read them from the repo; do not hardcode shared values in this skill.
  • If a repo has a configured OpenCode Playwright Electron MCP endpoint, it must point at the same http://localhost:<DESKTOP_CDP_PORT> used by that repo's desktop app.

Development Attach

  • Start or use the already-running desktop app for the target repo before attaching.
  • Attach Playwright Electron through the app-window CDP target. Select the app window or tab, not DevTools.
  • Configured CDP endpoints can exist even when the matching Electron app is not running; treat a missing target as an app startup or port mismatch problem, not as proof.
  • Do not infer desktop proof from web or mobile evidence.

E2E Separation

  • Stable interactive development attach uses DESKTOP_CDP_PORT.
  • Scripted desktop E2E launches a Playwright-owned Electron application with isolated user data. It does not attach to the stable development CDP target or create a parallel scripted-E2E CDP default.
  • Do not repoint automated E2E scripts to the stable development CDP port.

Repo-Owned Details

Keep these values in the target repo or app guidance, not in this shared skill:

  • concrete DESKTOP_DEV_PORT and DESKTOP_CDP_PORT values
  • app slug and token storage key prefixes
  • desktop routes and expected final screens
  • API origins, auth endpoints, headers, cookies, and storage keys
  • Electron preload, IPC, and storage adapter details
  • OpenCode MCP endpoint names and workspace-specific configuration paths