.agents/skills/agent-browser-electron/SKILL.md
Inspect Electron renderer windows reliably when agent-browser alone is not enough to tell which CDP target maps to which BrowserWindow.
Prefer raw CDP target discovery over guessing from tab list, then connect agent-browser directly to the exact renderer target you want.
Use raw CDP target discovery because agent-browser is operating as a convenience layer on top of Chrome DevTools Protocol, and that layer can hide or flatten details that matter in Electron.
Raw /json/list is the source of truth for target discovery because it exposes the browser's own target inventory without extra interpretation. In Electron, that matters because:
BrowserWindow instances can share the same URLagent-browser tab list may show only a subset of targets or present them with reduced metadataagent-browser can keep you attached to a previous renderer unless you reset and verifyIn practice, the higher-level tab list view is useful for quick browsing, but not reliable enough for window-to-target mapping when:
http://localhost:5173/#/Use curl http://127.0.0.1:<port>/json/list first whenever correct target selection matters. Treat agent-browser as the interaction client after target discovery, not as the discovery source.
If the app uses lazy window creation, agent-browser cannot inspect a window that has not been created yet. Open it from the app UI or trigger its Electron-side open handler first.
agent-browser --cdp <port> tab list.curl -sS http://127.0.0.1:<port>/json/list
Read these fields:
titleurltypewebSocketDebuggerUrlUse /json/version if you need the browser-level debugger URL:
curl -sS http://127.0.0.1:<port>/json/version
Common patterns:
http://localhost:5173/#/chat while the main window is http://localhost:5173/#/.http://localhost:5173/#/; in that case use screenshots, snapshots, and Electron app knowledge to disambiguate.agent-browser session state before switching targets.agent-browser close --all
agent-browser connect <webSocketDebuggerUrl>
agent-browser get url
agent-browser get title
agent-browser snapshot -i
If needed:
agent-browser screenshot /tmp/electron-target.png --annotate
agent-browser console
agent-browser errors
Use this order when the Electron app has multiple windows:
curl /json/listworker targets unless the task is specifically about workersDevTools page targets unless debugging DevTools itselfagent-browser close --allagent-browser connect <webSocketDebuggerUrl>agent-browser get urlagent-browser snapshot -iIn apps/stage-tamagotchi, the chat window is lazy-created and loaded with /#/chat. The main window loads /#/.
Relevant files:
apps/stage-tamagotchi/src/main/windows/chat/index.tsapps/stage-tamagotchi/src/main/windows/main/index.tsapps/stage-tamagotchi/src/main/libs/electron/window-manager/reusable.tsapps/stage-tamagotchi/src/renderer/components/stage-islands/controls-island/index.vueThat means:
chatWindow()http://localhost:5173/#/chatagent-browser to that target's webSocketDebuggerUrlExample:
curl -sS http://127.0.0.1:9250/json/list
agent-browser close --all
agent-browser connect ws://127.0.0.1:9250/devtools/page/<chat-target-id>
agent-browser get url
agent-browser snapshot -i
Expected verification for chat:
agent-browser get url returns http://localhost:5173/#/chattab list omits or flattens the target you need: use raw /json/list.connect appears to succeed but later commands still point at the old renderer: run agent-browser close --all, then reconnect and verify with get url.eval returns {} for object values: prefer get url, get title, snapshot -i, or primitive-only eval return values.