Modern Web Guidance
JetBrainsOfficialCreated by Google ChromeDistributed by JetBrains
- Skill
- Tool integration
- Software development
- Apache-2.0
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured way to access up-to-date web development patterns, ensuring that implementations follow modern standards rather than relying on potentially outdated training data. It covers a wide range of frontend topics including UI components, performance optimization, browser APIs, and form handling. By integrating this tool, developers can search for specific use cases and retrieve detailed, framework-agnostic guides that include browser support and fallback recommendations.
What it does
- Searches for standardized web development patterns and best practices.
- Retrieves detailed implementation guides for specific frontend use cases.
- Provides guidance on browser compatibility and necessary fallbacks.
- Helps avoid ad-hoc solutions and unnecessary dependency bloat.
- Supports modern web features like container queries, view transitions, and performance APIs.
When to use it
- At the beginning of any frontend feature implementation.
- Before creating new components to check for existing standardized patterns.
- When evaluating the browser support requirements for modern web features.
- When needing to implement performance optimizations like LCP or content-visibility.
Advantages
- Ensures use of current, recommended web development practices.
- Reduces technical debt by discouraging ad-hoc implementations.
- Provides clear guidance on handling browser compatibility and fallbacks.
- Promotes the use of native browser capabilities over heavy external dependencies.
Usage examples
- “I need to implement a modal using modern web standards. What is the best approach?”
- The agent searches for modal-related guides and retrieves the recommended implementation pattern, including any necessary browser fallbacks.
- “How can I optimize the loading priority of my LCP images?”
- The agent searches for image optimization guides and retrieves the specific instructions for using fetch priority to improve performance.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/jetbrains/modern-web-guidance/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip modern-web-guidance.zip -d .agents/skills
Documentation by Google Chrome
Modern Web Guidance
A skill to search for specific web development use cases and retrieve their corresponding best practice guides.
When to use
Must use this skill:
At the start of implementing any web feature.
Before creating a new component, to check if a standardized pattern already exists.
To avoid implementing ad-hoc solutions or loading large dependencies unnecessarily.
Usage Instructions
Step 1. Search Use Cases
Search with an action-oriented query summarizing what you want to achieve using the search command. Run modern-web-guidance directly with npx.
npx -y modern-web-guidance@latest search "<query>" --skill-version 2026_05_16-c5e7870Example Output:
[
{
"id": "optimize-image-priority",
"description": "Optimize the loading priority of Largest Contentful Paint (LCP) candidate images.",
"category": "performance",
"featuresUsed": [ "Fetch priority" ],
"tokenCount": 985,
"similarity": 0.7289
},
{
"id": "defer-rendering-heavy-content",
"description": "Reduce rendering times in content-heavy web pages by deferring rendering for offscreen content.",
"category": "performance",
"featuresUsed": [ "content-visibility", "hidden=\"until-found\"" ],
"tokenCount": 1250,
"similarity": 0.6961
}
]Note: If search results are vague, return no matches, or show low similarity scores, run the
listcommand to browse all guides:npx -y modern-web-guidance@latest list
Step 2. Retrieve Best Practices
Once you have a relevant id from the search results, call this script using the retrieve command to get the full guide. You can pass multiple IDs separated by commas.
npx -y modern-web-guidance@latest retrieve "<id>"Example Output:
The markdown content of the guide describing implementation steps...
Using npx
IMPORTANT: on Windows, using
npxmay fail. Usenpx.cmd ...instead.Network access is required for fetching npm packages needed by the task.
If the
npx -y modern-web-guidance…command hangs, you may be offline. Try running again in offline mode:npx --offline ….The
--skill-versionflag is used to determine if this SKILL.md is out of date. If it is, a warning message is logged to stderr.
Guidelines
Always search first to find the most relevant guides.
These guides are usually framework-agnostic; adapt them correctly to your setup.
Do not hallucinate guides or ignore them; they represent the preferred local standard for the user's project.
Interpreting Browser Support & Fallbacks
Default Behavior: All guides assume Baseline Widely available features are safe to use without fallbacks. For features that are not Baseline widely available, you MUST follow the fallback recommendations in the guide, unless the user has specified a custom browser support policy.
Custom Policies: If the user has already defined explicit browser support requirements, use the browser compatibility data in the guide to determine if a fallback can be safely ignored.
For Baseline YYYY targets, a feature satisfies this target if its "Baseline since" date is <= YYYY.
Policy Examples:
"Do not implement feature fallbacks." (for exploratory prototypes of the cutting-edge web)
"Safari 17.4+" (for internal tools targeting macOS or Tauri-based desktop apps)
"Never recommend or implement polyfills; if a Baseline Newly Available feature is required for core functionality, provide a lightweight custom fallback or redesign the approach." (to minimize bundle size and avoid technical debt)
"Assume a modern execution environment where Baseline Newly Available features can be used natively, provided they are strictly feature-detected and degrade gracefully." (for progressive enhancement strategies)
Reactive Policy Discovery: Watch for environmental cues to suggest documenting a policy in CLAUDE.md or AGENTS.md. Suggest this if the developer:
Mentions building for a restricted runtime (e.g., Electron or Tauri).
Explicitly excludes specific targets (e.g., "we don't support Desktop Chrome").
Expresses hesitation about polyfill complexity, bundle size, or performance cost.
Questions if a feature is safe to use without fallbacks.
No defined policy format. This is an example:
**Browser Support:** Allow Newly Available features, but only adopt custom fallback code that adds <= 20 lines and does not require external dependencies.
Files
- ATTRIBUTION.mdAdded by AutoGineer939 B
- LICENSE11.1 KiB
- SKILL.md5.7 KiB
- guides/accessibility/accessibility.md24.0 KiB
- guides/accessibility/accessible-error-announcement.md6.9 KiB
- guides/built-in-ai/language-detection.md3.5 KiB
- guides/built-in-ai/language-model.md7.1 KiB
- guides/built-in-ai/summarizer.md5.9 KiB
- guides/built-in-ai/translator.md5.3 KiB
- guides/css-layout/css-layout.md19.5 KiB
- guides/css/css.md27.0 KiB
- guides/css/highlight-text-ranges.md5.4 KiB
- guides/forms/animated-select-picker.md7.8 KiB
- guides/forms/autofill-address-form.md4.1 KiB
- guides/forms/autofill-highlight-inputs.md2.3 KiB
- guides/forms/autofill-payment-form.md8.5 KiB
- guides/forms/autofill-sign-in-form.md9.9 KiB
- guides/forms/autofill-sign-up-form.md11.0 KiB
- guides/forms/brand-consistent-forms.md8.3 KiB
- guides/forms/branded-select-styling.md5.5 KiB
- guides/forms/custom-select-picker-layouts.md5.0 KiB
- guides/forms/form-fields-automatically-fit-contents.md5.8 KiB
- guides/forms/forms.md13.8 KiB
- guides/forms/required-field-feedback.md6.8 KiB
- guides/forms/rich-media-picker.md6.6 KiB
- guides/forms/select-menu-interaction.md5.6 KiB
- guides/forms/validate-input-after-interaction.md8.6 KiB
- guides/html/html.md17.5 KiB
- guides/passkeys/passkey-authentication.md9.7 KiB
- guides/passkeys/passkey-conditional-create.md6.5 KiB
- guides/passkeys/passkey-management.md9.3 KiB
- guides/passkeys/passkey-reauthentication.md4.9 KiB
- guides/passkeys/passkey-registration.md9.3 KiB
- guides/passkeys/passkeys.md4.2 KiB
- guides/performance/batch-analytics-events.md6.4 KiB
- guides/performance/break-up-long-tasks.md2.1 KiB
- guides/performance/calculate-total-foreground-time.md2.9 KiB
- guides/performance/conditional-async-dependencies.md3.6 KiB
- guides/performance/defer-rendering-heavy-content.md6.3 KiB
- guides/performance/defer-work-until-scroll-ends.md3.3 KiB
- guides/performance/deprioritize-background-fetches.md1.8 KiB
- guides/performance/detect-initial-visibility-state.md4.5 KiB
- guides/performance/efficient-background-processing.md5.0 KiB
- guides/performance/faster-spa-view-transitions.md3.4 KiB
- guides/performance/full-session-analytics.md5.7 KiB
- guides/performance/identify-heavy-scripts.md4.2 KiB
- guides/performance/identify-inp-causes.md5.4 KiB
- guides/performance/improve-next-page-load-performance.md7.1 KiB
- guides/performance/interactions-in-complex-layouts.md3.4 KiB
- guides/performance/optimize-image-priority.md4.0 KiB
- guides/performance/optimize-preload-priority.md3.3 KiB
- guides/performance/optimize-script-priority.md2.6 KiB
- guides/performance/performance.md17.9 KiB
- guides/performance/resolution-optimized-pseudo-elements.md2.3 KiB
- guides/performance/schedule-tasks-by-priority.md2.2 KiB
- guides/performance/sequence-distributed-events.md3.5 KiB
- guides/privacy/privacy.md11.0 KiB
- guides/security/security.md25.2 KiB
- guides/user-experience/adapt-scrollbar-to-contrast-preferences.md3.5 KiB
- guides/user-experience/anchor-positioning-tab-underline.md2.9 KiB
- guides/user-experience/animate-element-entry-exit.md5.0 KiB
- guides/user-experience/animate-to-from-top-layer.md5.5 KiB
- guides/user-experience/animate-to-intrinsic-sizes.md5.3 KiB
- guides/user-experience/apply-webgl-shaders.md9.9 KiB
- guides/user-experience/calculate-event-differentials.md4.4 KiB
- guides/user-experience/calculate-with-intrinsic-sizes.md9.6 KiB
- guides/user-experience/capture-location-agnostic-data.md3.6 KiB
- guides/user-experience/carousel-slide-effects.md8.1 KiB
- guides/user-experience/carousel-snap-highlights.md5.7 KiB
- guides/user-experience/child-state-based-styling.md4.8 KiB
- guides/user-experience/complex-shapes.md3.5 KiB
- guides/user-experience/component-specific-light-dark-theme.md9.3 KiB
- guides/user-experience/consistent-cross-document-transitions.md11.8 KiB
- guides/user-experience/content-based-styling.md5.2 KiB
- guides/user-experience/coordinate-global-events.md3.5 KiB
- guides/user-experience/cross-document-transitions.md4.4 KiB
- guides/user-experience/customize-scrollbar-color-and-thickness.md2.4 KiB
- guides/user-experience/dark-mode.md15.2 KiB
- guides/user-experience/declarative-button-actions.md5.4 KiB
- guides/user-experience/declarative-dialog-popover-control.md9.2 KiB
- guides/user-experience/deliver-optimized-decorative-images.md2.8 KiB
- guides/user-experience/design-token-reactivity.md5.7 KiB
- guides/user-experience/directional-navigation-transitions.md4.9 KiB
- guides/user-experience/dynamic-sibling-animations.md2.6 KiB
- guides/user-experience/dynamic-sibling-styling.md3.6 KiB
- guides/user-experience/export-html-media-from-canvas.md11.2 KiB
- guides/user-experience/expose-canvas-content-to-browser-features.md14.1 KiB
- guides/user-experience/flicker-free-client-side-ab-testing.md8.5 KiB
- guides/user-experience/fluid-scaling.md3.0 KiB
- guides/user-experience/format-human-readable-durations.md4.2 KiB
- guides/user-experience/group-element-transitions.md5.0 KiB
- guides/user-experience/improve-text-layout-and-legibility.md5.1 KiB
- guides/user-experience/individual-transform-properties.md3.6 KiB
- guides/user-experience/interactive-content-in-3d-scenes.md13.3 KiB
- guides/user-experience/interactive-content-reveal.md5.1 KiB
- guides/user-experience/interest-triggered-action-previews.md4.1 KiB
- guides/user-experience/interest-triggered-tooltips.md6.8 KiB
- guides/user-experience/light-dismiss-a-dialog.md3.6 KiB
- guides/user-experience/manage-recurring-intervals.md3.3 KiB
- guides/user-experience/model-partial-time-concepts.md4.2 KiB
- guides/user-experience/move-dom-element-without-losing-state.md2.5 KiB
- guides/user-experience/navigation-drawer.md15.7 KiB
- guides/user-experience/overflow-clipping-control.md8.0 KiB
- guides/user-experience/parallax-scroll-effects.md8.8 KiB
- guides/user-experience/persistent-app-tours.md3.9 KiB
- guides/user-experience/persistent-toast-notifications.md1.8 KiB
- guides/user-experience/persistent-top-layer-ui.md2.2 KiB
- guides/user-experience/physics-based-easing.md5.8 KiB
- guides/user-experience/platform-controls-dismiss-dialog.md2.6 KiB
- guides/user-experience/position-aware-tooltips.md5.9 KiB
- guides/user-experience/precise-text-alignment.md4.7 KiB
- guides/user-experience/prevent-text-wrapping.md2.4 KiB
- guides/user-experience/pull-to-reveal.md4.7 KiB
- guides/user-experience/reduce-style-repetition.md3.9 KiB
- guides/user-experience/resilient-context-menus-and-nested-dropdowns.md4.9 KiB
- guides/user-experience/same-document-transitions.md8.3 KiB
- guides/user-experience/scroll-entry-exit-effects.md7.8 KiB
- guides/user-experience/scroll-position-aware-elements.md3.6 KiB
- guides/user-experience/scroll-progress-indicator.md6.7 KiB
- guides/user-experience/scroll-snap-realtime-feedback.md6.7 KiB
- guides/user-experience/scroll-snap-state-sync.md3.9 KiB
- guides/user-experience/scroll-target-on-load.md3.3 KiB
- guides/user-experience/scrollability-affordance-hints.md3.6 KiB
- guides/user-experience/scrollytelling.md8.3 KiB
- guides/user-experience/search-hidden-content.md6.7 KiB
- guides/user-experience/shaped-cutouts.md7.0 KiB
- guides/user-experience/shrinking-header-on-scroll.md6.3 KiB
- guides/user-experience/size-aware-styling.md2.9 KiB
- guides/user-experience/soft-edge-content-fade.md2.6 KiB
- guides/user-experience/stabilize-reactive-state.md3.5 KiB
- guides/user-experience/stack-drill-down.md32.9 KiB
- guides/user-experience/style-parent-with-has.md6.0 KiB
- guides/user-experience/support-global-calendar-systems.md5.7 KiB
- guides/user-experience/swipe-to-remove.md26.2 KiB
- guides/user-experience/visually-stable-font-fallbacks.md2.9 KiB
- guides/user-experience/visually-stable-mixed-fonts.md2.8 KiB
- guides/user-experience/visually-texture-content.md3.7 KiB
- guides/webmcp/agentic-forms.md5.0 KiB
- guides/webmcp/agentic-javascript-tools.md4.1 KiB
- guides/webmcp/webmcp.md3.7 KiB
guides/performance/performance.md
Critical Rendering Path (CRP) Optimization
The Critical Rendering Path dictates how quickly the browser converts HTML, CSS, and JavaScript into painted pixels.
DOs
DO inline critical CSS: Extract styles necessary for above-the-fold content and inject them directly into the HTML
<head>. Defer the rest of the stylesheet.DO use
asyncordeferfor all non-critical scripts: Prevent JavaScript from blocking the DOM parser. Usedeferfor scripts that depend on the DOM or each other, andasyncfor independent scripts.type="module"is preferred for modern JavaScript and is deferred by default so no need to have an explicitdeferattribute but you can useasyncon independent module scripts.DO split CSS by media queries: Use the
mediaattribute on<link>tags so the browser downloads unused stylesheets (e.g., print styles or desktop styles on mobile) without blocking the render.DO utilize resource hints: Add
preconnectordns-prefetchfor essential third-party domains (e.g., font foundries or API endpoints) to establish early TLS handshakes.
DON'Ts
DON'T use
@importin CSS: This creates sequential request chains that delay the CSS Object Model (CSSOM) construction.DON'T place large, non-critical JavaScript in the
<head>: This halts DOM construction until the script is downloaded, parsed, and executed.DON'T load invisible or unreachable CSS/JS: Ensure build tools apply tree-shaking and CSS minification to drop unreachable code before deployment.
Code Examples
HTML: Deferring Non-Critical CSS & Scripts
<!-- Inline critical styles directly in head -->
<style>
body { margin: 0; font-family: system-ui; }
.hero { min-height: 100vh; }
</style>
<!-- Defer non-critical CSS -->
<link rel="preload" href="non-critical.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="non-critical.css"></noscript>
<!-- Load CSS conditionally based on viewport -->
<link rel="stylesheet" href="mobile.css" media="(max-width: 768px)">
<!-- Defer JavaScript execution -->
<script defer src="app-bundle.js"></script>The Resource Hint Navigator
| Hint | Tool Use Case | Example |
|---|---|---|
preconnect | Resolve TLS/DNS for known third-party APIs | API endpoints, font services |
dns-prefetch | Lean fallback for non-critical third-party origins | Ad servers, analytics fallbacks |
preload | Same-origin asset needed now for rendering | Hero images, render-blocking fonts |
prefetch | Assets needed for next-page navigation | Next-page bundle, detail views |
Single-Sentence Mental Model: "Preconnect for domains, Preload for viewport, Prefetch for futures."
Largest Contentful Paint (LCP) & Resource Fetching
LCP measures the time required to render the largest visible text or image block within the viewport. Optimize LCP by prioritizing visible elements and prepolishing.
DOs
DO use
fetchpriority="high"on the LCP image: Signal to the browser's heuristic engine to elevate the image's priority above scripts and non-critical assets.DO declare the LCP image in standard HTML: Ensure the
<img>tag is present in the raw HTML response so the preload scanner discovers it immediately. Avoid relying on JavaScript to mount the LCP element.DO preload background images acting as LCP: If the LCP element is a CSS
background-image, force early discovery using<link rel="preload" as="image">coupled withfetchpriority="high".DO use
fetchpriority="low"to demote competing elements: Lower the priority of large images or carousels that appear above the fold but are not the primary LCP element.
DON'Ts
DON'T lazy-load the LCP image: Never apply
loading="lazy"to above-the-fold images. This purposefully delays the fetch until layout calculation is complete, severely degrading LCP.DON'T overuse
fetchpriority="high": Prioritization is a zero-sum mechanism. Elevating too many resources creates network contention and negates the benefit.DON'T implement complex JavaScript loaders for the hero section: Client-side rendering of the LCP element introduces substantial request chains (HTML -> JS -> Execution -> Image Request).
Code Examples
HTML: LCP Image Optimization
<!-- Standard LCP Image -->
<img
src="/images/hero.webp"
alt="Hero Product"
fetchpriority="high"
decoding="sync"
width="1200"
height="600"
>
<!-- Preloading a CSS-based LCP background -->
<link rel="preload" as="image" href="/images/bg-hero.webp" fetchpriority="high" type="image/webp">
<!-- Demoting an above-the-fold non-LCP carousel image -->
<img src="/images/carousel-2.webp" fetchpriority="low" alt="Slide 2">Interaction to Next Paint (INP) & Main Thread Unblocking
INP measures the latency of all interactive events across the page's lifecycle. Poor INP is caused by long-running JavaScript tasks blocking the main thread.
DOs
DO break up long tasks: Any JavaScript execution exceeding 50ms should be split. Yield to the main thread frequently so the browser can process pending user inputs.
DO use
scheduler.yield()with a fallback: Utilize the modernscheduler.yield()API to place task continuations at the front of the queue, falling back tosetTimeoutwrapped in a Promise for unsupported browsers.DO debounce or throttle rapid event listeners: Limit the execution frequency of handlers attached to
scroll,resize, or rapidinputevents.DO separate UI updates from heavy computations: Update the UI synchronously to provide immediate visual feedback, then push background processing to a Web Worker or deferred task.
DON'Ts
DON'T rely solely on
setTimeout(..., 0)for continuous yielding: StandardsetTimeoutplaces continuations at the back of the task queue, potentially causing long delays if other tasks are pending.DON'T cause layout thrashing: Avoid interleaving DOM reads (
offsetHeight,getBoundingClientRect) and writes (style.height) within the same loop. Batch DOM reads, then batch DOM writes.DON'T block the thread with recurring timers: Avoid heavy polling with
setIntervalthat starves the main thread.
Code Examples
JS: scheduler.yield Polyfill and Usage
// Polyfill for yielding to main thread
async function yieldToMain() {
if ('scheduler' in window && 'yield' in scheduler) {
return await scheduler.yield();
}
return new Promise(resolve => setTimeout(resolve, 0));
}
// Processing a large array without blocking user input
async function processLargeList(items) {
for (let i = 0; i < items.length; i++) {
processItem(items[i]);
// Yield every 50 iterations to allow rendering/interaction
if (i % 50 === 0) {
await yieldToMain();
}
}
}Main Thread Task Slicing Heuristic
The 50ms Rule for INP:
< 50ms: Execute synchronously.
50ms - 250ms: Slice tasks and yield with
scheduler.yield().> 250ms: Offload to a Web Worker.
Third-Party Script Management
Third-party scripts (analytics, ads, chat widgets) are the primary source of main thread congestion.
DOs
DO avoid third-party scripts blocking main content: Use
deferwith all third-party scripts unless critical to the page load and load them in the footer of the page, rather than the<head>.DO self-host critical third-party dependencies: Reduce DNS lookups and enforce custom
Cache-Controllogic by hosting third-party libraries on the origin domain.
Code Examples
HTML: Third-Party Script Execution
<!-- 1. Place third-party scripts near the end of the page with the defer attribute -->
<script defer src="http://www.example.com/third-party.js"></script>CSS Rendering & Containment Optimization
Rendering involves Layout, Style, Paint, and Compositing calculations. CSS Containment limits the scope of these calculations which is useful on large, complex pages where such calculations can cause performance problems.
DOs
DO use
content-visibility: autoon off-screen sections on large, complex pages: Instruct the browser to skip layout and paint calculations for entire subtrees until they approach the viewport.DO pair
content-visibilitywithcontain-intrinsic-size: Prevent layout shifts and scrollbar jumping by providing a placeholder height/width for unrendered containers.DO apply explicit CSS containment (
contain): For isolated UI components (like modals or widgets), usecontain: layout style paintto prevent internal changes from triggering page-wide reflows.
DON'Ts
DON'T apply
content-visibility: autoon smaller, simpler pages: The gains will be negligible and there are risks of side effects with content jumping.DON'T apply
content-visibility: autoto above-the-fold content: The browser will still evaluate it, but forcing it through the containment engine unnecessarily adds slight overhead to visible elements.DON'T overuse
will-changeglobally: Indiscriminately applyingwill-change: transformto multiple elements consumes excessive VRAM, causing GPU crashes or sluggish rendering.DON'T forget accessibility when hiding elements:
content-visibility: autokeeps elements in the DOM for screen readers. If content should be truly hidden from assistive technology when off-screen, managearia-hiddenattributes manually.
Code Examples
CSS: Content Visibility and Containment
/* Optimize a long list of articles below the fold */
.article-list-item {
content-visibility: auto;
contain-intrinsic-size: auto 600px; /* Provides a 600px placeholder */
}
/* Scope a complex widget to prevent layout thrashing */
.isolated-widget {
contain: layout style paint;
}
/* Hardware accelerate an animation only on hover */
.interactive-button:hover {
will-change: transform;
transform: scale(1.05);
}Modern Image & Media Optimization
Images typically represent the largest payload on a given web page. Optimization requires format negotiation, responsive sizing, and layout stabilization.
DOs
DO serve modern formats (AVIF / WebP): Use the
<picture>element to offer AVIF (best compression), falling back to WebP, and finally JPEG/PNG for legacy browsers.DO apply explicit
widthandheightattributes: Setting native attributes allows the browser to compute the aspect ratio immediately, reserving space and eliminating CLS. Image dimensions may be set either as HTML attributes or CSS properties.DO utilize
loading="lazy"on all below-the-fold images: Utilize native browser lazy loading to defer network requests for images outside the initial viewport.DO implement responsive images with
srcsetandsizes: Serve tailored resolutions based on screen density and viewport width to prevent mobile devices from downloading desktop-sized images.
DON'Ts
DON'T lazy load above-the-fold images: This directly harms LCP. Visible images must use
loading="eager"(the default).DON'T delete necessary dimensions: Failing to specify width/height on lazy loaded images causes layout shifts.
DON'T omit the
sizesattribute when usingsrcset: Withoutsizes, the browser assumes100vwand downloads the largest available image.
Code Examples
HTML: Comprehensive Responsive Image Component
<picture>
<!-- Modern Formats with Source Negotiation -->
<source type="image/avif" srcset="hero-400w.avif 400w, hero-800w.avif 800w" sizes="(max-width: 600px) 100vw, 50vw">
<source type="image/webp" srcset="hero-400w.webp 400w, hero-800w.webp 800w" sizes="(max-width: 600px) 100vw, 50vw">
<!-- Fallback + Dimensions + Priority for Above-The-Fold -->
<img
src="hero-800w.jpg"
alt="Descriptive text"
width="800"
height="600"
fetchpriority="high"
loading="eager"
>
</picture>
<!-- Below-The-Fold Image -->
<img
src="footer-icon.png"
alt="Footer Logo"
width="100"
height="100"
loading="lazy"
>
<!-- DO: Use native lazy loading for below the fold iframes -->
<iframe src="https://example.com/map" width="800" height="600" loading="lazy" title="Example Map"></iframe>Service Workers & Caching Strategies
Client-side caching via Service Workers allows applications to bypass the network entirely, serving resources from disk/memory.
DOs
DO use a
CacheFirststrategy for static, versioned assets: Immutable files (fonts, JS/CSS bundles with hash strings) should be served directly from the cache to guarantee instant loading.DO use
StaleWhileRevalidatefor dynamic, non-critical resources: For API calls where slight staleness is acceptable, serve immediately from cache while silently updating the cache in the background.DO implement a
NetworkFirststrategy for HTML documents: Ensure the user always receives the latest application shell and manifest, falling back to cache only if offline.DO restrict cache sizes and expiry: Use expiration plugins to prevent the Service Worker from exhausting the device's storage quota.
DON'Ts
DON'T cache opaque responses blindly: Responses from third-party domains lacking CORS headers are "opaque". Caching them heavily consumes quota and fails silently. Only cache them using
NetworkFirstorStaleWhileRevalidate.DON'T cache POST requests: Service workers cannot cache non-GET requests natively. Implement background sync queues for offline submissions.
DON'T bypass versioning: Failing to update asset hashes/versions will trap users in infinite cache loops.
Code Examples
JS: Service Worker Caching via Workbox
import { registerRoute } from 'workbox-routing';
import { CacheFirst, StaleWhileRevalidate, NetworkFirst } from 'workbox-strategies';
import { ExpirationPlugin } from 'workbox-expiration';
import { CacheableResponsePlugin } from 'workbox-cacheable-response';
// 1. HTML Documents: Network First
registerRoute(
({ request }) => request.mode === 'navigate',
new NetworkFirst({ cacheName: 'pages-cache' })
);
// 2. Static Assets (JS, CSS, Fonts): Cache First
registerRoute(
({ request }) => ['style', 'script', 'font'].includes(request.destination),
new CacheFirst({
cacheName: 'static-resources',
plugins: [
new CacheableResponsePlugin({ statuses: [0, 200] }),
new ExpirationPlugin({ maxEntries: 50, maxAgeSeconds: 30 * 24 * 60 * 60 })
]
})
);
// 3. API Responses: Stale While Revalidate
registerRoute(
({ url }) => url.pathname.startsWith('/api/v1/content'),
new StaleWhileRevalidate({
cacheName: 'api-cache',
plugins: [
new CacheableResponsePlugin({ statuses: [0, 200] })
]
})
);Web Fonts Optimization
Web fonts are a common source of render blocking. Optimizing them reduces the Flash of Invisible Text (FOIT) and speeds up initial rendering.
DOs
DO preload critical fonts: Use
<link rel="preload" as="font" type="font/woff2" crossorigin>for fonts seen above the fold.DO subset fonts: Trim font weights and glyph variations to include only the characters your application requires.
DON'Ts
DON'T preload all fonts: Over-preloading leads to network contention that starves other critical assets.
Code Examples
CSS: Font Loading Face
@font-face {
font-family: 'Modern Sans';
src: url('/fonts/modern-sans.woff2') format('woff2');
}HTML: Critical Font Preload
<!-- Always use crossorigin for fonts even if on the same origin -->
<link rel="preload" href="/fonts/modern-sans.woff2" as="font" type="font/woff2" crossorigin>Video Performance & Metrics
Video payloads are among the heaviest assets. Optimization focuses on reducing bandwidth stall and preserving Cumulative Layout Shift (CLS) stability.
DOs
DO specify explicit
widthandheightattributes: Setting native dimensions reserves layout space and prevents CLS.DO provide a
posterimage fallback: Display a lightweight image placeholder while the video buffers to improve perceived performance.DO use
preload="none"for non-critical videos: Delay bandwidth consumption for below-the-fold or non-autoplaying videos.DO serve modern formats via source negotiation: Offer WebM (better compression ratio) alongside standard MP4 formats.
DO use
loading="lazy"for offscreen videos: Lazy-loading videos allowposterandpreloaddownloads to be deferred until the video is in or near the viewport.
DON'Ts
DON'T auto-play video files blindly: Rely on user intent or use progressive enhancement streams.
DON'T auto-play large video files at all: Rely on user intent before downloading large files.
Code Examples
HTML: Accessible and Dynamic Video Loader
<video
controls
width="1200"
height="675"
poster="/images/video-poster.webp"
preload="none"
>
<source src="/videos/intro.webm" type="video/webm">
<source src="/videos/intro.mp4" type="video/mp4">
<!-- Include accessibility tracks -->
<track src="/video-caps.vtt" kind="captions" srclang="en" label="English">
</video>JavaScript Code-Splitting
Heavy monolithic bundles block main thread parse times on low-end devices. Splitting ensures we only download bytes required for the immediate viewport.
DOs
DO use dynamic imports: Split routes or heavy UI libraries using standard
import()specifications.DO configure bundler asset chunking: Use Vite or Webpack rollup directives to split third-party vendors from runtime application logic.
DON'Ts
DON'T ship a single, enormous
app.jsbundle: It increases parse time and memory consumption for initial views.
Code Examples
JS: Route based Dynamic Splitting
// Dynamic import of heavy module only when button is clicked
document.getElementById('heavy-btn').addEventListener('click', async () => {
const { heavyFunction } = await import('./heavy-module.js');
heavyFunction();
});Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Google Chrome
- Publisher
- JetBrains (Official)
- Distributed by
- JetBrains
- Source
- JetBrains/skills · modern-web-guidance · commit 3f53782
- Licence
- Apache License 2.0 (redistribution allowed)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google Chrome or JetBrains.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download modern-web-guidance.zip