vercel-labs/agent-browser

modern-web-guidance

读取对应指南,修改前后用同一页面验证规则

  • SKILL.md 已保存
  • 中文用法已整理
  • 安装与运行未实测
先判断是否解决你的问题

modern-web-guidance 是什么?

modern-web-guidance 把Chrome的Modern Web Guidance与真实浏览器验证连接起来:先检索适合任务的指南,记录基线并修改代码,再逐条检查布局偏移、减少动态效果、深浅主题或对话框焦点等实际行为。静态扫描只是发现线索。

中文说明由本站依据来源整理;英文原文保留在页面下方。

按客户端选择安装入口

怎么接入你的 Agent?

  1. 定位完整 Skill 目录

    打开本项目来源,核对 SKILL.md 及其引用的脚本和资料。

  2. 交给你正在用的 Agent

    在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。

  3. 确认识别,再做具体任务

    让 Agent 回报安装目录和识别到的名称 modern-web-guidance,然后按本页使用示例提供材料。

展开并复制给 Codex 的安装指令
发送给 Codex

安装并检查 modern-web-guidance

请在 Codex 的当前工作环境中安装并检查 modern-web-guidance 这个 Skill。

项目身份:vercel-labs/agent-browser / modern-web-guidance
来源:https://github.com/vercel-labs/agent-browser/blob/53384771fbafc261ba67608ac806dd5aa70b84f0/skill-data/modern-web-guidance/SKILL.md
已定位的源文件:skill-data/modern-web-guidance/SKILL.md

1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。
准备输入,再按步骤执行

装好以后,具体怎么用?

准备哪些材料

  • 有目标源码与可启动的开发/预览页;运行指南CLI需要npx和网络,浏览器检查使用agent-browser,录屏需要ffmpeg。

会得到什么

  • 对应源码改动和逐规则浏览器证据,而不是仅静态扫描报告。

实际使用顺序

  1. 用 npx modern-web-guidance@latest search 检索,再retrieve所需ID;输出被保存到临时文件时读取完整文件,不只看路径。
  2. 改现有UI前记录对应基线,按指南实施。legacy-scan只覆盖一部分规则,零发现不代表全部符合。
  3. 对每项改动检查实际页面:CLS用同URL前后vitals;动态效果比较reduced-motion的计算样式和可见动画;主题分别截图;模态框检查焦点、背景inert、Escape与焦点返回。
  4. 报告逐规则的guide ID、实际检查、结果与证据;没有浏览器检查的规则标未验证。结束恢复media设置并关闭会话。
使用示例

从一个具体任务开始

本站根据源文件编写的使用示例,未在本站实际运行。示例中的文件由你提供。

安装并识别 Skill 后发送

复制一个具体任务

教学示例:请用modern-web-guidance检查本地删除确认对话框。先读dialog指南并记录当前焦点行为,再实施必要修正;验证打开时焦点、背景不可操作、Esc关闭与焦点返回,只用模拟删除,不删除数据。
预期结果

预期每条采用规则都有实际浏览器检查;代码看起来符合不等于通过。本站未执行。

使用前先看这些限制

使用条件与边界

  • 单次vitals代表该次加载,不能冒充真实用户群体的长期Core Web Vitals。
  • set media同时影响偏好组合,比较时要明确当前主题和减少动画设置,避免混杂。
针对这个 Skill 的疑问

常见问题

扫描没有问题是否能宣布完成?

不能。该CLI不加载运行页面,且扫描覆盖有限;上游明确要求每项应用规则有浏览器检查证据。

需要核对时再展开原文

来源原文与资料状态

源文件
已保存 SKILL.md,抓取于 2026-11-16T12:36:35.145Z
中文使用说明
已针对下方源文件版本整理用途、用法和常见问题
安装与任务测试
本站未执行安装或任务测试
来源复核
本页中文用法已对照保存版本的完整 SKILL.md 阅读整理
展开 SKILL.md 原文、章节与历史收录资料

skill-data/modern-web-guidance/SKILL.md · 抓取时间 2026-11-16T12:36:35.145Z

以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。

抓取成功不代表已完成安装或任务测试。

来源 description(原文)

Apply Chrome's Modern Web Guidance to frontend code, then verify the built page in a real browser with agent-browser. Use when asked to build or modernize UI with web platform best practices, follow Modern Web Guidance or Baseline guidance, or check that a change fixed layout shift, respects reduced motion or the color scheme, or gives a dialog correct focus and inert behavior. Triggers include "use modern web guidance", "modern web best practices", "fix layout shift", "respect reduced motion", "add dark mode", "build an accessible dialog", and "verify this against the guide".

查看源文件章节 / Source sections
  • 原文:Modern Web Guidance
  • 原文:Get the guidance
  • 工作流程 / Workflow
  • 原文:Layout shift
  • 原文:Reduced motion
  • 原文:Color scheme
  • 原文:Dialog focus and inertness
  • 原文:Report
  • 原文:Cleanup
原文:Modern Web Guidance

[Modern Web Guidance](https://developer.chrome.com/docs/modern-web-guidance) is a set of guides from Chrome that describe how to build common UI with current web platform features, including Baseline compatibility data. Its CLI returns guidance and can statically scan source files for legacy patterns. It does not load or run the page, so it cannot tell you whether the result works. Use Modern Web Guidance to decide what to write and agent-browser to check the built page in Chrome. Finish only after every rule you applied has a browser check with recorded evidence.

原文:Get the guidance

Search for the task, then retrieve the guides that match. You do not need to install anything; `npx` runs the CLI directly. ```bash npx modern-web-guidance@latest search "animate a dialog" # [{"id":"animate-to-from-top-layer","description":"Animate elements such as dialogs, popovers, and tooltips as they're entering/exiting the top layer."}, ...] npx modern-web-guidance@latest retrieve "dialog" npx modern-web-guidance@latest retrieve "dialog,animate-to-from-top-layer" npx modern-web-guidance@latest list ``` `retrieve` accepts one ID or several comma-separated IDs. When the text is larger than 9,500 bytes and standard output is not a file, the CLI saves it to a file in the system temporary directory and prints only its path, for example `Output (12.1 KB, 220 lines) saved to .../mwg-guide-49624-1794420750850.md`. Read that whole file before you write code. To choose the location, redirect the output to a file, which receives the full guide: ```bash npx modern-web-guidance@latest retrieve "dialog" > dialog.md ``` To find existing code that a guide would replace, run the static scan on the source directory. It reads files only: ```bash npx modern-web-guidance@latest legacy-scan ./src --json npx modern-web-guidance@latest legacy-scan ./src --guide dialog ``` The scan has rules for only part of the guidance (33 guides in version 1.0.0), so a result with no findings does not mean the code already follows every guide. Modern Web Guidance also ships its own agent skill (`npx modern-web-guidance@latest install`). Installing it is optional and interactive; this workflow only needs `search` and `retrieve`. Write the code from the guidance instead of pasting guide text into the project. Cite the guide ID in the report so a reviewer can retrieve the same guide.

工作流程 / Workflow

1. **Retrieve.** Search and retrieve the guides for the task. Write down each rule you intend to apply, with its guide ID. 2. **Baseline.** If you are changing existing UI, run the matching browser check below before you edit, so you have a number or snapshot to compare against. 3. **Apply.** Implement the guidance in the project's code. 4. **Verify.** Serve the built page and run the matching check for every rule. A rule without a browser check stays unverified. 5. **Report.** List each rule with its result and evidence, as described in the report section below. Use the project's own dev or preview server. The examples use `http://localhost:3000`; replace it with the page you changed.

原文:Layout shift

Use for guides that reserve space for images, embeds, fonts, or late content (for example `performance`). ```bash agent-browser vitals http://localhost:3000/products # url: http://localhost:3000/products # ttfb: 1.4ms fcp: 56ms lcp: 56ms cls: 0.23 inp: - agent-browser vitals http://localhost:3000/products --json ``` `vitals` navigates to the URL, waits for the load event and then three more seconds for shifts to settle, and reports metrics for that load. Without a URL it reloads the current tab, so client-side state such as an open dialog is lost. In the JSON output, `data.cls.score` is the total and `data.cls.entries` lists each shift with its `startTime` in milliseconds and `value`. Match the largest entry's time to the code that runs then. Pass when `cls` is at most 0.1 (the "good" Core Web Vitals threshold) and lower than the baseline. `cls: 0` with an empty `entries` array means the load recorded no shifts. Run the check against the same URL before and after the change.

原文:Reduced motion

Use for guides that animate UI and respect `prefers-reduced-motion` (for example `motion`, `animate-to-from-top-layer`, `spinner`). ```bash agent-browser open http://localhost:3000/account agent-browser set media reduced-motion agent-browser eval "matchMedia('(prefers-reduced-motion: reduce)').matches" # true agent-browser eval "getComputedStyle(document.querySelector('dialog')).transitionDuration" # "0.1s" agent-browser set media agent-browser eval "getComputedStyle(document.querySelector('dialog')).transitionDuration" # "0.3s" ``` `set media` with no arguments sets both the color scheme and reduced motion back to `no-preference`. Read the same computed property under each preference; replace the selector and property with the element and the CSS the guide changes (`transitionDuration`, `animationName`, `transform`). Pass when the value under reduced motion matches what the guide prescribes. The `animate-to-from-top-layer` guide's CSS keeps a short fade under reduced motion and drops only the scale, so the duration goes from `0.3s` to `0.1s` rather than to `0s`. Identical values under both preferences mean the stylesheet ignores the preference. Computed styles do not show what the user sees during the transition. Record the interaction under each preference so a person can compare them. Recording requires ffmpeg on `PATH`. ```bash agent-browser set media reduced-motion agent-browser record start ./dialog-reduced.webm --fps 60 agent-browser click "#delete-account" agent-browser wait 500 agent-browser record stop agent-browser press Escape agent-browser set media agent-browser record start ./dialog-default.webm --fps 60 agent-browser click "#delete-account" agent-browser wait 500 agent-browser record stop ``` Make the `wait` longer than the transition so the recording captures all of it. At 60 fps, a 300ms transition spans about 18 frames.

原文:Color scheme

Use for guides that support light and dark themes (for example `dark-mode`, `color`). ```bash agent-browser open http://localhost:3000/account agent-browser set media dark agent-browser eval "matchMedia('(prefers-color-scheme: dark)').matches" # true agent-browser eval "getComputedStyle(document.body).backgroundColor" agent-browser eval "getComputedStyle(document.documentElement).colorScheme" agent-browser screenshot ./account-dark.png agent-browser set media light agent-browser eval "getComputedStyle(document.body).backgroundColor" agent-browser screenshot ./account-light.png ``` Pass when the colors differ between `dark` and `light` and match the guide, for example a `color-scheme` value that lets the browser adapt form controls and scrollbars. Each `set media` call sets both preferences, so `set media dark` alone turns reduced motion off. Use `set media dark reduced-motion` to test both together.

文件 SHA256:93234d8103db74fa91c7a532eb1f0f6b2b7fdb5b6b3c45f5cfe99b12a5ec7cb2

仓库许可证记录:Apache-2.0;repository-license-recorded-scope-unverified,查看来源。

SKILL.md原文description · 2026-11-16T12:36:35.145Z

Apply Chrome's Modern Web Guidance to frontend code, then verify the built page in a real browser with agent-browser. Use when asked to build or modernize UI with web platform best practices, follow Modern Web Guidance or Baseline guidance, or check that a change fixed layout shift, respects reduced motion or the color scheme, or gives a dialog correct focus and inert behavior. Triggers include "use modern web guidance", "modern web best practices", "fix layout shift", "respect reduced motion", "add dark mode", "build an accessible dialog", and "verify this against the guide".

查看历史简介来源

历史收录数据

来源仓库vercel-labs/agent-browser
Skill源路径skill-data/modern-web-guidance/SKILL.md

安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。

返回 Skills 目录,按任务继续筛选 · MCP与Skills教程与资源