HN
Today

Show HN: Get your coding agent off ~2019 JavaScript, onto modern web primitives

AI coding agents often churn out web code that's stuck in the past, thanks to their training data being full of legacy patterns. This new tool, developed in collaboration with major browser vendors, aims to rectify that by feeding agents up-to-date best practices for modern web primitives. Hacker News is buzzing about its potential to clean up AI-generated frontend code and the perennial debate around browser compatibility.

354
Score
106
Comments
#6
Highest Rank
19h
on Front Page
First Seen
Nov 10, 6:00 PM
Last Seen
Nov 11, 12:00 PM
Rank Over Time
97688911121213131620181819201920

The Lowdown

Modern Web Guidance is an open-source initiative designed to upgrade the web development knowledge of AI coding agents. It tackles the common problem where large language models (LLMs) tend to produce outdated or verbose JavaScript for tasks that now have simpler, native browser solutions.

  • The Problem: LLMs are trained on vast amounts of historical code, leading them to prefer incumbent, often inefficient, JavaScript-heavy patterns (e.g., div+JS for dialogs) over modern web platform features (like <dialog> or CSS.highlights).
  • The Solution: This project provides a CLI tool and skill set comprising over 200 expert-curated guides on contemporary web APIs, CSS layouts, performance optimizations, accessibility, and more. It helps agents correctly structure and utilize these modern features.
  • Technical Details: The system uses an efficient, local semantic search engine (embedding model + BM25) to match agent queries to relevant guides, delivering targeted knowledge directly into the agent's context window without external network calls or API keys.
  • Evaluation & Impact: Through rigorous evaluation infrastructure, the project demonstrates significant improvements in agent performance. Agents jump from a 55% pass rate on web tasks to 92% when guided by Modern Web Guidance, based on extensive Playwright/AST-based assertions.
  • Collaboration: Stewarded by Google Chrome, Microsoft Edge, Mozilla Firefox, and MDN teams, it aims to be a cross-browser effort.
  • Features: It includes a 'legacy-scan' feature, trained on 30k GitHub repos, to identify and suggest modernizations for old coding patterns.

In essence, Modern Web Guidance seeks to bridge the knowledge gap for AI coding agents, pushing them towards generating more efficient, accessible, and performant web applications leveraging the full power of the modern web platform.

The Gossip

Monoculture Mayhem & Chrome Concerns

A significant portion of the discussion revolves around the fear that this project, despite its multi-vendor collaboration (Chrome, Edge, Firefox, MDN), could inadvertently reinforce Chrome's dominance. Critics voice concerns that directing AI agents via Google-led guidance might lead to a 'Chrome monoculture,' reminiscent of the IE6 era, where web development effectively targets a single browser. Supporters, however, point to the explicit involvement of Mozilla and Microsoft, emphasizing it as a cross-browser initiative focused on widely accepted standards rather than Chrome-specific APIs.

Compatibility Conundrums & Feature Fights

Commenters debated the project's stance on browser compatibility. Some expressed worry that the tool might encourage AI agents to use cutting-edge features primarily supported by Chrome, leading to less compatible code. A list of Chrome-stable but Firefox/Safari-unsupported features was shared. The project's proponents clarified that the guides document feature usage, provide full browser support tables, and often include fallback strategies, allowing agents (and developers) to make informed decisions based on their specific compatibility requirements. The concept of progressive enhancement was also brought up as a valid approach.

Distribution Dilemmas & Access Avenues

Several users offered suggestions for distributing the guidance more effectively, particularly for agents. The idea of publishing the markdown guides directly via GitHub Pages or a simple HTTP-accessible index was popular. This would allow agents to fetch relevant information on-the-fly without needing to install npm packages, potentially reducing token costs and improving flexibility. The author acknowledged this as a good idea and indicated they would work on providing such direct access, noting that the current CLI-centric approach was partly due to evolving agent ecosystem ergonomics.

AI & Agile Code Quality

The advent of AI coding agents sparked a philosophical discussion on the relevance of 'best practices' and code quality. Some commenters posited that 'best practices' are dead, believing that AI-generated code will increasingly go unread, leading to unmaintainable, bloated codebases. Others argued that best practices, especially those leading to better UX, accessibility, and maintainability, are more crucial than ever. They emphasized that AI should produce concise, understandable code (like a 1-line CSS solution over 60 lines of JS) to prevent codebases from spiraling beyond human comprehension.

Practical Ponderings & Tool Testaments

Users provided early feedback and raised practical questions about the tool. Some found the skill expensive in terms of tokens for continuous use with agents. Others noted that the 'legacy-scan' feature, while promising, was not yet comprehensive enough to detect all outdated patterns in their codebases. There was also appreciation for the tool's utility for human developers, not just AI. Suggestions included making the legacy scan more robust and offering versions of the guidance tailored to specific browser support targets to further reduce agent reasoning overhead and token expenditure.