Browse / 📚 Lists & Skills

modern-web-guidance preview

GoogleChrome

modern-web-guidance

Keep your coding agent up to date with the latest web best practices

Stars
23k
Language
—
Category
📚 Lists & Skills

Modern Web Guidance Logo

Modern Web Guidance

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

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 .

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

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.

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

View an example: the navigation-drawer guide.

The full list

262 modern web features

CSS & Layout (140 features)

::backdrop content-visibility progress()
::details-content contrast-color() reading-flow
::file-selector-button Cross-document view transitions Relative colors
::placeholder currentColor rem
::selection Custom highlights resize (CSS property)
:dir() Custom properties revert
:focus-visible display animation revert-rule
:focus-within Element-scoped view transitions Safe area inset environment variables
:has() em unit Scroll marker target pseudo-classes
:host-context() field-sizing Scroll method promises
:is() filter Scroll snap
:modal flex-wrap: balance Scroll snap events
:not() Flexbox scroll-axis-lock
:nth-child() of <selector> font-size scroll-behavior
:placeholder-shown font-size-adjust Scroll-driven animations
:user-valid and :user-invalid Forced colors scroll-initial-target
:where() Gradient interpolation scroll-target-group
@function Gradients scrollbar-color
@scope Grid scrollbar-gutter
@starting-style Grid lanes scrollbar-width
@supports Hyphenation scrollend
abs() and sign() image-set() scrollIntoView()
accent-color Individual transform properties Shadow parts
Active view transition inherit sibling-count() and sibling-index()
Alt text for generated content initial Sticky positioning
Anchor position container queries Interaction media queries Subgrid
Anchor positioning interpolate-size System colors
Animations (CSS) isolation Text overflow
appearance Lab and LCH Text stroke and fill (compatibility prefixes)
aspect-ratio light-dark() text-box
at-rule() line-clamp text-decoration
attr() line-height text-decoration-skip-ink
background-blend-mode linear() easing text-decoration-skip-ink: all
background-clip: border-area Logical properties text-decoration-skip-spaces
border-radius Masks text-wrap
box-shadow min(), max(), and clamp() text-wrap: balance
calc-size() mix-blend-mode text-wrap: pretty
Cascade layers Nesting transition-behavior
ch unit Oklab and OkLCh Transitions (CSS)
clip-path overflow-clip-margin Trigonometric functions (CSS)
color-mix() overflow-wrap unset
color-scheme overflow: clip user-select
Conic gradients overlay View transitions
Container queries (size) overscroll-behavior view-transition-class
Container scroll-state queries prefers-color-scheme media query Viewport units
Container style queries prefers-contrast media query Web animations
Content prefers-reduced-motion media query

HTML & DOM (37 features)

:autofill <video> HTML-in-canvas
:indeterminate Autonomous custom elements inert
<audio> blocking="render" Interest invokers
<details> Customizable <select> Invoker commands
<dialog closedby> Declarative shadow DOM Lazy-loading media
<dialog> DOM moveBefore()
<input type="checkbox" switch> Email, telephone, and URL <input> types MutationObserver
<input type="range"> Fetch priority Mutually exclusive <details> elements
<input> focusgroup Popover
<link rel="expect"> Form-associated custom elements popover="hint"
<link rel="preload"> hidden="until-found" Shadow DOM
<progress> HTML setter methods
<slot> HTML streaming setters

JavaScript & APIs (85 features)

<install> HTML processing instructions Sanitizer API
<meta name="text-scale"> image() Scheduler API
<template for> inputmode Small, large, and dynamic viewport units
AbortController and AbortSignal integrity() for url() Soft navigation performance entries
AbortSignal.any() Interaction contentful paint performance entries Speculation rules
AbortSignal.timeout() Intersection observer structuredClone()
ARIA attribute reflection Intl.DurationFormat Subresource integrity
ariaNotify() Keyboard events Summarizer
Array by copy Language detector SVG
Array findLast() and findLastIndex() LanguageModel Temporal
Array grouping Lazy-loading images and iframes Text encoding and decoding
Async clipboard light-dark() image values text-decoration-inset
autocorrect Local network access text-fit
beforeinstallprompt Long animation frames performance entries Top-level await
border-shape long-animation-frames-style-layout touch-action
Connection allowlists Navigation API Translator
corner-shape navigator.install() Trusted types
Credential management Origin URL
cross-origin() for url() Page visibility User agent client hints
document.modelContext Page visibility state performance entries Web app manifest
email-verification Partitioned cookies Web app origin migration
enterkeyhint Password credentials Web authentication
Error cause Permissions policy Web authentication signal methods
Event timing performance entries Pointer Events Web Cryptography
Events Promise.withResolvers() WebAssembly
Federated credential management Referrer policy webcrypto-modern-algos
Fetch referrer-policy() for url() WebOTP
fetchLater Registered custom properties
Form-associated WebMCP attributes Resize observer
204 real-world developer use cases

accessibility

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

built-in-ai

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

css

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

forms

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

More in 📚 Lists & Skills

8.4k

cporter202

API-mega-list

This GitHub repo is a powerhouse collection of APIs you can start using immediately to build everything from simple automations to full-scale applications. One of the most valuable API lists on GitHub—period. 💪

Indiesiders