web-best-practices
Skill1 starsChanged 7 months agoMITView on GitHub
Web interface quality guidelines for building, reviewing, and improving browser-based user interfaces. Use when working on frontend UX, accessibility, interactions, forms, animation, layout, content, performance, responsive behavior, or visual polish for web apps and sites.
In this repository3 other files it gives its agents.
- react-best-practicesSkill
- script-creatorSkill
- typescript-guidelinesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
66 rules. About 0 are common, 53 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈53
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Use this skill to build and review high-quality web interfaces that are accessible, responsive, performant, resilient, and pleasant to use.
- Distinctive: line 21
Use this skill when:
- Distinctive: line 29
Do not use this as a substitute for project-specific design systems, product voice, accessibility requirements, or performance budgets.
- Distinctive: line 33
Prefer native browser semantics before custom behavior.
- Distinctive: line 37
Keep performance work user-centered: responsiveness, layout stability, fast feedback, and low input latency matter more than abstract …
- Distinctive: line 38
Verify on real browser constraints, especially mobile Safari, desktop Safari, throttled CPU/network, zoom, and reduced motion.
- Distinctive: line 42
Ensure every flow works with keyboard only and follows WAI-ARIA Authoring Practices where applicable.
- Distinctive: line 46
Never disable browser zoom.
- Very specific: line 47
Never block paste in input or textarea.
- Distinctive: line 48
Keep hydrated inputs from losing focus or value.
- Very specific: line 49
Use a or framework link components for navigation.
- Distinctive: line 53
Use optimistic updates when success is likely.
- Very specific: line 55
Use touch-action: manipulation on controls when needed to avoid double-tap zoom issues.
- Distinctive: line 56
Avoid dead zones: if something looks interactive, the whole visible control should be interactive.
- Distinctive: line 63
Avoid spinner flicker by adding a short show delay around 150-300 ms and a minimum visible time around 300-500 ms.
- Distinctive: line 64
Use skeletons only when they mirror the final layout closely enough to avoid layout shift.
- Very specific: line 65
Use ellipses for actions that require more input, such as Rename…, and for active progress states such as Loading….
- Distinctive: line 66
Prefer inline help over tooltips.
- Distinctive: line 72
Prefer CSS animations, then the Web Animations API, then JavaScript animation libraries only when needed.
- Very specific: line 74
Avoid animating layout-affecting properties such as width, height, top, and left unless the tradeoff is deliberate.
- Very specific: line 75
Never use transition: all.
- Distinctive: line 78
Prefer input-driven animation over autoplay.
- Distinctive: line 85
Use optical alignment when perception beats geometry, including small 1 px adjustments.
- Distinctive: line 87
Verify layouts on mobile, laptop, and ultra-wide screens.
- Distinctive: line 90
Prefer CSS flex, grid, and intrinsic layout over measuring layout in JavaScript.
- Very specific: line 95
Keep page <title> accurate to the current context.
- Very specific: line 96
Use semantic elements before ARIA: button, a, label, table, headings, and landmarks.
- Distinctive: line 101
Do not rely on color alone for status.
- Distinctive: line 102
Ensure icon meaning is also available to non-sighted users.
- Distinctive: line 103
Keep accessible labels even when the visual design omits visible labels.
- Distinctive: line 104
Verify complex UI in the browser accessibility tree.
- Very specific: line 107
Prefer language settings such as Accept-Language and navigator.languages over IP or location for language selection.
- Distinctive: line 109
Use tabular numbers for numeric comparisons.
- Very specific: line 110
Prefer typographic quotes and the single ellipsis character … when the product's content style allows it.
- Distinctive: line 111
Avoid widows, orphans, and awkward line breaks in prominent copy.
- Distinctive: line 113
Use non-breaking spaces for glued terms such as values with units, keyboard shortcuts, and names.
- Distinctive: line 117
Every form control has a visible label or an assistive-tech label.
- Distinctive: line 121
Keep submit enabled until submission starts so users can trigger validation feedback.
- Distinctive: line 123
Do not block typing. Allow input and show validation feedback instead of silently rejecting keystrokes.
- Distinctive: line 124
Do not pre-disable submit on incomplete forms unless there is a strong product reason.
- Very specific: line 126
Use autocomplete and meaningful name attributes to support autofill.
- Very specific: line 127
Use correct type and inputmode values for better keyboards and browser behavior.
- Distinctive: line 129
Use placeholders only as examples or empty-state hints, not as labels.
- Distinctive: line 132
Avoid triggering password managers for non-auth fields with misleading names.
- Distinctive: line 138
Test in iOS Low Power Mode and macOS Safari for browser-specific constraints.
- Distinctive: line 140
Use CPU and network throttling when profiling.
- Distinctive: line 142
Keep keystroke paths cheap.
- Distinctive: line 154
Use layered shadows that model ambient and direct light rather than a single flat shadow.
- Distinctive: line 156
Keep nested radii concentric: child radius should be less than or equal to parent radius.
- Distinctive: line 158
Use color-blind-friendly palettes for charts.
- Distinctive: line 159
Check contrast with perceptual tools such as APCA when possible.
- Distinctive: line 163
Avoid scaling text directly when animation causes anti-aliasing artifacts.
- Distinctive: line 168
Use these defaults when the project has no stronger voice or content standard:
- Distinctive: line 170
Write in active voice.
- Distinctive: line 173
Keep nouns consistent and introduce as few terms as possible.
- Distinctive: line 174
Write to the user in second person.
- Distinctive: line 175
Use numerals for counts.
- Very specific: line 180
Avoid vague button labels such as Continue when a specific action label such as Save API Key is available.
- Distinctive: line 187
Check semantics, keyboard access, focus management, labels, and browser-native behavior first.
- Distinctive: line 188
Check form behavior, validation, loading states, async feedback, and destructive action recovery.
- Distinctive: line 189
Check responsive layout, safe areas, overflow, scroll behavior, and deep-link/share behavior.
- Distinctive: line 190
Check animation purpose, reduced-motion behavior, and jank risk.
- Distinctive: line 191
Check performance risks that affect interaction latency, layout stability, loading, or rendering.
- Distinctive: line 192
Check visual polish, contrast, content clarity, and locale resilience.
- Distinctive: line 193
Verify in browser when possible using keyboard navigation, mobile viewport, zoom, reduced motion, throttling, and accessibility tree …
- Distinctive: line 197
When applying this skill, produce the output that best fits the task:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Web Best Practices
Purpose
Use this skill to build and review high-quality web interfaces that are accessible, responsive, performant, resilient, and pleasant to use.
This skill is adapted from Vercel's Web Interface Guidelines. Treat the source URL as the authoritative reference when details need confirmation.
When to Use
Use this skill when:
- Building or reviewing any browser-based UI.
- Implementing interactions, navigation, forms, dialogs, menus, tooltips, tables, lists, charts, or loading states.
- Improving accessibility, keyboard support, focus management, responsiveness, layout stability, or visual polish.
- Auditing generated UI code before shipping.
- Debugging UI quality problems such as layout shift, janky animation, bad mobile behavior, broken keyboard flows, or confusing form errors.
Do not use this as a substitute for project-specific design systems, product voice, accessibility requirements, or performance budgets. Apply local standards first when they are stricter or more specific.
Operating Principles
- Prefer native browser semantics before custom behavior.
- Preserve standard browser affordances such as keyboard navigation, browser zoom, links, autofill, paste, Back/Forward, refresh, open-in-new-tab, and scroll restoration.
- Design every user state: empty, sparse, dense, loading, success, error, disabled, in-flight, offline, and permission-denied where relevant.
- Make interactions forgiving with generous targets, clear affordances, predictable focus, and recoverable destructive actions.
- Keep performance work user-centered: responsiveness, layout stability, fast feedback, and low input latency matter more than abstract micro-optimizations.
- Verify on real browser constraints, especially mobile Safari, desktop Safari, throttled CPU/network, zoom, and reduced motion.
Interaction Checklist
- Ensure every flow works with keyboard only and follows WAI-ARIA Authoring Practices where applicable.
- Show a visible focus ring on every focusable element. Prefer
:focus-visibleand use:focus-withinfor grouped controls. - Move, trap, and restore focus correctly in dialogs, menus, popovers, drawers, and multi-step flows.
- Match visual and hit targets. Use at least 24 px hit targets, and at least 44 px on mobile.
- Never disable browser zoom.
- Never block paste in
inputortextarea. - Keep hydrated inputs from losing focus or value.
- Use
aor framework link components for navigation. Do not replace navigational links withbuttonordiv. - Persist shareable state in the URL when users expect refresh, sharing, Back/Forward, or deep links to work.
- Deep-link filters, tabs, pagination, expanded panels, and meaningful
useStateUI state. - Restore prior scroll positions on Back/Forward navigation.
- Use optimistic updates when success is likely. On failure, show the error and roll back or offer Undo.
- Confirm destructive actions or provide Undo with a safe recovery window.
- Use
touch-action: manipulationon controls when needed to avoid double-tap zoom issues. - Avoid dead zones: if something looks interactive, the whole visible control should be interactive.
- Announce async updates such as toasts and inline validation with polite
aria-liveregions. - Internationalize keyboard shortcuts for non-QWERTY layouts and show platform-specific symbols.
Loading and Feedback
- For loading buttons, show progress while keeping the original label visible.
- Avoid spinner flicker by adding a short show delay around 150-300 ms and a minimum visible time around 300-500 ms.
- Use skeletons only when they mirror the final layout closely enough to avoid layout shift.
- Use ellipses for actions that require more input, such as
Rename…, and for active progress states such asLoading…. - Prefer inline help over tooltips. Use tooltips only when the information is supplementary and not required to complete the task.
- Design no dead ends. Every screen should offer a next step or recovery path.
Animation Checklist
- Honor
prefers-reduced-motionwith a reduced-motion alternative. - Prefer CSS animations, then the Web Animations API, then JavaScript animation libraries only when needed.
- Animate compositor-friendly properties such as
transformandopacity. - Avoid animating layout-affecting properties such as
width,height,top, andleftunless the tradeoff is deliberate. - Never use
transition: all; list the exact properties being animated. - Animate only when it clarifies cause and effect or adds deliberate delight.
- Make animations interruptible by user input.
- Prefer input-driven animation over autoplay.
- Set transform origins to match where motion physically begins.
- For SVG transforms, animate
gwrappers and settransform-box: fill-boxandtransform-origin: centerfor better browser consistency.
Layout Checklist
- Align every element deliberately to a grid, baseline, edge, or optical center.
- Use optical alignment when perception beats geometry, including small 1 px adjustments.
- Balance text and icons in lockups by adjusting weight, size, spacing, or color.
- Verify layouts on mobile, laptop, and ultra-wide screens.
- Respect safe areas for notches and device insets with CSS
env()variables. - Fix unwanted overflow and excessive scrollbars. Test with always-visible scrollbars to catch Windows-style scrollbar issues.
- Prefer CSS flex, grid, and intrinsic layout over measuring layout in JavaScript.
- Let browser layout handle flow, wrapping, and alignment when possible.
Content and Accessibility Checklist
- Keep page
<title>accurate to the current context. - Use semantic elements before ARIA:
button,a,label,table, headings, and landmarks. - Maintain a logical heading hierarchy and provide a skip-to-content link for substantial pages.
- Give every interactive control an accessible name.
- Provide descriptive
aria-labelvalues for icon-only buttons. - Mark decorative icons with
aria-hidden. - Do not rely on color alone for status. Include text, icon shape, or another redundant cue.
- Ensure icon meaning is also available to non-sighted users.
- Keep accessible labels even when the visual design omits visible labels.
- Verify complex UI in the browser accessibility tree.
- Make user-generated content resilient: handle short, average, long, unbroken, and unexpected content.
- Format dates, times, numbers, delimiters, and currency for the user's locale.
- Prefer language settings such as
Accept-Languageandnavigator.languagesover IP or location for language selection. - Mark brand names, product names, code tokens, and technical identifiers with
translate="no"when browser translation would corrupt them. - Use tabular numbers for numeric comparisons.
- Prefer typographic quotes and the single ellipsis character
…when the product's content style allows it. - Avoid widows, orphans, and awkward line breaks in prominent copy.
- Set
scroll-margin-topon anchored headings so linked sections are not hidden under sticky UI. - Use non-breaking spaces for glued terms such as values with units, keyboard shortcuts, and names.
Form Checklist
- Every form control has a visible label or an assistive-tech label.
- Clicking a label focuses or toggles its associated control.
- Enter submits when there is a single text input or when focus is on the final logical control.
- In textareas, Enter inserts a newline and Cmd/Ctrl+Enter submits when shortcut submit is supported.
- Keep submit enabled until submission starts so users can trigger validation feedback.
- Disable submit during the in-flight request, show progress, and use an idempotency key when duplicate submissions would be harmful.
- Do not block typing. Allow input and show validation feedback instead of silently rejecting keystrokes.
- Do not pre-disable submit on incomplete forms unless there is a strong product reason.
- Show field errors next to their fields and focus the first error after failed submit.
- Use
autocompleteand meaningfulnameattributes to support autofill. - Use correct
typeandinputmodevalues for better keyboards and browser behavior. - Set mobile input font size to at least 16 px to avoid iOS Safari auto-zoom on focus.
- Use placeholders only as examples or empty-state hints, not as labels.
- Warn before navigation when unsaved changes could be lost.
- Support password managers and 2FA flows. Allow pasting one-time codes.
- Avoid triggering password managers for non-auth fields with misleading names.
- Trim accidental trailing whitespace from input methods and text replacements before validation.
- Explicitly set
background-colorandcoloron nativeselectcontrols to avoid Windows dark-mode contrast bugs.
Performance Checklist
- Test in iOS Low Power Mode and macOS Safari for browser-specific constraints.
- Profile with browser extensions disabled when measuring performance.
- Use CPU and network throttling when profiling.
- Minimize re-renders and make unavoidable re-renders cheap.
- Keep keystroke paths cheap. Prefer uncontrolled inputs when controlled input loops become expensive.
- Batch DOM reads and writes to avoid unnecessary reflows and repaints.
- Move expensive long tasks off the main thread with Web Workers when interaction would otherwise block.
- Virtualize large lists or use
content-visibility: autowhere appropriate. - Preload only above-the-fold images and lazy-load the rest.
- Set explicit image dimensions and reserve space to avoid image-caused CLS.
- Preconnect to important asset and CDN origins when the connection setup cost matters.
- Preload critical fonts and subset fonts to only the scripts, code points, and axes in use.
- Aim for mutation requests such as
POST,PATCH, andDELETEto complete in under 500 ms when feasible.
Visual Design Checklist
- Use layered shadows that model ambient and direct light rather than a single flat shadow.
- Combine borders and shadows for crisp edges when elevation or separation matters.
- Keep nested radii concentric: child radius should be less than or equal to parent radius.
- On non-neutral backgrounds, tint borders, shadows, and text toward the same hue.
- Use color-blind-friendly palettes for charts.
- Check contrast with perceptual tools such as APCA when possible.
- Increase contrast on interactive states such as hover, active, and focus.
- Match browser UI to page background with
theme-colorwhere appropriate. - Set
color-schemeon the root for dark themes so scrollbars and built-in controls have proper contrast. - Avoid scaling text directly when animation causes anti-aliasing artifacts. Animate a wrapper instead.
- Watch for gradient banding, especially in dark fades and CSS masks.
Copywriting Defaults
Use these defaults when the project has no stronger voice or content standard:
- Write in active voice.
- Be clear and concise.
- Use action-oriented labels.
- Keep nouns consistent and introduce as few terms as possible.
- Write to the user in second person.
- Use numerals for counts.
- Format currency consistently within a context.
- Separate numbers and units with a space, preferably a non-breaking space when they must stay together.
- Frame errors in a positive, recovery-oriented way.
- Error messages should explain what happened and how to fix it.
- Avoid vague button labels such as
Continuewhen a specific action label such asSave API Keyis available.
Vercel-specific preferences such as Title Case for product UI headings/buttons, sentence case on marketing pages, & instead of and, and placeholder formats should not override an existing product style guide.
Review Workflow
- Identify the user's goal, the interface surface, and the relevant states.
- Check semantics, keyboard access, focus management, labels, and browser-native behavior first.
- Check form behavior, validation, loading states, async feedback, and destructive action recovery.
- Check responsive layout, safe areas, overflow, scroll behavior, and deep-link/share behavior.
- Check animation purpose, reduced-motion behavior, and jank risk.
- Check performance risks that affect interaction latency, layout stability, loading, or rendering.
- Check visual polish, contrast, content clarity, and locale resilience.
- Verify in browser when possible using keyboard navigation, mobile viewport, zoom, reduced motion, throttling, and accessibility tree inspection.
Output
When applying this skill, produce the output that best fits the task:
- For implementation: code that preserves browser semantics, accessibility, responsive behavior, and performance constraints.
- For review: findings ordered by user impact, with concrete file or UI references and fixes.
- For design critique: prioritized issues grouped by interaction, accessibility, forms, layout, performance, and visual polish.
- For checklists: only include the sections relevant to the surface being built or reviewed.
References
- Vercel Web Interface Guidelines: https://vercel.com/design/guidelines
- WAI-ARIA Authoring Practices: https://www.w3.org/WAI/ARIA/apg/patterns/
- MDN
inert: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/inert - MDN safe-area
env(): https://developer.mozilla.org/en-US/docs/Web/CSS/env - Chrome accessibility tree inspection: https://developer.chrome.com/blog/full-accessibility-tree
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

