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.
Documentation · Eval Dashboard · Source Code · Report an Issue
npx modern-web-guidance@latest installThis command runs an interactive wizard to install Modern Web Guidance. See Alternative Installation Methods below.
# 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 .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. 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.
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.
|
Smooth visual states (View Transitions, entry/exit animations, parallax scroll, CSS |
Modern layout systems (container queries, |
Speed optimizations (instant preloading, Interaction to Next Paint (INP) diagnostics, and scheduling tasks via |
|
Native components (Anchor Positioning for tooltips, Popover API, dialogs, |
Important considerations (screen reader and keyboard operability, content navigation and discoverability). |
Local client models (native translation, summarization, and language detection APIs). |
View an example: the navigation-drawer guide.
262 modern web features
204 real-world developer use cases
- accessible-error-announcement: Synchronize programmatic accessibility states (like aria-invalid) with the visual :user-invalid state to ensure screen reader users receive error feedback only after interaction, mirroring the visual experience.
- accessible-generated-content: Use CSS generated content (
::before/::after) in ways that stay accessible, including alternative text for decorative content. - respect-os-text-scale: Respect the operating system's text scale preference for a page so font sizes, layout, and rem-based measurements follow the user's accessibility settings.
- language-detection: Detect the language of user-generated content or already present site content.
- language-model: Run on-device natural language inference in the browser using the Prompt API, with streaming output, structured JSON responses, and multi-turn session management.
- summarizer: Summarize text content using the on-device Summarizer API.
- translator: Translate text between languages using the on-device Translator API.
- animate-to-intrinsic-sizes: Smoothly animate interactive components (like accordions, menus, and expanding cards) to and from their natural dimensions.
- atrule-support-conditionals: Conditionally apply certain CSS rules or declarations only if a certain at-rule is supported by the browser.
- calculate-with-intrinsic-sizes: Calculate the size of an element based on its intrinsic size, while ensuring it fits within given design constraints.
- child-state-based-styling: Build a component that changes its styling based on the state of one of its child elements. For example, a component that renders in light or dark mode based on whether a theme toggle is checked (or not).
- content-based-styling: Build a component that changes its layout based on whether it contains specific child elements (or not). For example, if the component contains an image, use a multi-column layout, otherwise default to a single-column layout.
- css: Action-oriented guidelines for modern CSS architecture, including the cascade, selectors, scoping, nesting, and design tokens. Use this guide when authoring styles or managing design systems.
- css-layout: Modern CSS layouts such as flexbox, grid, subgrid, container queries, anchor positioning, and intrinsic sizing. Use this skill when architecting responsive UI components or page layouts.
- design-token-reactivity: Define higher-order design tokens, like density modes (compact, comfortable, spacious) or themes and have descendant components react to changes directly and in component-appropriate ways.
- dynamic-sibling-styling: Create dynamic visual spectrums or layout arrangements that automatically adapt to the number of elements in a group.
- fluid-scaling: Scale items like font size, spacing, and media sizes smoothly based on the parent container's size rather than using fixed breakpoints
- individual-transform-properties: Animate or override individual CSS transform properties (e.g. translate, rotate, scale) independently of other transform properties on a single element.
- overflow-clipping-control: Adjust the visible clipping boundary of an element to align with the content edge, padding edge, or border edge—or a specified offset from any of these—offering finer-grained control over how content is clipped.
- reduce-style-repetition: Reduce excessive style repetition by encapsulating complex or dynamic styling logic into reusable functions (such as a function that computes a gradient based on a set of input parameters).
- responsive-design: Build UI that adapts to container and viewport size, including container queries, dynamic viewport units, aspect ratios, and responsive typography.
- selector-atrule-combinations: Target elements based on the intersection or union of selectors and conditional @-rules while minimizing repetition.
- size-aware-styling: Build a component whose styles can be conditionally dependent on its own width or height, rather than the width or height of the viewport. For example a card component that can change its layouts depending on how large it is, or a call-to-action button that can conditionally display helper text based on its width.
- style-parent-with-has: Style parent elements of a form field (e.g. labels or fieldsets) when the field is invalid.
- usage-aware-component-variations: Build components that adapt visual logic based on semantic context using CSS container style queries.
- animated-select-picker: Create a custom select component whose dropdown is animated. For example, the menu fades or slides into view, or the options animate upon selection.
- autofill-address-form: Build an address form with correct autocomplete attributes and autofill support.
- autofill-highlight-inputs: Customize the styling of form fields that have been autofilled and not edited by the user
- autofill-payment-form: Build a payment form that collects card details with correct autocomplete values and autofill support.
- autofill-sign-in-form: Build a sign-in form with correct autocomplete values and autofill support.
- autofill-sign-up-form: Build a sign-up form with correct autocomplete values and autofill support.
- brand-consistent-forms: Match checkboxes, radio buttons, range sliders, and progress bars to your site's color palette without replacing them with custom components.
- branded-select-styling: Create custom select elements whose button, picker, arrow icon, and checkmark all seamlessly match your brand or design system's typography, colors, spacing, and border treatments.
- custom-select-picker-layouts: Create custom select pickers whose options are positioned in unique or interesting ways, rather than the traditional stacked list of options.
- form-fields-automatically-fit-contents: Allow form fields to grow and shrink to fit the user input, e.g. as the user types or selects a different option. Apply maximum and minimum size limits to create dynamic and responsive form fields that conform with the page design.
- ime-safe-enter-submit: Implement Enter-to-submit in textareas and single-line inputs (chat, search, inline rename) safely for IME (Input Method Editor) users to prevent submitting incomplete text.
- required-field-feedback: Provide error message for required form fields that were skipped or left empty only after user interaction, to avoid preemptive errors and ensure feedback is timely and contextually relevant to the user's flow.
- rich-media-picker: Create a custom select component whose options can contain complex HTML formatting (e.g. images, icons, and other rich formatting) rather than just plain text.
- select-menu-interaction: Validate that a non-default option has been chosen in a select menu only after the user has interacted with the control.
- slider: Style a native range slider with custom track, thumb, fill, and focus states while preserving native functionality and accessibility.
- sms-otp-form: Verify user phone nu
README truncated — open on GitHub for the full file.

