惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
aimingoo的专栏
aimingoo的专栏
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
J
Java Code Geeks
博客园_首页
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
Intezer
P
Palo Alto Networks Blog
V
Vulnerabilities – Threatpost
雷峰网
雷峰网
O
OpenAI News
SecWiki News
SecWiki News
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
N
News | PayPal Newsroom
Project Zero
Project Zero
Forbes - Security
Forbes - Security
IT之家
IT之家
A
Arctic Wolf
WordPress大学
WordPress大学
Jina AI
Jina AI
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
博客园 - 聂微东
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
Cloudbric
Cloudbric
G
GRAHAM CLULEY
博客园 - 叶小钗
H
Hacker News: Front Page
腾讯CDC
量子位
Help Net Security
Help Net Security
人人都是产品经理
人人都是产品经理
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
爱范儿
爱范儿
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"
Recorded Future
Recorded Future
C
CERT Recently Published Vulnerability Notes

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Learn Command Line Interface (CLI) Development with Dart: From Zero to a Fully Published Developer Tool How to Build a Live Options Database in Python – A Complete Guide How to Migrate to S3 Native State Locking in Terraform How to Use SCons to Build Software Projects [Full Handbook] How to Run Open Source LLMs Locally and in the Cloud QuRT: The Real-Time OS Inside Your Phone's Processor [Full Handbook] The Real Infrastructure Behind Remote Work (It’s Not Just Wi-Fi) The Lithography Handbook: Machines, Markets, and the Next Wave of Semiconductor Startups ITCM vs DTCM vs DDR: Embedded Memory Types Explained [Full Handbook] AI Paper Review: Improving Language Understanding by Generative Pre-Training (GPT-1) How to Build a Market Research Copilot with MCP and Python [Full Handbook] How to Build a Scoped Note-Taking API with Django Rest Framework and SimpleJWT The Complete SOC 2 Type II Implementation Handbook for Engineers: A Month-by-Month Roadmap with Real Commands Mastering the JavaScript Event Loop Data Science Insights: Why the Mean Lies When Handling Messy Retail Data How to Build High-Ranking SEO Landing Page How to Query Data in DynamoDB Using .Net How to Unblock Your AI PR Review Bottleneck: A Tech Lead’s Guide to Building a Codebase-Aware Reviewer How to Navigate Microservices as a Frontend Engineer How to Compress PDF Files in the Browser Using JavaScript (Step-by-Step) Stanford's youngest instructor talks InfoSec, AI, and catching cheaters - Rachel Fernandez interview [Podcast #217] Product Experimentation with Propensity Scores: Causal Inference for LLM-Based Features in Python How to Build a Multi-Agent AI System with LangGraph, MCP, and A2A [Full Book] How to Land Your First Cloud or DevOps Role: What Hiring Managers Actually Look For How to Deploy a Serverless Spam Classifier Using Scikit-Learn, AWS Lambda, & API Gateway How to Dockerize a Go Application – Full Step-by-Step Walkthrough Learn Hardware, Cloud, DevOps, Networking, Security, Databases, DNS, Git, and Linux Inside TreeHacks 2026, Stanford’s Elite Student Hakc Inside Stanford’s Elite Student Hackathon [Full Documentary] How to Measure Your AI Citation Rate Across ChatGPT, Perplexity, and Claude How to Deploy a Full-Stack Next.js App on Cloudflare Workers with GitHub Actions CI/CD How to Build a Multi-Tenant SaaS Platform with Next.js, Express, and Prisma How I Completed 15 freeCodeCamp Certifications in 4 Months: A Structured Learning Journey How to Build an Agentic Terminal Workflow with GitHub Copilot CLI and MCP Servers How AI Changed the Economics of Writing Clean Code How to Apply STRIDE Threat Modeling and SonarQube Analysis for Secure Software Development How to Set Up OpenID Connect (OIDC) in GitHub Actions for AWS How to Split PDF Files in the Browser Using JavaScript (Step-by-Step) How to Build Your Own Language-Specific LLM [Full Handbook] How to Build a Self-Learning RAG System with Knowledge Reflection How to Trace Multi-Agent AI Swarms with Jaeger v2 How I Tested Malaysia's Open Data Portals with Plain English How I Built a Production-Ready CI/CD Pipeline for a Monorepo-Based Microservices System with Jenkins, Docker Compose, and Traefik The Hidden Tax of Infrastructure: Why Your Team Shouldn’t Be Running It Anymore From Metrics to Meaning: How PaaS Helps Developers Understand Production From Symptoms to Root Cause: How to Use the 5 Whys Technique Product Experimentation for AI Rollouts: Why A/B Testing Breaks and How Difference-in-Differences in Python Fixes It How to Create a GPU-Optimized Machine Image with HashiCorp Packer on GCP 3D Web Development with Blender and Three.js How to Fix a Failing GitHub PR: Debugging CI, Lint Errors, and Build Errors Step by Step How to Merge PDF Files in the Browser Using JavaScript (Step-by-Step) How to Handle Stripe Webhooks Reliably with Background Jobs How to Build an Automatic Knowledge Graph for Your Blog with PHP and JSON-LD Understanding Proxies and Reverse Proxies: Your Gateway to Secure Networking The Evolution of Nvidia Blackwell GPU Memory Architecture How to Use PostgreSQL as a Cache, Queue, and Search Engine The New Definition of Software Engineering in the Age of AI Reclaim Your Time – Master Automation with Zapier How to Create Dynamic Emails in Go with React Email Why Many Beginner Self-Taught Developers Struggle (And What to Do About It) How to Build a Headless WordPress Frontend with Astro SSR on Cloudflare Pages How to Make Your GitHub Profile Stand Out How to Use Context Hub (chub) to Build a Companion Relevance Engine Why Chrome OS Is the Operating System the AI Era Was Built For How to Build Microservices-Based REST APIs for Healthcare Portals How to friction-max your learning with software engineer Jessica Rose [Podcast #216] Shadow AI Explained: Why Employees Are Using AI Behind Your Back Traditional Scraping vs AI Scraping: A Practical Guide for Developers and Data Teams How Database Indexes Work – A Practical Guide with PostgreSQL Examples How to Streamline Search in Web Applications with Elasticsearch How to Build an Open Source Data Lake for Batch Ingestion OpenAI Codex Essentials – AI Assisted Agentic Development Course Learn Software System Design How to Generate PDF Files in the Browser Using JavaScript (With a Real Invoice Example) How to Get Started with Terraform Service-to-Service Communication: When to Use REST, gRPC, and Event-Driven Messaging A Developer’s Guide to Lazy Loading in React and Next.js The Data Quality Handbook: Data Errors, the Developer's Role, and Validation Layers Explained. United States Residential Proxy: Why Local IP Accuracy Matters for SERP, Ads, and Pricing How to Build a Fashion App That Helps You Organize Your Wardrobe How to Build an Admin Dashboard Sidebar with shadcn/ui and Base UI The AI Governance Handbook: How to Build Responsible AI Systems That Actually Ship How to Build a Local DevOps HomeLab with Docker, Kubernetes, and Ansible How to Use Mixins in Flutter [Full Handbook] How to Prep for Technical Interviews – A Guide for Web Developers GPT-5.4 vs GLM-5: Is Open Source Finally Matching Proprietary AI? Data Visualization Tools for Svelte Developers How to Keep Human Experts Visible in Your AI-Assisted Codebase Efficient Data Processing in Python: Batch vs Streaming Pipelines Explained How to Build and Deploy Multi-Architecture Docker Apps on Google Cloud Using ARM Nodes (Without QEMU) How to Build a Secure AI PR Reviewer with Claude, GitHub Actions, and JavaScript How to Build a Positioning-Based Crude Oil Strategy in Python [Full Handbook] How to learn programming and CS in the AI hype era – interview with dev and prof Mark Mahoney [Podcast #215] CUDA Programming for NVIDIA H100s How to Build Reliable AI Systems. How to Build an Online Marketplace with Next.js, Express, and Stripe Connect How to Build a Cost-Efficient AI Agent with Tiered Model Routing The WebCodecs Handbook: Native Video Processing in the Browser The Bluetooth LE Audio Handbook: From "Why Does My Call Sound Like a Tin Can?" to AOSP Implementation How to Set Up OpenClaw and Design an A2A Plugin Bridge
How to Stop Your AI Coding Agent from Writing Outdated Code with Modern Web Guidance
Ophy Boamah · 2026-06-25 · via freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
How to Stop Your AI Coding Agent from Writing Outdated Code with Modern Web Guidance

AI coding agents can save developers a lot of time – that is, until you open the output and realize they've written code like it's 2019.

Ask an agent to build a tooltip, for example. The HTML looks polished, the CSS transitions are smooth, the aria-describedby wiring is correct. Then you get to the JavaScript: a js-hidden class toggle system, a dismissAllTooltips() function, touch event handlers, click-outside detection, and an entire interaction management layer to compensate for what CSS alone can't do.

The agent isn't broken. It's just reaching for patterns that dominate its training data, even though the browser has had better answers for years.

Modern Web Guidance (MWG) is Google Chrome's open-source fix. It injects expert-vetted, platform-aware guidance directly into your AI agent's context, steering it toward current, accessible, and performant web standards.

In this article, you'll learn why Modern Web Guidance solves the "legacy code" problem, and how to integrate it into your workflow for consistently up-to-date results.

Table of Contents:

  • Why Do AI Agents Default to Legacy Patterns?

  • What Is Modern Web Guidance (MWG)?

  • How To Install Modern Web Guidance

  • After Installing Modern Web Guidance: What Actually Changes

  • What Modern Web Guidance Does Not Handle for You

  • Conclusion

Why Do AI Agents Default to Legacy Patterns?

Every large language model (LLM) learns from the web, which is evolving at a truly rapid pace. New browser APIs ship years before they have enough tutorials, Stack Overflow answers, and real-world codebases to meaningfully appear in training data.

The practical result: even when a model has been trained to know that a modern API exists, it has seen the old approach thousands of times and the new approach a handful of times. As a result, when it generates code, the legacy pattern wins, not because the model is ignorant, but because the training signal for the outdated approach is stronger.

Prompting doesn't fully solve this. Telling your agent to "use modern APIs" nudges things slightly, but it doesn't provide the dense, expert-vetted implementation patterns the model needs to write production-ready modern code confidently. You'd have to paste in documentation for every feature, in every session, indefinitely.

Here's what the problem looks like in practice. To have real outputs to test, I prompted Antigravity IDE to build two separate components without Modern Web Guidance installed.

Before: Tooltip Component

Prompt: "Build a tooltip component that appears above a button when hovered."

The HTML is reasonable. The CSS handles positioning with position: absolute, animates opacity, and even wires up role="tooltip" and aria-describedby correctly. Then you get to the JavaScript:

// ❌ Before MWG — a full interaction management layer built in JS
document.addEventListener('DOMContentLoaded', () => {
  const containers = document.querySelectorAll('.tooltip-container');

  containers.forEach(container => {
    const trigger = container.querySelector('.tooltip-trigger');
    const tooltip = container.querySelector('.tooltip-content');

    const forceHide = () => tooltip.classList.add('js-hidden');
    const resetVisibility = () => tooltip.classList.remove('js-hidden');

    // Escape key to dismiss
    trigger.addEventListener('keydown', (e) => {
      if (e.key === 'Escape') { forceHide(); e.preventDefault(); }
    });

    trigger.addEventListener('blur', resetVisibility);
    container.addEventListener('mouseleave', resetVisibility);
    container.addEventListener('mouseenter', resetVisibility);

    // Touch handling
    trigger.addEventListener('touchstart', (e) => {
      const isVisible = !tooltip.classList.contains('js-hidden') &&
        getComputedStyle(tooltip).visibility === 'visible';
      if (isVisible) { forceHide(); } else { dismissAllTooltips(); resetVisibility(); }
    }, { passive: true });
  });

  function dismissAllTooltips() {
    document.querySelectorAll('.tooltip-content').forEach(t => t.classList.add('js-hidden'));
  }

  document.addEventListener('click', (e) => {
    if (!e.target.closest('.tooltip-container')) {
      document.querySelectorAll('.tooltip-content').forEach(t => t.classList.remove('js-hidden'));
    }
  });
});

The problem isn't that the above code is wrong – not at all, it works. The problem is what it reveals: because the CSS :hover and :focus-within selectors can't handle Escape-to-dismiss, touch toggle, or click-outside detection, the agent has to build a parallel JavaScript system to manage tooltip state. Visibility is now split across two systems that have to stay in sync. A js-hidden class exists specifically to let JavaScript override CSS.

You can move ahead to see the updated Tooltip component code after Modern Web Guidance was installed if you're curious right now.

Next, let's look at how the agent builds a toast notification without Modern Web Guidance.

Before: Toast Notification with Exit Animation

Prompt: "Build a toast notification system where notifications fade out before being removed."

// ❌ Before MWG — JavaScript owns the entire animation lifecycle
const dismissToast = (toast) => {
  if (toast.classList.contains('toast-fade-out')) return;

  // 1. Apply fade-out class to trigger CSS transition
  toast.classList.add('toast-fade-out');

  // 2. Wait for transition, then remove from DOM
  const handleUnmount = (e) => {
    if (e.propertyName === 'opacity' || e.propertyName === 'transform') {
      toast.removeEventListener('transitionend', handleUnmount);
      toast.remove();
    }
  };
  toast.addEventListener('transitionend', handleUnmount);

  // 3. Fallback in case transitionend doesn't fire
  setTimeout(() => {
    if (toast.parentNode) toast.remove();
  }, 400);
};

// Auto-dismiss after 4 seconds
autoDismissTimer = setTimeout(() => {
  dismissToast(toast);
}, 4000);

Reviewing the code above: this pattern is extremely common, and again it does work. But notice how much JavaScript is dedicated to a problem that's fundamentally about animation timing.

The agent adds a CSS class to start a transition, then uses transitionend to know when to remove the element, then adds a setTimeout fallback in case transitionend doesn't fire, then another setTimeout for auto-dismissal.

The JavaScript and CSS are deeply entangled. Change the transition duration in CSS and you have to update the JavaScript timeout to match.

You can move ahead to see the updated Toast notification code after Modern Web Guidance was installed if you're curious now.

Both examples share the same shape: the agent writes JavaScript to compensate for what it doesn't know the browser can handle natively.

What Is Modern Web Guidance (MWG)?

Modern Web Guidance is an open-source project backed by the Google Chrome team and the Microsoft Edge team. Instead of hoping the model knows what the modern platform offers, you give it a structured, expert-vetted reference file that maps common development scenarios to the right solutions.

It ships as an agent skill, a SKILL.md file that lives in your project and gets read by your coding agent before it generates code. Think of it as a project-specific instruction manual that teaches the agent which modern APIs exist and when to use them. The skill shifts the probability distribution toward modern platform solutions in a way that a one-line prompt instruction can't.

Under the hood, the mechanism works in three steps:

  1. Your agent activates the skill because the task is web-related.

  2. The agent runs modern-web-guidance search "<query>", a local semantic search using an offline TensorFlow.js model. No API key, and no network call.

  3. The agent retrieves the matched guide via modern-web-guidance retrieve <guide-id>, injecting targeted patterns, gotchas, and fallback strategies directly into its context window.

Two skill packs are available. modern-web-guidance covers modern browser APIs, CSS layout systems, performance, accessibility, and built-in AI APIs. This is what most developers want.

chrome-extensions covers Manifest V3, background workers, and Chrome Web Store publishing. Early evals show a 37 percentage point improvement in adherence to modern best practices when agents run with it installed.

The universal path (works with any agent):

npx modern-web-guidance@latest install

This runs an interactive wizard that detects your coding agent, asks which skill packs you want, and drops the SKILL.md file in the correct location automatically. The CLI is fully offline and self-contained: no external dependencies and no API keys.

Claude Code:

#1. Add the marketplace /plugin marketplace add GoogleChrome/modern-web-guidance

#2. Install the plugin
/plugin install modern-web-guidance@googlechrome

#3. Reload plugins
/reload-plugins

After installation, verify that .claude/skills/ exists in your project root and contains the skill file. That's where Claude Code reads skills from.

Cursor:

Modern Web Guidance is listed in the Skill Marketplace.

Search for modern-web-guidance and click Install, no CLI step required.

GitHub Copilot CLI:

# 1. Add the marketplace /plugin marketplace add GoogleChrome/modern-web-guidance

# 2. Install the plugin
/plugin install modern-web-guidance@googlechrome

Vercel Agent Skills:

npx skills add GoogleChrome/modern-web-guidance

Google Antigravity:

One-click install available directly inside the app.

After Installing Modern Web Guidance: What Actually Changes

Earlier, we saw the outputs for the prompts on both the Tooltip and Toast Notification components when Modern Web Guidance was not installed. Run the same prompts with Modern Web Guidance installed and the agent reaches for entirely different tools.

After: Tooltip Component

With Modern Web Guidance, the same tooltip prompt produces no JavaScript at all. Instead, the agent reaches for two APIs working together: popover="hint" for native hover/focus-triggered visibility, and interestfor (the Interest Invokers API) to wire the trigger to its target declaratively in HTML.

<!-- ✅ After MWG — declarative HTML, zero JavaScript -->
<div class="tooltip-wrapper">
  <button
    id="btn-deploy"
    class="btn-trigger"
    interestfor="tooltip-deploy"
  >
    Deploy App
  </button>
  <div popover="hint" id="tooltip-deploy" class="tooltip-content">
    Instantly push code changes live
  </div>
</div>
/* Anchor positioning wires layout to the trigger */
#btn-deploy {
  anchor-name: --tooltip-deploy;
}

#tooltip-deploy {
  position-anchor: --tooltip-deploy;
}

.tooltip-content[popover] {
  position: absolute;
  bottom: anchor(top);
  left: anchor(center);
  transform: translateX(-50%) translateY(8px);

  opacity: 0;
  transition: opacity 0.2s ease,
              display 0.2s allow-discrete,
              overlay 0.2s allow-discrete;
}

.tooltip-content[popover]:popover-open {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

@starting-style {
  .tooltip-content[popover]:popover-open {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
}

The js-hidden class is gone. The dismissAllTooltips() function is gone. The touchstart handler is gone. The click-outside detection is gone.

popover="hint" provides light-dismiss behavior natively, the browser handles hover intent, focus management, Escape-to-dismiss, and touch semantics without a line of JavaScript. @starting-style defines the entry animation state, and allow-discrete handles the exit, so both directions of the transition are owned entirely by CSS.

Browser compatibility note: The Interest Invokers API (interestfor) is currently available in Chrome with a flag and has a polyfill at unpkg.com/interestfor. CSS Anchor Positioning is Baseline 2025. The agent also included polyfill loading in the output. Check caniuse.com/css-anchor-positioning and assess against your browser support requirements before shipping.

One thing worth knowing: of the two APIs here, CSS Anchor Positioning is already shipping in stable browsers, while interestfor is the more experimental one. The polyfill covers it, but think of it as a preview of where the platform is heading rather than something you would ship to production today without testing.

After: Toast Notification with Exit Animation

The same toast prompt with Modern Web Guidance produces a popover="manual" element instead of a class-toggled <div>. The browser's Top Layer handles rendering and stacking context natively.

// ✅ After MWG — the browser handles show/hide; JS handles auto-dismiss timing only
const createToast = (type) => {
  const toast = document.createElement('div');
  toast.setAttribute('popover', 'manual');
  toast.className = `toast toast-${type}`;

  toast.innerHTML = `
    <div class="toast-icon">...</div>
    <div class="toast-content">...</div>
    <button
      popovertarget="${toastId}"
      popovertargetaction="hide"
      class="toast-close"
      aria-label="Dismiss notification"
    >&times;</button>
  `;

  container.appendChild(toast);
  toast.showPopover(); // triggers @starting-style entry animation natively

  // Auto-dismiss
  const autoDismissTimer = setTimeout(() => {
    if (toast.matches(':popover-open')) toast.hidePopover();
  }, 4000);

  // Remove from DOM after exit transition completes
  toast.addEventListener('beforetoggle', (event) => {
    if (event.newState === 'closed') {
      clearTimeout(autoDismissTimer);
      toast.addEventListener('transitionend', () => toast.remove(), { once: true });
      setTimeout(() => { if (toast.parentNode) toast.remove(); }, 500); // fallback
    }
  });
};
/* ✅ CSS owns both entry and exit animation */
.toast[popover] {
  opacity: 0;
  transform: translateX(60px) scale(0.95);
  transition: opacity 0.3s ease,
              transform 0.3s ease,
              display 0.3s allow-discrete,
              overlay 0.3s allow-discrete;
}

.toast[popover]:popover-open {
  opacity: 1;
  transform: translateX(0) scale(1);
}

@starting-style {
  .toast[popover]:popover-open {
    opacity: 0;
    transform: translateX(60px) scale(0.95);
  }
}

The manual close button now uses popovertarget and popovertargetaction="hide", a declarative HTML binding that requires no click handler. showPopover() triggers the @starting-style entry animation natively. hidePopover() triggers the CSS exit transition via allow-discrete.

JavaScript is now responsible for only two things: scheduling the auto-dismiss timeout and removing the element from the DOM after the exit transition completes. The animation coordination that previously required transitionend listeners, CSS class toggling, and synchronized timing is gone, as the browser owns it.

What Modern Web Guidance Does Not Handle for You

Modern Web Guidance shifts what the agent writes on a first attempt. It doesn't eliminate the need for code review, and in practice two friction points come up consistently.

1. The Bleeding-edge Cliff

Modern Web Guidance defaults to the newest Baseline features. @starting-style, transition-behavior: allow-discrete, CSS Anchor Positioning, and the Interest Invokers API are all correct, but some are new enough that they require polyfills for production use today. The agent will include those polyfill imports in its output.

You still need to verify the features used against your actual browser support requirements. A junior developer reading interestfor or position-anchor for the first time will need to look these up, because Modern Web Guidance assumes you want the most modern correct answer, not the most familiar one.

2. The CSS Encapsulation Trade-off

When Modern Web Guidance guides the agent toward moving inline styles or dangerouslySetInnerHTML keyframes into a global stylesheet, which it does for security and hydration reasons, it breaks component-level encapsulation. Delete the component later and you'll have orphaned CSS in your global file. The call is architecturally correct, but you still need to namespace those classes and track the dependency manually.

The 37-point improvement in best-practice adherence is real, but Modern Web Guidance is better understood as raising the default ceiling and not removing the need for human judgment. Think of it as giving your agent the habits of a developer who stays updated by actually reading current web docs.

Conclusion

The problem was never that AI coding agents were bad at web development. The problem is that they were working from an outdated picture of the platform, one shaped by training data that reflects the early 2020s web more than the browser capabilities available today.

Modern Web Guidance updates that picture. The tooltip before/after alone tells the whole story: the agent went from a js-hidden state machine with touch handlers and click-outside detection to two HTML attributes and a block of CSS. The JavaScript interaction layer didn't get refactored, it became unnecessary.

The code your agent writes is only as current as what it was trained on. Modern Web Guidance closes that gap.

I ran this exact experiment on my own project. You can read the full case study with raw diffs at ophyboamah.com/blog.

Here are some helpful resources:



Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started