Lurker News
Browsers natively handle a lot of what used to take 50 lines of JS (or a dependency): `CSS.highlights` for text range highlighting without s everywhere, `` and showModal() give you backdrops and ideal focus management, `field-sizing` to auto-grow textareas as the user types.. (Something yesterday's ftrain post touched on [0])

Models know about some of these by name, but consistently won't default to using the platform-native solution and instead prefer the incumbent +JS based pattern. We started an effort in Chrome to supplement coding agents with this key domain knowledge and we're shipping our 1.0 today, in collaboration with Firefox, MDN, and Edge.
200+ guides (~1.7MB) of curated, hand-crafted implementation best-practices from web experts, updated as the web evolves. (Open source, obv, so.. we'll welcome your bikeshedding ;) Readable versions here: [1]
I've spent the last 9 months obsessing over how to ship this as an agent skill + (Agentic RAG) CLI without blowing up your context window. (Or cedeing activation mechanics to MCP dynamic tool search). The skill description is minmaxed for activating on relevant frontend tasks. The RAG work I'm pretty proud of… originally a 500mb native stack down to a ~7MB pure-JS package, ~10ms search on your CPU.
We just introduced a deterministic 'legacy-scan' (trained on 30k github repos) to identify old 'n dusted patterns that your agent can modernize. (92% avg precision on held-out repos.)
People make a lot of claims about what coding agents are good/bad at. We wanted receipts, so we invested heavily in eval infra [2] to help us hill-climb, but also to identify when knowledge is common enough we can prune our guides. (Ofc, some of the things we thought AI didn't know turned out to be wrong :) We run codex/claude/agy against 200 tasks without the skill and then with.. In total ~1,700 playwright/AST-based assertions. Agents go from 55% pass unguided to 92% guided.
Try it out:

    DISABLE_TELEMETRY=1 npx modern-web-guidance@latest install
    DISABLE_TELEMETRY=1 npx modern-web-guidance@latest search "animate dialog modal"
    DISABLE_TELEMETRY=1 npx modern-web-guidance@latest legacy-scan ./src
If you spot something wrong or weird, give us a holler!

Longer write-up on the 1.0: https://developer.chrome.com/blog/modern-web-guidance-v1
---
0: https://news.ycombinator.com/item?id=50416456
1: https://developer.chrome.com/docs/modern-web-guidance/guides
2: https://googlechrome.github.io/modern-web-guidance-src/

Comments (146) 60 threads

Show all comments

Showing thread 1 of 60

surround5 replies#
Here's a list of browser features the skills will tell your agent to use that are stable in Chrome but not supported by Firefox and Safari:

  CSS @function
  CSS calc-size()
  CSS interpolate-size
  CSS corner-shape
  CSS border-shape
  CSS flex-wrap: balance
  CSS text-fit
  CSS text-decoration-skip-spaces
  CSS scroll-axis-lock
  CSS scroll-target-group
  CSS :target-current
  CSS scroll-initial-target
  CSS container scroll-state queries
  scrollsnapchange event
  scrollsnapchanging event
  HTML focusgroup
  Element.startViewTransition()
  CSS view-transition-scope
  Interest Invokers (interestfor)
  LanguageModel (Prompt API)
  LanguageDetector
  Translator
  Summarizer API
  Window.fetchLater()
  Speculation Rules API
  Long Animation Frames API
  VisibilityStateEntry
  PerformanceSoftNavigation
  InteractionContentfulPaint
  Connection-Allowlist
  CSS url() integrity() modifier
  HTML meta name="text-scale"
  HTML template for
  HTML processing instructions
  PasswordCredential
  Promise-returning scroll methods
  Web App Origin Migration
  Local Network Access permissions
  Request.targetAddressSpace
  beforeinstallprompt event
To be fair, the skills also recommend ~11 features not supported by Chrome itself. And the project does seem concerned with compatibility: "Guiding models to use sensible, lightweight fallbacks."
philipwalton3 replies#
> Here's a list of browser features the skills will tell your agent to use that are stable in Chrome but not supported by both Firefox and Safari:

To be clear, the skills document how to use these features to solve common use cases, and then they give your agent a full browser support table for any APIs mentioned that are not Baseline Widely available -- and then your agent can decide whether to use them or not, based on your site's browser support requirements.
In most of these cases a cross-browser fallback is also documented.

surround1 reply#
The line between documenting and instructing is blurry in many cases. For example, these statements are meant to document best practices to the agent, but they sound like instructions:

"DO use fetchLater()..."
"Your own code MUST call fetchLater() directly..."
https://github.com/GoogleChrome/modern-web-guidance/blob/mai...
But yes, the skills do document compatibility and fallbacks well.

philipwalton6 replies#
Agreed the line can be blurry, but I want to stress that the goal of this project is NOT to push Chrome-only APIs on users.

The mental model we've been using on the team is:
If you hired an expert web development consultant to build X, what would they recommend as a best practice? When does it make sense to use the new API (because it provides real benefits) vs. when does it make sense to wait until it's available everywhere?
To use your `fetchLater()` example, this is a case where the `fetchLater()` API legitimately solves a very real problem for people trying to build accurate analytics or telemetry features, see: https://nicj.net/beaconing-in-practice/
And lots of companies actually are already using `fetchLater()` in production now because of its increased reliability.

Continue this thread — 6 replies

hatthew#
In my experience, it's difficult to suggest something to an LLM in a way that it doesn't interpret as a command, unless I explicitly list conditions (which it will take as law rather than guidance).
lelandfe1 reply#
The default behavior for this "web best practices" tool which steers people away from "legacy patterns" has agents using Limited Availability features with complex and nuanced[0] fallbacks?

This would be deeply surprising to me, and I am the target audience for this repo. I'd expect the default here to be Widely Available only with some opt-in for the courageous. I don't know that I'd even enable it.
[0] https://github.com/GoogleChrome/modern-web-guidance/blob/4dd...

magicalist1 reply#
> The default behavior for this "web best practices" tool which steers people away from "legacy patterns" has agents using Limited Availability features with complex and nuanced[0] fallbacks?

You have causality reversed here. If you need to detect if the page was loaded in the foreground or background, it is nuanced and (relatively) complex. Therefore it's good for your agent not to just assume document.visibilityState is all it needs to check, or you're going to be getting seemingly impossible log entries pretty quickly.

Continue this thread — 1 reply

hackingonempty1 reply#
How about details/summary?
philipwalton#
The details/summary features are covered in the accordion guide here: https://developer.chrome.com/docs/modern-web-guidance/guides...

If you scan to the bottom of the guide under the "Fallback strategies" section, you can see the recommendations for how to deal with the aspects of details/summary that aren't Baseline widely available (e.g. mutually exclusive details).

onion2k1 reply#
Here's a list of browser features the skills will tell your agent to use that are stable in Chrome but not supported by Firefox and Safari

That's fine though. Progressive enhancement, adding features to a site when they're available but still offering a working site when they're not, is how we should build web sites. That way they work for the user's device rather than the developer's opinion of what the web should do.
Working that way completely removes the decision about whether or not to use a feature because it doesn't work for some people, and moves it to a decision about whether or not it's worth adding for the users on browsers that can use it. In the past that was a real development effort cost, but today where AI writes the code the effort is much, much lower.
If you're using AI to make something but still using heuristics designed to save coding time then you really need to rethink your mental model of how to decide what gets built.
Websites created today should all use server-loaded content for the first render, small page sizes, a sub-1s loading time, progress enhancement for features, and WCAG 3.1 AAA accessibility (maybe.. at least AA though) because doing that isn't any more effort than not doing it.

embedding-shape3 replies#
> That's fine though. Progressive enhancement, adding features to a site when they're available but still offering a working site when they're not, is how we should build web sites.

Alright, that's fine and dandy. Is this the actual results of using this skill though that is being advertised here? Is it asking the agent to also make sure it's "Progressive enhancement" so the same stuff more or less works in Firefox and Safari?
If not, your whole point is kind of moot, as you have someone from Google trying to get people to write websites that'll look and/or work differently in Chrome compared to other browsers.

atopal#
Not only is it asking the agent, the guides themselves spell out how to make a fallback work in unsupported browsers. That's not just Firefox and Safari, if it's a Chrome only feature older versions of Chrome might not support it either. Here's an example: https://github.com/GoogleChrome/modern-web-guidance-src/blob...

Unless you have specified something different, by default the skill assumes you are targeting Baseline Widely Available, which means everything has to work in all major browsers from at least 2.5 years ago.

onion2k#
Progressive enhancement isn't new. It's a concept from the days of IE and Netscape, and it's how we should all have been building website for the past 3 decades.
kevin_nisbet#
I tried the skill as an experiment, and while it did give a suggestion that had poor support, it also suggested the library version as fallback (using Temporal). So if that's universally applied it might not be so unreasonable, but I don't do much frontend dev to know whether it's worth the risk or not.
Cthulhu_2 replies#
I've looked up a few on MDN and they're all listed as experimental, so while they may work in Chrome they're not web standards; I hope everyone prompts their agents to avoid experimental features. That said I'm disappointed this tool seems to recommend using them anyway.
tgv#
It's proposed by a Google team. That privacy data isn't going to fly to their data stores by itself. So of course they want to thwart Firefox and Safari.
atopal#
Unless you have specified something else, Modern Web Guidance assumes that you are targeting Baseline Widely Available, meaning all major browsers going back 2.5 years. Everything has to either be a progressive enhancement or have a fallback that works in those browsers. Otherwise you have to explicitly ask for that feature. This is a policy that was worked out with Microsoft Edge and Mozilla Firefox, who are also contributing to the skill.
Arubis#
The proportion of sites that I have to swap out of Firefox to use has gone from "every couple of weeks" to "multiple times weekly" lately, mostly among clearly AI-coauthored sites. I wonder if this is part of why.