250 points paulirish 6 hours ago 71 comments
Models know about some of these by name, but consistently won't default to using the platform-native solution and instead prefer the incumbent <div>+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
phyzix5761 6 hours ago | parent
natorion 6 hours ago | parent
paulirish 6 hours ago | parent
So I'll take a 1-line CSS solution over 60 lines of ResizeObserver/setTimeout business. But.. best practices for frontend isn't just the code.. it's ensuring quality UX, that keyboard navigability works, that layout doesn't shift on users.
aidos 4 hours ago | parent
noosphr 3 hours ago | parent
brlewis 5 hours ago | parent
This is a misconception. Have your favorite agent summarize this video for you: https://www.youtube.com/live/zcLPGC-tvgk?si=YR68aHlFESD053bh
ozim 5 hours ago | parent
But the fun part is that all of the proper software engineering practices are aimed at lowering amount of context a developer has to keep in his mind. So it directly applies to agent context. Less verbose code, less tokens to burn, separation of concerns, lower chance agent breaks something unrelated etc.
vik0 5 hours ago | parent
>This is a misconception. Have your favorite agent *summarize this video for you*: https://www.youtube.com/live/zcLPGC-tvgk?si=YR68aHlFESD053bh
I can't tell if you're joking here
brlewis 5 hours ago | parent
drawfloat 4 hours ago | parent
sublinear 5 hours ago | parent
Browser-specific implementation gotchas tend to take about a decade to iron out for reasons that never have anything to do with code quality. Users are fickle and so are browser vendors, but that's a different topic.
At the end of the day, there's just no escaping lots of manual testing across device and browser combinations if your goal is a polished result and not just something that "works".
AI has done nothing to make this problem go away. If anything, it's made it worse because people don't even want to look at the code now!
zeroq 4 hours ago | parent
I've recently finished a browser game specifically targeting an old iPad Air 1 we had lying around the house.
I had a working version after a weekend, but it took me a month to make it run smoothly on an over 10 years old mobile device. And the most recent browser available is almost 10 years old.
Surprisingly I didn't missed too many "modern" JS features, as these were mostly functional programming oriented which doesn't play well with optimization anyways, and the ES6 was more than enough as a programming platform.
Anyway, what I'm trying to say is that "the best practice" should be making your apps fast and accessible - as much as you can without having to sacrifice something you value - instead of chasing the latest and shiniest.
Don't be a fashion driven developer. :)
halflife 6 hours ago | parent
This is exactly what I need when I need it. The amount of pull requests I reviewed with a mess of codes that can be switched to 2 lines of modern features made me write such tools myself, only half assed since I have other things to do.
cyanydeez 5 hours ago | parent
But I'd not inject all this fluff into the wheels of the machine because it'd just take the "average" of these practices which would be just as useless.
simonw 5 hours ago | parent
That index page should link to plain markdown versions of all of the documents, and should be designed for search with grep to find the right answers.
That way I don't have to install anything at all - provided my agent has the ability to make HTTP requests I can tell it "Look for tips on https://googlechrome.github.io/modern-web-guidance-src/skill..." and it will fetch the index, then navigate to the most relevant documents - no MCP or npm or installation required at all.
trvz 5 hours ago | parent
kinlan 5 hours ago | parent
(we could make this clearer though)
paulirish 5 hours ago | parent
We'll make this happen. :)
kohukohunui 4 hours ago | parent
nico 5 hours ago | parent
It feels that something like this would be the holy grail of agents. A small agent that has only the minimum necessary built in knowledge. The rest, it just retrieves on the fly when it needs (+ caching)
It’s like storing pointers/links instead of the contents
paulirish 5 hours ago | parent
But yeah.. big corpus of valuable context × minimal agent footprint = happy place.
mtrovo 4 hours ago | parent
advisedwang 5 hours ago | parent
philipwalton 5 hours ago | parent
troupo 2 hours ago | parent
philipwalton 55 minutes ago | parent
Also Mozilla only joined in the last few weeks, so they haven't yet had a big influence on the project (though I expect they will going forward).
super256 5 hours ago | parent
https://github.com/GoogleChrome/modern-web-guidance-src/blob...
0o777 5 hours ago | parent
xnx 4 hours ago | parent
tonymet 2 hours ago | parent
girvo 46 minutes ago | parent
tonymet 17 minutes ago | parent
Google hardly has a monopoly. The app experience is very diverse. If anything, Apple is much more anticompetitive than Google.
Or is it that you resent any success?
Google gives away Chromium for free. Microsoft & Linux distros use it.
Thanks, this is one of the most laughable comments of the day.
zeroq 5 hours ago | parent
paulirish 4 hours ago | parent
There's a plugin for Antigravity that's listed on initial setup (yay bundleware! :) but... yeah if you're using consumer gemini, i'd switch to the Tasks mode because it's more agentic nature helps.
In fact I just did this and it works. :p It regular Gemini, it said it did but kinda liked :) So there it'd be
> Create a perfect HTML contact form with address fields. Check https://developer.chrome.com/docs/modern-web-guidance/guides... — read completely, don't stop at truncation.
fumar 5 hours ago | parent
reedlaw 5 hours ago | parent
paulirish 5 hours ago | parent
In short: I 100% understand your disappointment. :) More coming soon like finding cases to update with Promise.withResolvers, the Array iterators, Object.groupBy, URLSearchParams, etc..
j45 5 hours ago | parent
Of course, it's not perfectly implemented the same in every browser, but that's nothing new.
cadamsdotcom 5 hours ago | parent
The more "legacy code" is getting written everyday the more the web will be forced to remain backwards compatible...
PenguinRevolver 5 hours ago | parent
gabrieledarrigo 5 hours ago | parent
On the other hand, a bit sad: programming nowadays is just arranging a bunch of Markdown files, possibly generated by another bunch of models.
Not so exciting, in the end.
chalmovsky 4 hours ago | parent
And now this just fell in my lap! Some of the arguments I wanted to make seem to be provide here. Didn't have a chance to take a proper look at it, but it looks very promising and nice!
Thank you!
surround 4 hours ago | parent
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."philipwalton 3 hours ago | parent
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.
surround 3 hours ago | parent
"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.
philipwalton 3 hours ago | parent
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.
cma 2 hours ago | parent
philipwalton 1 hour ago | parent
Regarding corporate incentives: I was involved in the design of this API, so I know the history. It was proposed many years ago as a solution to make it easier for RUM analytics providers to measure Core Web Vitals metrics that needed to account for more than just page load (e.g. layout shifts and slow interactions can happen any time, not just during page load).
The RUM providers we worked with were reluctant to wait until page unload to send telemetry data because it resulted in too many lost beacons, so what they do instead is send beacons every few seconds with the most up-to-date payload.
The `fetchLater()` API enables them to send just one beacon, which is good for users and also reduces their server load.
hatthew 2 hours ago | parent
lelandfe 27 minutes ago | parent
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...
hackingonempty 3 hours ago | parent
philipwalton 1 hour ago | parent
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).
dallen33 3 hours ago | parent
adzm 3 hours ago | parent
mococa 3 hours ago | parent
tonymet 3 hours ago | parent
These concepts are new, so no one knows if they are any good. They're not modern -- who knows if they will even be put to use?
"contemporary", "proposed", "suggested", "compatible" are better fit. I wouldn't dare use "advanced" because many APIs and proposals actually regress earlier behavior.
pyrolistical 3 hours ago | parent
Came up with a good list for my project
codepoet80 2 hours ago | parent
SoftTalker 1 hour ago | parent
Keep your effing websites simple.
SoftTalker 1 hour ago | parent
Good god.
paulirish 1 hour ago | parent
We built rigorous tests to verify this actually works, and to know when models no longer need the advice.
rewgs 49 minutes ago | parent
dazhbog 1 hour ago | parent
ggregoire 7 minutes ago | parent