跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 chrome-cdp-live-browser

Chrome Cdp Live Browser

AI代理通过 CDP 访问您的 Chrome 直播会话 — 与打开标签、登录账户和当前页面状态交互

1522 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

AI代理通过 CDP 访问您的 Chrome 直播会话 — 与打开标签、登录账户和当前页面状态交互

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:chrome-cdp: Live Chrome Session for AI Agents、What It Does、Installation、As a pi skill、Manual (for Amp, Claude Code, Cursor, Codex, etc.)、Copy the skills/chrome-cdp/ directory to wherever your agent loads context from。

文件分析

文件分析:除 SKILL.md 外,正文引用了 scripts/cdp.mjs,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Give AI agents access to your live Chrome session via CDP — interact with open tabs, logged-in accounts, and current page state

chrome-cdp: Live Chrome Session for AI AgentsWhat It DoesInstallationAs a pi skillManual (for Amp, Claude Code, Cursor, Codex, etc.)Copy the skills/chrome-cdp/ directory to wherever your agent loads context fromEnable Remote Debugging in ChromeKey CommandsList Open TabsOutput:A1B2C3 https://github.com/pasky/chrome-cdp-skill chrome-cdp-skillD4E5F6 https://mail.google.com/mail/u/0/ Gmail

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
chrome-cdp-live-browser
description
Give AI agents access to your live Chrome session via CDP — interact with open tabs, logged-in accounts, and current page state
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 1
  • scripts/cdp.mjs

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「chrome-cdp-live-browser」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-2512087e793e543c-Chrome-Cdp-%E6%B4%BB%E6%B5%8F%E8%A7%88%E5%99%A8.html
请存为 .cursor/skills/chrome-cdp-live-browser/SKILL.md 或 .claude/skills/chrome-cdp-live-browser/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/reason-machines/trending-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/reason-machines/trending-skills' --list

npx skills add 'https://github.com/reason-machines/trending-skills' --skill 'chrome-cdp-live-browser'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: chrome-cdp-live-browser description: Give AI agents access to your live Chrome session via CDP — interact with open tabs, logged-in accounts, and current page state triggers: - "control my chrome browser" - "interact with open chrome tabs" - "automate my live browser session" - "take a screenshot of a webpage" - "click elements on a webpage" - "read content from a browser tab" - "navigate to a URL in chrome" - "use chrome devtools protocol" --- # chrome-cdp: Live Chrome Session for AI Agents > Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection. `chrome-cdp` connects your AI agent directly to your running Chrome browser via the Chrome DevTools Protocol (CDP). Unlike browser automation tools that spin up fresh isolated browsers, this connects to tabs you already have open — with your logins, cookies, and current page state intact. ## What It Does - **Live session access** — reads and interacts with tabs you're already logged into - **Persistent daemon** — one WebSocket daemon per tab; the "Allow debugging" modal appears once, not on every command - **No npm install** — only Node.js 22+ required - **100+ tab support** — handles large numbers of open tabs reliably - **Cross-origin iframe support** — `type` command works even inside cross-origin iframes ## Installation ### As a pi skill ```bash pi install git:github.com/pasky/[email protected] ``` ### Manual (for Amp, Claude Code, Cursor, Codex, etc.) ```bash git clone https://github.com/pasky/chrome-cdp-skill # Copy the skills/chrome-cdp/ directory to wherever your agent loads context from ``` ### Enable Remote Debugging in Chrome 1. Open Chrome and navigate to: `chrome://inspect/#remote-debugging` 2. Toggle the **"Enable remote debugging"** switch That's all. No flags, no relaunching Chrome. The script auto-detects Chrome, Chromium, Brave, Edge, and Vivaldi on macOS, Linux, and Windows. For non-standard installs: ```bash export CDP_PORT_FILE=/path/to/DevToolsActivePort ``` ## Key Commands All commands use `scripts/cdp.mjs` as the entry point. `` is a unique prefix of the targetId shown by `list`. ### List Open Tabs ```bash node scripts/cdp.mjs list # Output: # A1B2C3 https://github.com/pasky/chrome-cdp-skill chrome-cdp-skill # D4E5F6 https://mail.google.com/mail/u/0/ Gmail ``` ### Screenshot a Tab ```bash node scripts/cdp.mjs shot A1B2 # Saves screenshot to runtime dir, prints the file path ``` ### Accessibility Tree (Semantic Snapshot) ```bash node scripts/cdp.mjs snap A1B2 # Returns compact, semantic accessibility tree — best for understanding page structure ``` ### Full HTML or Scoped HTML ```bash node scripts/cdp.mjs html A1B2 # full page HTML node scripts/cdp.mjs html A1B2 ".main-content" # scoped to CSS selector node scripts/cdp.mjs html A1B2 "#article-body" # scoped to ID ``` ### Evaluate JavaScript ```bash node scripts/cdp.mjs eval A1B2 "document.title" node scripts/cdp.mjs eval A1B2 "window.location.href" node scripts/cdp.mjs eval A1B2 "document.querySelectorAll('a').length" ``` ### Navigate to URL ```bash node scripts/cdp.mjs nav A1B2 https://example.com # Navigates and waits for page load ``` ### Network Resource Timing ```bash node scripts/cdp.mjs net A1B2 # Shows network resource timing for the current page ``` ### Click an Element ```bash node scripts/cdp.mjs click A1B2 "button.submit" node scripts/cdp.mjs click A1B2 "#login-btn" node scripts/cdp.mjs click A1B2 "[data-testid='confirm']" ``` ### Click at Coordinates ```bash node scripts/cdp.mjs clickxy A1B2 320 480 # Clicks at CSS pixel coordinates (x=320, y=480) ``` ### Type Text ```bash node scripts/cdp.mjs type A1B2 "Hello, world!" # Types at the currently focused element — works in cross-origin iframes ``` ### Load More (Click Until Gone) ```bash node scripts/cdp.mjs loadall A1B2 "button.load-more" # Keeps clicking the selector until it disappears from the DOM ``` ### Open a New Tab ```bash node scripts/cdp.mjs open node scripts/cdp.mjs open https://example.com # Note: triggers Chrome's "Allow" prompt ``` ### Stop Daemons ```bash node scripts/cdp.mjs stop # stop all daemons node scripts/cdp.mjs stop A1B2 # stop daemon for specific tab ``` ### Raw CDP Command Passthrough ```bash node scripts/cdp.mjs evalraw A1B2 "Page.getFrameTree" node scripts/cdp.mjs evalraw A1B2 "Runtime.evaluate" '{"expression":"1+1"}' ``` ## Common Patterns ### Pattern: Read a Page You're Logged Into ```bash # List tabs to find your target node scripts/cdp.mjs list # Grab the accessibility tree for a semantic view node scripts/cdp.mjs snap D4E5 # Or get scoped HTML for a specific section node scripts/cdp.mjs html D4E5 ".email-list" ``` ### Pattern: Fill and Submit a Form ```bash # Click the input field node scripts/cdp.mjs click A1B2 "input[name='search']" # Type into it node scripts/cdp.mjs type A1B2 "my search query" # Click submit node scripts/cdp.mjs click A1B2 "button[type='submit']" # Take a screenshot to verify result node scripts/cdp.mjs shot A1B2 ``` ### Pattern: Extract Data with JavaScript ```bash # Get all link hrefs on a page node scripts/cdp.mjs eval A1B2 "Array.from(document.querySelectorAll('a')).map(a => a.href)" # Get text content of a specific element node scripts/cdp.mjs eval A1B2 "document.querySelector('.price').textContent.trim()" # Get table data as JSON node scripts/cdp.mjs eval A1B2 " Array.from(document.querySelectorAll('table tr')).map(row => Array.from(row.querySelectorAll('td,th')).map(cell => cell.textContent.trim()) ) " ``` ### Pattern: Navigate and Wait ```bash # Navigate and then immediately read the page node scripts/cdp.mjs nav A1B2 https://news.ycombinator.com node scripts/cdp.mjs snap A1B2 ``` ### Pattern: Paginated Content ```bash # Keep loading content until "Load More" button disappears node scripts/cdp.mjs loadall A1B2 "button[data-action='load-more']" # Then extract all loaded content node scripts/cdp.mjs eval A1B2 "document.querySelectorAll('.item').length" ``` ### Pattern: Script Integration (Node.js) ```javascript import { execFile } from 'node:child_process'; import { promisify } from 'node:util'; const exec = promisify(execFile); const CDP = (...args) => exec('node', ['scripts/cdp.mjs', ...args]); async function getPageTitle(tabPrefix) { const { stdout } = await CDP('eval', tabPrefix, 'document.title'); return stdout.trim(); } async function takeScreenshot(tabPrefix) { const { stdout } = await CDP('shot', tabPrefix); return stdout.trim(); // returns file path } async function navigateAndSnap(tabPrefix, url) { await CDP('nav', tabPrefix, url); const { stdout } = await CDP('snap', tabPrefix); return stdout; } // Usage const tabs = (await CDP('list')).stdout; console.log(tabs); ``` ## Configuration | Environment Variable | Purpose | |----------------------|---------| | `CDP_PORT_FILE` | Path to `DevToolsActivePort` file for non-standard browser installs | Daemons auto-exit after **20 minutes of inactivity** — no manual cleanup needed in normal use. ## Troubleshooting ### "Allow debugging" modal keeps appearing This happens if daemons aren't persisting. Make sure you're using the same `scripts/cdp.mjs` entry point — it manages daemon lifecycle automatically. If you switched tools mid-session, run `stop` and let daemons restart fresh. ### Browser not detected If auto-detection fails, find your `DevToolsActivePort` file and set the env var: ```bash # macOS Chrome example export CDP_PORT_FILE="$HOME/Library/Application Support/Google/Chrome/Default/DevToolsActivePort" # Linux Chrome example export CDP_PORT_FILE="$HOME/.config/google-chrome/Default/DevToolsActivePort" ``` ### Target not found / prefix ambiguous Run `list` again — tab IDs change when tabs are closed/reopened. Use a longer prefix if multiple tabs share the same prefix characters. ### Remote debugging toggle not visible Ensure you're on `chrome://inspect/#remote-debugging` (not just `chrome://inspect/`). The toggle is in the top-right of the page. ### Node.js version error This project requires **Node.js 22+**. Check with `node --version` and upgrade if needed via [nvm](https://github.com/nvm-sh/nvm) or your package manager. ### Screenshots are blank or wrong size The screenshot reflects the actual rendered viewport. If the tab is in a background window or the OS has display scaling, pixel coordinates for `clickxy` may need adjustment. Use `snap` or `eval` to inspect DOM state instead of relying solely on screenshots. ## Architecture Notes - No Puppeteer, no Playwright, no intermediary — pure CDP WebSocket - One persistent daemon process per tab (auto-spawned on first access) - Daemon reuse is why 100+ tabs work reliably (no timeout on target enumeration) - `type` uses CDP Input domain directly, bypassing iframe origin restrictions

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…