Artificial intelligence
Modern Web Guidance: How to Get Your AI Coding Agent Writing Up-to-Date Web Code
Published by Sven Kalbhenn · 0 Comments
Learn how Google's Modern Web Guidance steers AI coding agents toward native HTML, CSS, and Baseline APIs, with CLI setup, legacy-scan, and eval results.
Ask an AI coding agent today for a basic modal or tooltip. Odds are you'll get 150 lines of hand-rolled JavaScript, manual focus traps, and event-listener positioning code, even though modern browsers handle those jobs natively with the <dialog> element, the Popover API, and CSS Anchor Positioning.
That exact gap is what Google targets with Modern Web Guidance. The open-source skill pack feeds verified web platform guides and live Baseline compatibility data into coding agents like Claude Code, Cursor, Codex, GitHub Copilot CLI, Gemini CLI, and JetBrains WebStorm through a local CLI before the agent writes its first line of frontend code.
Why Coding Agents Still Lag Behind the Web Platform
Language models learn from enormous archives of older codebases. Those training sets are packed with frontend patterns from 2015 to 2020, when developers needed custom workarounds or third-party packages for almost every interactive UI component.
Even when a model knows a new browser API exists, it often misses the production edge cases. How does fetchLater() behave near its 64-kilobyte payload cap? Which scrollbar quirks show up on macOS? Without those specifics, generated code looks fine on a quick glance while hauling unnecessary JavaScript weight or breaking accessibility.
To fix that, the Google Chrome team maintains Modern Web Guidance alongside the Microsoft Edge, Mozilla Firefox, and MDN teams and the wider web community. Agents get a shared, vendor-backed reference for cross-browser standards.
How the CLI Workflow Works in Practice
Anyone who has tried pasting huge documentation files into AGENTS.md or a system prompt knows the cost. Your context window fills up with tens of thousands of tokens that have nothing to do with the task on screen.
Modern Web Guidance uses a lean lookup loop around the modern-web-guidance package:
- Skill activation: The installed SKILL.md tells your coding agent to query the CLI first whenever it handles client-side HTML, CSS, DOM, or browser JavaScript. Backend tasks like SQL queries or Docker scripts are skipped explicitly.
- Local semantic search: Running npx -y modern-web-guidance@latest search "<query>" searches for matching guides right on your machine. It pairs BM25 with an embedded, zero-dependency embedding model, so there are no external search APIs or API keys, and after the first download npx --offline runs fully offline.
- Targeted retrieval: Once a match looks right, the agent runs npx -y modern-web-guidance@latest retrieve "<guide-id>" to load only that guide into its context window.
npx modern-web-guidance@latest search "animate a dialog modal backdrop"
npx modern-web-guidance@latest retrieve "animate-to-from-top-layer"
Retrieved guides cover the native API pattern along with known platform gotchas and compact fallbacks under 50 lines of code when older browsers still need support.
Inside the Catalog: 269 Features and 206 Real-World Guides
According to the repository documentation, the catalog spans 269 modern web platform features across 144 CSS and layout topics, 38 HTML and DOM capabilities, and 87 JavaScript APIs. Those map to 206 task-oriented guides built around concrete UI problems.
The catalog covers areas such as:
- CSS layout and visual states: Container Queries, subgrid, modern color spaces like oklch, scroll-driven animations, and View Transitions with @starting-style.
- Forms and native UI controls: Anchor Positioning for tooltips, the Popover API, <dialog>, :user-invalid validation, auto-growing fields via field-sizing, and custom-styled <select> menus.
- Performance and accessibility: Interaction to Next Paint (INP) diagnostics, task scheduling with scheduler.yield, Speculation Rules, content-visibility, plus screen-reader error announcements and OS text-scale support.
- On-device AI and agent interfaces: Browser-native Translator, Summarizer, Language Detector, and Prompt API guides alongside WebMCP patterns for exposing forms and client-side JavaScript functions as agent tools.
- Security: Modern patterns for the Sanitizer API and passkeys.
The plugin also ships a dedicated chrome-extensions skill for Manifest V3 extensions. It addresses frequent failure points such as required side panel triggers, missing manifest icon files, strict Content Security Policy rules without eval(), and Chrome Web Store publishing requirements.
Safe Rollouts with Baseline, .mwgrc, and legacy-scan
Not every new browser feature belongs in production right away. Modern Web Guidance ties its recommendations directly to Baseline support data.
Features marked as "Baseline Widely available" are used without fallbacks by default. Newer capabilities require a lightweight fallback or progressive enhancement unless your project specifies its own browser support policy inside AGENTS.md or CLAUDE.md.
Experimental Origin Trials and volatile features, defined as single-engine APIs shipped within the past three months, follow an even stricter rule. They appear in search results, while retrieve keeps them locked until a team opts in via a .mwgrc configuration file:
npx modern-web-guidance@latest set-allow-origin-trials
npx modern-web-guidance@latest set-allow-volatile-features
Finding Older Patterns with legacy-scan
For existing codebases, the CLI includes legacy-scan, a deterministic static scanner that costs zero LLM tokens:
npx modern-web-guidance@latest legacy-scan . --json
The scanner inspects HTML, CSS, JavaScript, TypeScript, and package.json for outdated UI patterns. According to the documentation, legacy-scan covers roughly 20 percent of the guide catalog, focusing on rules that can be matched reliably through static analysis. For each hit, the agent checks documented criteria to separate genuine modernization targets from intentional fallbacks before editing files.
Does It Actually Improve Output? Looking at the Evals
Prompt advice is easy to claim and hard to verify. Google publishes a public Eval Dashboard powered by an automated Playwright evaluation suite.
Coding agents tackle realistic tasks inside full sample apps (daily-grind and devtools-times) using prompts that deliberately omit API names. In November 2026, the pipeline ran 229 tasks across roughly 1,960 checks both unguided and with Modern Web Guidance enabled:
- Codex CLI (gpt-6.1-sol): pass rate rose from 49 percent to 85 percent (+36 percentage points).
- Claude Code (opus-5-5): pass rate rose from 54 percent to 94 percent (+40 percentage points).
- Antigravity CLI (gemini-4-argon): pass rate rose from 56 percent to 97 percent (+41 percentage points).
The team also prunes from the top down. Whenever models reliably pass a task without help, redundant guidance is trimmed from the files so context usage stays small.
Two-Minute Setup, Telemetry Opt-Out, and Realistic Limits
The quickest setup runs interactively inside your project directory:
npx modern-web-guidance@latest install
You can also wire it straight into specific ecosystems, such as Vercel Agent Skills (npx skills add GoogleChrome/modern-web-guidance) or Claude Code's plugin marketplace:
claude plugin marketplace add GoogleChrome/modern-web-guidance
claude plugin install modern-web-guidance@googlechrome
Integrations are available for Antigravity, Cursor, Gemini CLI, GitHub Copilot CLI, and JetBrains WebStorm as well.
Privacy-conscious teams should note one detail: when online, the CLI sends anonymous usage telemetry in the background to Google. According to the source repository, it logs install counts, the calling agent name, retrieved guide IDs, and agent-generated search queries, while excluding raw user prompts. To disable telemetry permanently on your laptop, add the environment variable to your shell profile (~/.zshrc on macOS by default, or ~/.bashrc under Bash):
echo 'export DISABLE_TELEMETRY=1' >> ~/.zshrc
source ~/.zshrc
echo "$DISABLE_TELEMETRY"
The last command should print 1. Because some desktop apps and IDEs read environment variables from login shells, adding the same line to ~/.zprofile on macOS and restarting your IDE ensures it applies there too.
The CLI source code is licensed under Apache 2.0, and the guide content is available under Creative Commons Attribution 4.0 (CC-BY 4.0).
Keep expectations grounded, though: the skill doesn't replace code review. It leaves backend architecture untouched, and legacy-scan still covers only one-fifth of the full catalog. As guardrails for everyday UI components and CSS layouts, it cuts out a lot of cleanup work.
Where to Test It First in Your Own Repo
You don't need a rewrite to see what it catches. Run npx modern-web-guidance@latest legacy-scan . in an existing frontend repository and inspect which dated patterns are hiding in your current templates or components. Install the skill for your next UI task and watch how much less custom JavaScript your agent proposes during review.
Sources
About the Author: Sven Kalbhenn
Senior TYPO3 Consultant & Software Developer
Write comment
Your email is never published.
Comments (0)
No Comments