跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 chrome-devtools-cli

Chrome Devtools Cli

使用此技能来写入 shell 脚本或运行 shell 命令来将浏览器中的任务自动化,或者通过 CLI 使用 Chrome DevTools.

3381 安装量

官方网址:skills.sh

技能介绍

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

做什么

使用此技能来写入 shell 脚本或运行 shell 命令来将浏览器中的任务自动化,或者通过 CLI 使用 Chrome DevTools.

何时用

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

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Setup、AI Workflow、Permissions & File Access、Command Usage、Input Automation (<uid> from snapshot)、Navigation。 其中含规范建议的小节:分步指令。

文件分析

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

官方 description(原文)

Use this skill to write shell scripts or run shell commands to automate tasks in the browser or otherwise use Chrome DevTools via CLI.

SetupAI WorkflowPermissions & File AccessCommand UsageInput Automation (<uid> from snapshot)NavigationEmulationPerformanceMemoryMemory Debugging (requires `--memoryDebugging=true`)NetworkDebugging & Inspection

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
chrome-devtools-cli
description
Use this skill to write shell scripts or run shell commands to automate tasks in the browser or otherwise use Chrome DevTools via CLI.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 1
  • references/installation.md

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

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

安装这个技能

Skills CLI ↗

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

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

交给 Agent 安装

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

把 Agent Skill「chrome-devtools-cli」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-858233f3b0b95cff-Chrome-Devtools-Cli-%E8%8B%B1%E8%AF%AD.html
请存为 .cursor/skills/chrome-devtools-cli/SKILL.md 或 .claude/skills/chrome-devtools-cli/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/chromedevtools/chrome-devtools-mcp 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

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

npx skills add 'https://github.com/chromedevtools/chrome-devtools-mcp' --list

npx skills add 'https://github.com/chromedevtools/chrome-devtools-mcp' --skill 'chrome-devtools-cli'

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

阅读排版
--- name: chrome-devtools-cli description: Use this skill to write shell scripts or run shell commands to automate tasks in the browser or otherwise use Chrome DevTools via CLI. --- The `chrome-devtools-mcp` CLI lets you interact with the browser from your terminal. ## Setup _Note: If this is your very first time using the CLI, see [references/installation.md](references/installation.md) for setup. Installation is a one-time prerequisite and is **not** part of the regular AI workflow._ ## AI Workflow 1. **Execute**: Run tools directly. If you don't know the target page's ID, run `chrome-devtools list_pages` to find it. The background server starts implicitly; **do not** run `start`/`status`/`stop` before each use. 2. **Inspect**: Use `chrome-devtools take_snapshot ` to get an element ``. 3. **Act**: Use `chrome-devtools click `, `chrome-devtools fill `, etc. State persists across commands. Snapshot example: ``` uid=1_0 RootWebArea "Example Domain" url="https://example.com/" uid=1_1 heading "Example Domain" level="1" ``` ## Permissions & File Access By default, the CLI has full filesystem access (`--allowUnrestrictedPaths=true`), allowing file-saving parameters (`--filePath`, `--outputDirPath`) and `upload_file` to access files anywhere on the system. Pass `--allowUnrestrictedPaths=false` if you want to restrict file access to the OS temp directory. ## Command Usage ```sh chrome-devtools [arguments] [flags] ``` - Required arguments are passed positionally; optional arguments use flags. - Use `--help` on any command for usage details. - Output defaults to plain Markdown-like text; pass `--output-format=json` for JSON. ## Input Automation ( from snapshot) ```bash chrome-devtools take_snapshot 1 # Take a text snapshot of the page to get UIDs for elements chrome-devtools click 1 "id" # Clicks on the provided element chrome-devtools click 1 "id" --dblClick true --includeSnapshot true # Double clicks and returns a snapshot chrome-devtools drag 1 "src" "dst" # Drag an element onto another element chrome-devtools drag 1 "src" "dst" --includeSnapshot true # Drag an element and return a snapshot chrome-devtools fill 1 "id" "text" # Type text into an input, textarea, or select an option chrome-devtools fill 1 "id" "text" --includeSnapshot true # Fill an element and return a snapshot chrome-devtools handle_dialog 1 accept # Handle a browser dialog (accept/dismiss) chrome-devtools handle_dialog 1 dismiss --promptText "hi" # Dismiss a dialog with prompt text chrome-devtools hover 1 "id" # Hover over the provided element chrome-devtools hover 1 "id" --includeSnapshot true # Hover over an element and return a snapshot chrome-devtools press_key 1 "Enter" # Press a key or key combination ("Control+A", "Escape") chrome-devtools press_key 1 "Control+A" --includeSnapshot true # Press a key and return a snapshot chrome-devtools type_text 1 "hello" # Type text using keyboard into a focused input chrome-devtools type_text 1 "hello" --submitKey "Enter" # Type text and press a submit key chrome-devtools upload_file 1 "id" "file.txt" # Upload a file through a provided element chrome-devtools upload_file 1 "id" "file.txt" --includeSnapshot true # Upload a file and return a snapshot ``` ## Navigation ```bash chrome-devtools close_page 1 # Closes the page by its index chrome-devtools list_pages # Get a list of pages open in the browser chrome-devtools navigate_page 1 --url "https://example.com" # Navigates the currently selected page to a URL chrome-devtools navigate_page 1 --type "reload" --ignoreCache true # Reload page ignoring cache chrome-devtools navigate_page 1 --url "https://example.com" --timeout 5000 # Navigate with a timeout chrome-devtools navigate_page 1 --handleBeforeUnload "accept" # Handle before unload dialog chrome-devtools navigate_page 1 --type "back" --initScript "foo()" # Navigate back and run an init script chrome-devtools new_page "https://example.com" # Creates a new page chrome-devtools new_page "https://example.com" --background true --timeout 5000 # Create new page in background chrome-devtools new_page "https://example.com" --isolatedContext "ctx" # Create new page with isolated context chrome-devtools select_page 1 # Select a page as a context for future tool calls chrome-devtools select_page 1 --bringToFront true # Select a page and bring it to front ``` ## Emulation ```bash chrome-devtools emulate 1 --networkConditions "Offline" # Emulate network conditions chrome-devtools emulate 1 --cpuThrottlingRate 4 --geolocation "0x0" # Emulate CPU throttling and geolocation chrome-devtools emulate 1 --colorScheme "dark" --viewport "1920x1080" # Emulate color scheme and viewport chrome-devtools emulate 1 --userAgent "Mozilla/5.0..." # Emulate user agent chrome-devtools resize_page 1 1920 1080 # Resizes the selected page's window ``` ## Performance ```bash chrome-devtools performance_analyze_insight 1 "1" "LCPBreakdown" # Get more details on a specific Performance Insight (pageId, insightSetId, insightName) chrome-devtools performance_start_trace 1 --reload true --autoStop false # Starts a performance trace recording (reload, autoStop) chrome-devtools performance_start_trace 1 --reload true --autoStop true --filePath "t.json.gz" # Start trace and save to a file chrome-devtools performance_stop_trace 1 # Stops the active performance trace chrome-devtools performance_stop_trace 1 --filePath "t.json.gz" # Stop trace and save to a file ``` ## Memory ```bash chrome-devtools take_heapsnapshot 1 "./snap.heapsnapshot" # Capture a memory heap snapshot ``` ### Memory Debugging (requires `--memoryDebugging=true`) ```bash chrome-devtools get_heapsnapshot_summary "./snap.heapsnapshot" # Get snapshot summary stats chrome-devtools compare_heapsnapshots "./base.heapsnapshot" "./target.heapsnapshot" # Compare two snapshots chrome-devtools get_heapsnapshot_class_nodes "./snap.heapsnapshot" "Array" # Inspect class instances chrome-devtools get_heapsnapshot_details "./snap.heapsnapshot" 123 # Detailed object properties chrome-devtools get_heapsnapshot_dominators "./snap.heapsnapshot" 123 # Dominator tree for node chrome-devtools get_heapsnapshot_duplicate_strings "./snap.heapsnapshot" # Find duplicated strings chrome-devtools get_heapsnapshot_edges "./snap.heapsnapshot" 123 # Node edges/references chrome-devtools get_heapsnapshot_object_details "./snap.heapsnapshot" 123 # Object details by node ID chrome-devtools get_heapsnapshot_retainers "./snap.heapsnapshot" 123 # Retaining objects chrome-devtools get_heapsnapshot_retaining_paths "./snap.heapsnapshot" 123 # Shortest retaining paths chrome-devtools close_heapsnapshot "./snap.heapsnapshot" # Free memory from loaded snapshot ``` ## Network ```bash chrome-devtools get_network_request 1 # Get the currently selected network request for page 1 chrome-devtools get_network_request 1 --reqid 1 --requestFilePath "req.md" # Get request by id and save to file chrome-devtools get_network_request 1 --responseFilePath "res.md" # Save response body to file chrome-devtools list_network_requests 1 # List all network requests for page 1 chrome-devtools list_network_requests 1 --pageSize 50 --pageIdx 0 # List network requests with pagination chrome-devtools list_network_requests 1 --resourceTypes Fetch # Filter requests by resource type chrome-devtools list_network_requests 1 --includePreservedRequests true # Include preserved requests ``` ## Debugging & Inspection ```bash chrome-devtools evaluate_script "() => document.title" --pageId 1 # Evaluate a JavaScript function on page 1 chrome-devtools evaluate_script "(a) => a.innerText" --pageId 1 --args 1_4 # Evaluate JS with UID arguments on page 1 chrome-devtools get_console_message 1 1 # Gets a console message by its ID chrome-devtools get_css_styles 1 "1_4" # Retrieves resolved CSS styles (inline, matched, inherited, pseudo) for an element on page 1 chrome-devtools get_css_styles 1 "1_4" --pageSize 20 --pageIdx 0 # Get CSS styles with pagination on page 1 chrome-devtools lighthouse_audit 1 --mode "navigation" # Run Lighthouse audit for navigation chrome-devtools lighthouse_audit 1 --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobile chrome-devtools lighthouse_audit 1 --outputDirPath ./out # Run Lighthouse audit and save reports chrome-devtools list_console_messages 1 # List all console messages chrome-devtools list_console_messages 1 --pageSize 20 --pageIdx 1 # List console messages with pagination chrome-devtools list_console_messages 1 --types error --types info # Filter console messages by type chrome-devtools list_console_messages 1 --includePreservedMessages true # Include preserved messages chrome-devtools take_screenshot 1 # Take a screenshot of the page viewport chrome-devtools take_screenshot 1 --fullPage true --format "jpeg" --quality 80 # Take a full page screenshot as JPEG with quality chrome-devtools take_screenshot 1 --uid "id" --filePath "s.png" # Take a screenshot of an element chrome-devtools take_snapshot 1 # Take a text snapshot of the page from the a11y tree chrome-devtools take_snapshot 1 --verbose true --filePath "s.txt" # Take a verbose snapshot and save to file ``` ## Extensions ```bash chrome-devtools list_extensions # Lists all the Chrome extensions installed in the browser chrome-devtools install_extension "/path/to/extension" # Installs a Chrome extension from the given path chrome-devtools uninstall_extension "extension_id" # Uninstalls a Chrome extension by its ID chrome-devtools reload_extension "extension_id" # Reloads an unpacked Chrome extension by its ID chrome-devtools trigger_extension_action "extension_id" # Triggers the default action of an extension by its ID ``` ## Progressive Web Apps (requires `--categoryPwa=true`) ```bash chrome-devtools install_pwa "https://example.com/" # Install PWA by manifest ID or URL chrome-devtools launch_pwa "https://example.com/" # Launch installed PWA chrome-devtools get_os_app_state "https://example.com/" # Get OS app installation state chrome-devtools uninstall_pwa "https://example.com/" # Uninstall PWA and close windows ``` ## Experimental Features Experimental tools are disabled by default. Enable them with the corresponding flag during `start`. ```bash chrome-devtools click_at 1 100 200 # Clicks at the provided coordinates on page 1 (requires --experimentalVision=true) chrome-devtools screencast_start 1 --filePath "screen.mp4" # Starts a screencast recording on page 1 (requires --experimentalScreencast=true and ffmpeg) chrome-devtools screencast_stop 1 # Stops the active screencast on page 1 chrome-devtools list_webmcp_tools 1 # List all WebMCP tools on page 1 (requires --categoryExperimentalWebmcp=true) chrome-devtools execute_webmcp_tool 1 "tool_name" --input '{"arg":"val"}' # Execute a WebMCP tool on page 1 (requires --categoryExperimentalWebmcp=true) chrome-devtools list_3p_developer_tools 1 # List third-party developer tools on page 1 (requires --categoryExperimentalThirdParty=true) chrome-devtools execute_3p_developer_tool 1 "tool_name" --params '{"arg":"val"}' # Execute third-party developer tool on page 1 (requires --categoryExperimentalThirdParty=true) ``` ## Service Management ```bash chrome-devtools start # Start or restart chrome-devtools-mcp chrome-devtools start --headless=false # Start with visible browser window chrome-devtools status # Checks if chrome-devtools-mcp is running chrome-devtools stop # Stop chrome-devtools-mcp if any ```

相关技能

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)完成一个功…