Show HN: Get your coding agent off ~2019 JavaScript, onto modern web primitives
191 points by paulirish 5 hours ago | 56 comments
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/


surround 2 hours ago
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:

  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."
reply
philipwalton 2 hours ago
> 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.

reply
surround 58 minutes ago
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.

reply
philipwalton 29 minutes ago
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.

reply
hackingonempty 24 minutes ago
How about details/summary?
reply
simonw 4 hours ago
Distribution suggestion: in addition to the npm packages you have right now, set up GitHub Pages to publish a markdown index document of the skills at https://googlechrome.github.io/modern-web-guidance-src/skill... (currently a 404)

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.

reply
kinlan 3 hours ago
reply
paulirish 3 hours ago
Aye. I like the idea, Simon. The token cost of the index is high enough I wouldn't suggest the technique for regular use but.. agree that for occasional users it should suffice.

We'll make this happen. :)

reply
kohukohunui 2 hours ago
It looks like the markdown has cross references that assume that the cli approach is used, it would be nice to separate the content from the tooling to access.
reply
jph00 3 hours ago
If you rename that file to "llms.txt" it'll be a bit more discoverable.
reply
kinlan 3 hours ago
yeah that's fair. the infrastructure we are on isn't the most flexible (we will soon move to a newer more custom platform but that's a little way a way)
reply
nico 3 hours ago
> That way I don't have to install anything at all

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

reply
paulirish 3 hours ago
In reality that's pretty much what we got here. Very progressive disclosure centric. There's a 'install' command exists because the ecosystem doesn't have good cross-agent ergonomics for installing skills. (Which bums me out).

But yeah.. big corpus of valuable context × minimal agent footprint = happy place.

reply
mtrovo 3 hours ago
If created properly, skills are already something like that. You have a front matter summary always available to the agent. The agent can request the full skill content on demand, which might contain additional linked documents with details about APIs and schemas being used, deeper documents about niche subtopics, scripts to help with subtasks, etc.
reply
trvz 3 hours ago
What’s the point of modern Javascript without over complicating things?
reply
advisedwang 4 hours ago
Chrome already has too much power in the browser standards world. The last thing we need is everyone's LLMs to follow Chrome team's guidance on how to do web development. This road leads back to "To view this site, please view in [DOMINANT BROWSER]"
reply
philipwalton 3 hours ago
Mozilla Firefox and Microsoft Edge are also contributors to this project, so this is a cross-browser initiative to help improve how agents build for the web.
reply
troupo 12 minutes ago
That's why it seems to skip the most egregious of Chrome-only APIs and focuses on areas where there's large cross-browser agreement.
reply
xnx 3 hours ago
Not my opinion, but I do wonder if sharing from a different repo would feel more neutral.
reply
0o777 3 hours ago
Both Mozilla and the Google Chrome team are part of the Web Baseline project and this project. They only recommend best practices supported by Chrome, Firefox, Edge, and Safari.

https://web-platform-dx.github.io/baseline/

reply
tonymet 11 minutes ago
Let the best API win. why hold them back?
reply
super256 3 hours ago
Calm your pitchfork, Mozilla and Edge are both part of Modern Web Guidance.

https://github.com/GoogleChrome/modern-web-guidance-src/blob...

reply
chalmovsky 2 hours ago
Amazing! I'm just writing an article about how Alex Russell's quote about 'React being a legacy technology' got, unfortunately, totally ignored.

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!

reply
phyzix5761 4 hours ago
"Best Practices" are pretty much dead in the AI era. Pretty soon no one is going to read any of the code AI produces and that's a scary thought.
reply
paulirish 4 hours ago
IMO maintainability is the next frontier. If we just allow coding agents to accrete 1k-LOC solutions to problems, the codebases run quick away from our ability to maintain _some_ level of understanding.

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.

reply
noosphr 45 minutes ago
You just regenerate the code base, like how you do a recompile in C. Writing code is 2026 is worth as much as writing machine code was in 1996.
reply
aidos 2 hours ago
Once again, thank you for all the work you and the team have done to improve the web and the experience for developers working with it.
reply
natorion 4 hours ago
Best practices are not dead if they result in better user experience. The focus is less on developer ergonomics though - true that.
reply
sublinear 4 hours ago
The "modern web primitives" are also not even necessarily the "best practice".

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!

reply
zeroq 2 hours ago
Exactly.

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. :)

reply
brlewis 4 hours ago
>Pretty soon no one is going to read any of the code AI produces and that's a scary thought.

This is a misconception. Have your favorite agent summarize this video for you: https://www.youtube.com/live/zcLPGC-tvgk?si=YR68aHlFESD053bh

reply
ozim 4 hours ago
Ugh it is Uncle Bob, not going to torture AI with this guy.

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.

reply
vik0 4 hours ago
>>Pretty soon no one is going to read any of the code AI produces and that's a scary thought.

>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

reply
brlewis 3 hours ago
I am not generally against using AI to reduce the amount of information you need to pay attention to, and I was not joking. There are multiple places in that interview with good articulation of the reasons why software fundamentals still matter, and what happens when you don't look at at least some of the AI-generated code.
reply
drawfloat 2 hours ago
Why don't you just quote them then? Or quote whatever the LLM you used gave.
reply
cadamsdotcom 3 hours ago
Planning to give this one a wide berth.

The more "legacy code" is getting written everyday the more the web will be forced to remain backwards compatible...

reply
pyrolistical 22 minutes ago
I asked my agent to look at that list and only apply things that work on chrome, Firefox, safari iOS and safari macos

Came up with a good list for my project

reply
internet2000 2 hours ago
NO THANK YOU. Do not want my agents to contribute to the Chrome monoculture. Chrome is the new IE6.
reply
tonymet 10 minutes ago
no it's not. they publish the APIs. IE was bad because ActiveX was proprietary and private.
reply
codepoet80 17 minutes ago
I want the opposite of this. I want compatible code -- which is really hard, when there are so many eras to target. So far AI has done a great job of finding that sweet spot -- why would I want a tool that encourages the agent to write less compatible code?
reply
halflife 4 hours ago
Finally.

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.

reply
fumar 3 hours ago
I added this a few months ago and Claude Doctor has not removed it. It must be working and getting use.
reply
dallen33 2 hours ago
Paul Irish?? There's a name I haven't though about in ages! I remember following you on Twitter and your website was full of amazing information. Hope you're doing well!
reply
gabrieledarrigo 3 hours ago
That's pretty cool!

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.

reply
mococa 38 minutes ago
More Chromish on web? No thanks.
reply
reedlaw 3 hours ago
These skills look better than most, but running my code through the legacy scan only found two issues. So while I still think training beats skills, I'm sure this has its place, especially with weaker models.
reply
paulirish 3 hours ago
Yeah. The legacy scan is tuned to 1) focus on cases where there's a clearly detectable legacy pattern and 2) avoid false-positives. This means it only overlaps with 20% of all the skill's docs. (We'll probably get it to ~50% in another month).

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..

reply
adzm 56 minutes ago
I find this very useful as a human as well
reply
tonymet 33 minutes ago
I recommend saying "contemporary" or "suggested" for transient proposals like this. Having modern change every few years is ambiguous and cliche .

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.

reply
zeroq 3 hours ago
What's the best way to introduce this to a Gemini chat?
reply
paulirish 2 hours ago
Gemini web? Probably simonw's strat from the top comment.

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.

reply
yh11 2 hours ago
why would you ever use gemini for coding at all
reply
zeroq 33 minutes ago
Argon is not available in agy for Pro users.
reply
j45 3 hours ago
This is a great idea. I think while so much was being built out in the JavaScript ecosystem, awareness about the equivalent feature releases that were done to HTML, CSS, web components, and other technologies didn't keep pace.

Of course, it's not perfectly implemented the same in every browser, but that's nothing new.

reply
k0morebi 2 hours ago
[dead]
reply
theresanagent 2 hours ago
[flagged]
reply
Cloudtheboi 3 hours ago
[flagged]
reply
KallowayThayer 3 hours ago
[flagged]
reply
PenguinRevolver 3 hours ago
I use Firefox after Chrome decided to become a bit of a pain to use on my powerful computers. I was unsure how bias the skills were for Chrome exclusive features, so I decided to ask ChatGPT to analyse the repo. I liked the answer it gave, so here it is: https://chatgpt.com/share/6af3712a-03cc-83eb-ad1f-66dd11c886...
reply
cyanydeez 4 hours ago
I treat all my code as some kind of stochastic machinery. So atleast one stage, I'd just tell an agent to go through and follow the guide.

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.

reply