Show HN: Get your coding agent off ~2019 JavaScript, onto modern web primitives
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Modern Web Guidance is a set of skills that embed web platform expertise, best practices, and browser compatibility data directly into your coding agents. It helps to steer your coding agents away from legacy patterns, and instead toward solutions that harness the power and capabilities of the modern web platform. Stewarded by the Google Chrome, Microsoft Edge, Mozilla Firefox, and MDN teams, alongside the web development community.
Modern Web Guidance 是一套将 Web 平台专业知识、最佳实践和浏览器兼容性数据直接嵌入到编码代理中的技能。它有助于引导编码代理远离遗留模式,转而采用能够利用现代 Web 平台强大功能和特性的解决方案。该项目由 Google Chrome、Microsoft Edge、Mozilla Firefox 和 MDN 团队以及 Web 开发社区共同管理。
Documentation · Eval Dashboard · Source Code · Report an Issue Quickstart npx modern-web-guidance@latest install This command runs an interactive wizard to install Modern Web Guidance. See Alternative Installation Methods below. Try it out (without installing) # Search for relevant guides npx modern-web-guidance@latest search “animate a dialog modal backdrop” # Retrieve a guide by ID npx modern-web-guidance@latest retrieve “animate-to-from-top-layer” # Scan a codebase for legacy patterns to modernize npx modern-web-guidance@latest legacy-scan .
文档 · 评估仪表板 · 源代码 · 报告问题 快速入门 npx modern-web-guidance@latest install 此命令将运行一个交互式向导来安装 Modern Web Guidance。请参阅下方的其他安装方法。试用(无需安装) # 搜索相关指南 npx modern-web-guidance@latest search “animate a dialog modal backdrop” # 通过 ID 获取指南 npx modern-web-guidance@latest retrieve “animate-to-from-top-layer” # 扫描代码库以查找需要现代化的遗留模式 npx modern-web-guidance@latest legacy-scan .
Why? Coding agents often default to older patterns because LLM training data contains vast amounts of legacy code. This often leads them to generate bloated JavaScript for tasks that now have native, high-performance web platform solutions. Even if a model knows an API exists, it often lacks the density of real-world, modern implementation patterns required for production-ready code. Modern Web Guidance bridges this gap.
为什么?编码代理通常会默认使用旧模式,因为大语言模型(LLM)的训练数据中包含大量的遗留代码。这往往导致它们为那些现在已有原生、高性能 Web 平台解决方案的任务生成臃肿的 JavaScript 代码。即使模型知道某个 API 的存在,它通常也缺乏生产级代码所需的、高密度的现实世界现代实现模式。Modern Web Guidance 弥补了这一差距。
Our skill’s CLI returns targeted, expert-curated guidelines directly into your agent’s context window, focusing on: Modern Browser APIs: Helping models correctly structure APIs they frequently misuse. Performance & Accessibility: Preferring platform-level APIs that can be optimized by the browser and include built-in accessibility affordances. Responsible Fallbacks: Guiding models to use sensible, lightweight fallbacks instead of heavy polyfills or legacy libraries.
我们技能的 CLI 会将由专家策划的针对性指南直接返回到代理的上下文窗口中,重点关注:现代浏览器 API:帮助模型正确构建它们经常误用的 API。性能与可访问性:优先使用可由浏览器优化并包含内置可访问性功能的平台级 API。负责任的降级方案:引导模型使用合理、轻量级的降级方案,而不是沉重的 Polyfill 或遗留库。
What’s Included? We cover the past several years of the web platform’s new features, all the way up to the cutting edge. The guides are designed to be token-efficient; we run evals enabling us to prune lowest-common-denominator content that models already know.
包含什么?我们涵盖了过去几年 Web 平台的新功能,一直到最前沿的技术。这些指南旨在实现 Token 高效;我们通过运行评估来剔除模型已经掌握的“最低共同分母”内容。
Core Disciplines 🎨 User Experience Smooth visual states (View Transitions, entry/exit animations, parallax scroll, CSS scrollbar-color). 📐 CSS Layout Modern layout systems (container queries, subgrid, modern color spaces like oklch, text-wrap tuning, and line-height trimming). ⚡ Performance Speed optimizations (instant preloading, Interaction to Next Paint (INP) diagnostics, and scheduling tasks via scheduler.yield). 📝 Forms & UI Native components (Anchor Positioning for tooltips, Popover API, dialogs, :user-invalid validation, and auto-sizing fields). ♿ Accessibility Important considerations (screen reader and keyboard operability, content navigation and discoverability). 🤖 Built-in AI Local client models (native translation, summarization, and language detection APIs).
核心领域 🎨 用户体验:平滑的视觉状态(视图转换、进入/退出动画、视差滚动、CSS scrollbar-color)。📐 CSS 布局:现代布局系统(容器查询、子网格、如 oklch 等现代色彩空间、文本换行调整和行高修剪)。⚡ 性能:速度优化(即时预加载、交互到下一次绘制 (INP) 诊断以及通过 scheduler.yield 调度任务)。📝 表单与 UI:原生组件(用于工具提示的锚点定位、Popover API、对话框、:user-invalid 验证和自动调整大小的字段)。♿ 可访问性:重要考量(屏幕阅读器和键盘可操作性、内容导航和可发现性)。🤖 内置 AI:本地客户端模型(原生翻译、摘要和语言检测 API)。