Summary note: This is a summary of Chrome for Developers’ (@ChromiumDev) November 14, 2026 X article “Modern Web Guidance: Everything You Need to Know”, not a reprint of the original. The 2 example prompts in this post are quoted verbatim from the original (in English, published by the author for readers to copy and use); all other prose is a summary. Original link: https://x.com/ChromiumDev/status/2121339675667309047

Note: The article was published on November 14; at the time of checking (November 15, ~09:20) it showed about 170K views, 2,454 likes, 271 reposts and 2,991 bookmarks. Figures and prices are the author’s own claims and have not been independently verified; the three case-study figures (Policybazaar, WeTV, note inc.) come from the titles of articles linked in the post, and the case-study blogs themselves were not opened separately; the eval dashboard transcription covers only the headline results, the default paired trial and the per-agent summary table — the full 30 tasks were not transcribed one by one and the folded testing-methodology section was not expanded.

The Chrome team has shipped an official skill for coding agents: Modern Web Guidance, now at a stable 1.0 release. It bundles three things — best-practice guides, a CLI, and semantic search that lets an agent retrieve the context it needs while it works. The problem it solves is specific: when agents write code, they copy 2015-era patterns out of their training data; and old code never actually breaks, so nobody files a bug for it, and the legacy patterns quietly accumulate in a codebase at the cost of bundle size, responsiveness and accessibility.

1. What it does

On a new project it steers the agent toward modern Baseline features; on an existing project, the new modernization workflow in 1.0 scans the whole repository, finds legacy patterns and helps the agent upgrade them. Both modes are supported: look up verified patterns in the current codebase, or run a legacy scan across the entire repository.

Installation is a single command:

npx modern-web-guidance@latest install

Updating an existing installation:

npx modern-web-guidance@latest update

2. The modernization workflow: four steps, scan before touching anything

The core is deterministic local scanning: HTML, CSS, JavaScript/TypeScript, framework components and package.json files are scanned quickly with AST, DOM and CSS parsers, locally, with zero LLM calls and zero token cost.

The rule catalog was filtered by measurement: candidate rules were tested across roughly 45,000 open-source repositories, split in half — one half to write and tune the rules, the other half held out unseen for grading. More candidate rules were thrown out than kept — features with no legacy-code equivalent were skipped, and syntax-only swaps with no real payoff were retired (such as rewriting working + or ~ sibling selectors into :has()). For a rule to ship by default it must reach at least 80% static matcher precision and 90% post-verification precision on unseen code.

Every rule also carries explicit keepWhen/dropWhen rubrics, so the agent judges the surrounding code: intentional fallbacks, CSS @supports guards and lookalikes get discarded before anything is reported. legacy-scan covers only the roughly 20% of the ~200 guides where legacy code can be spotted deterministically without false positives; the rest of the catalog is retrieved by the agent as it builds.

Execution is a four-step loop, and notably there is no --fix flag — the authors argue that even apparently straightforward modernizations often turn out to be cross-layer refactors (deleting an imperative JS listener or an npm package and moving the behavior into HTML and CSS), with subtle behavior and browser-support issues that don’t suit one-click automatic changes:

  1. Scan (legacy-scan): the agent runs npx modern-web-guidance legacy-scan <path> --json, which pre-screens files for relevant substrings and only spins up the AST, CSS and HTML parsers on candidate files and rules. A finding that gets this far already has about a 92% chance of not being a false positive, and every match includes a verification checklist.
  2. Contextual verification (keepWhen/dropWhen): the agent inspects the code around each match against that rule’s verification rubric. If a scrollHeight read belongs to virtualized scrolling rather than a <textarea> hack, or an @supports check already protects the property, the finding is silently dropped.
  3. Report: the agent summarizes the verified findings; if asked to review a plan first, it presents the modernization plan before making edits.
  4. Guide retrieval, refactoring, and test verification: the agent runs npx modern-web-guidance retrieve <guide-id> to fetch the right guide, performs the refactor following the guide’s Baseline compatibility patterns, then re-runs legacy-scan on the modified files alongside the project’s test suite to confirm the issues are resolved.

It can be triggered in natural language — ask the agent to check for “legacy patterns” or to “modernize” a repository or folder. Note: naming a single component performs a regular guide lookup instead of a scan. The author’s two example prompts:

Scan an entire repository (the author’s original prompt, quoted verbatim):

Modernize this repository using Modern Web Guidance. Scan our frontend files for legacy patterns, verify the findings, and propose a modernization plan before making any code edits.

Target one folder (the author’s original prompt, quoted verbatim):

Check src/components/forms for legacy web patterns that can be refactored to modern Baseline features.

legacy-scan can currently be run manually in the terminal; automated CI/CD pipeline integrations are in development.

3. Which legacy patterns it catches

The qualified rules span four domains: Forms and UI, dialogs and controls, CSS layout, typography and visual design, and Security. Examples:

Domain Legacy pattern detected Modern replacement
Forms and UI JS scrollHeight textarea auto-resize hooks CSS field-sizing: content
Forms and UI Enter keydown submit handlers missing IME guards if (e.isComposing || e.keyCode === 229) return;
Forms and UI Premature :invalid CSS styling untouched inputs on load :user-invalid and :user-valid pseudo-classes
Forms and UI Missing autocomplete tokens on auth and checkout forms Standardized autocomplete values
Dialogs and controls e.target === dialog click listeners that break drag-selection <dialog closedby="any"> with progressive enhancement
Dialogs and controls Imperative addEventListener click listeners for overlays Declarative popover and popovertarget attributes
CSS layout max-height: 9999px accordion animation hacks interpolate-size: allow-keywords and calc-size()
CSS layout JS parent-class toggling based on child state Relational :has(:checked) / :has(:focus-visible) selectors
CSS layout Duplicated @media (prefers-color-scheme: dark) blocks CSS light-dark() function
Security External CDN script tags missing Subresource Integrity integrity and crossorigin="anonymous" attributes

The documentation gives three code-transformation examples. First, auto-growing textareas: the old approach measures scrollHeight on every keystroke and forces layout thrashing, hurting Interaction to Next Paint (INP); the new approach is pure CSS:

/* After: Native declarative field sizing */
textarea {
  field-sizing: content;
  min-block-size: 3lh;
  max-block-size: 15lh;
}

Second, declarative popovers: what used to need a JS listener calling showPopover() now needs only a popovertarget attribute — no JavaScript. Third, IME-safe enter submission: an unguarded Enter listener fires mid-composition when users confirm kanji/hanzi characters in Japanese, Chinese or Korean IMEs; adding the e.isComposing || e.keyCode === 229 guard avoids it.

4. The public eval: pass rates from 52% to 92%

The public eval dashboard linked from the article runs nightly and baseline A/B jobs that give Claude Code, Codex CLI and Antigravity CLI (Gemini) identical tasks, with and without Modern Web Guidance, grading the output in a real browser. Headline results:

  • Best-practice pass rate up 40 percentage points: 52% → 92%, across 1,104 tasks, ~9.3k checks, 3 agents and 5 jobs.
  • Automated accessibility checks up 38 percentage points: 56% → 94% (note: not a full WCAG audit), ~1.5k checks, 95 guides and 5 dimensions.

By agent family (latest job per model in the last 7 days): Claude Code pass rate 50% → 92% (+42 percentage points), accessibility 59% → 93%; Codex CLI pass rate 51% → 86% (+35 percentage points), accessibility 59% → 91%; Antigravity CLI pass rate 54% → 95% (+41 percentage points), accessibility 51% → 95%.

The default paired trial makes the point vividly: add an interactive menu component with multi-level nested submenus to a navigation bar. Without MWG, 1 of 25 checks passed, accessibility 0/15, in 4m 46s and 80.4k tokens; with MWG, 25/25 passed, accessibility 15/15, in 5m 17s and 117k tokens — a few more tokens for the difference between 1 check and all of them.

5. The three case-study figures

  • Policybazaar: cut auditing overhead by 92% and screen delivery time by over 90%.
  • WeTV: cut performance debugging time by 87%.
  • note inc.: raised guideline adherence from 61% to 94%.

The author closes by suggesting Modern Web Guidance be paired with Chrome DevTools for agents: the former handles static code modernization, the latter live browser verification, benchmarking and debugging.

Written byAuthor

Buy me a coffee~

Solana

Solana

Solana

Solana

Solana

Solana

Background music
Jump to comments
Settings
Back to top
Go to bottom
Collapse toolbox