The most common mistakes AI makes on the web
What coding agents get wrong in accessibility, layout, speed and security, what to ask for instead, and a prompt that checks your own site.
Written by the IndieHacked teamBuilding with AI9 min read
AI coding agents write web code the way it was written years ago, and in Chrome's tests they passed about half of its checks without help.
The misses cluster in focus and modals, reduced motion, forms, dialogs, dark mode, layout shift and security headers, where a newer built-in feature does the job in less code.
Chrome's free Modern Web Guidance skill lifted the pass rate to about 90% in the same tests. Install it, then run the prompt below to check what your agent already built.
Want your coding agent to walk you through it?Get the prompt
Why agents write yesterday's web
A model learns from the code that exists, and most of it was written before the browser features that replace it. So an agent reaches for a JavaScript focus trap where a dialog element does the job, or measures a text box in script where one line of CSS sizes it. The old code works, which is why nobody notices.
Chrome measured it. The same prompts were run with and without its guidance and graded against each guide's checks: without it, agents passed about 50% of them, with it about 90% (Chrome for Developers, as of 9 November 2026). On browser compatibility alone the pass rate went from 43% to 87%. Chrome built both the tests and the skill, so read the numbers as its own.
Accessibility: focus, motion and forms
These three show up in almost every app an agent builds, and each has a built-in answer:
- Modals built from divs, with a hand-written tab trap and aria-modal. Use the dialog element opened as a modal, which keeps focus inside it, and mark the page behind it inert. Send focus into a new view, and back to where it was when the view closes.
- Animation that ignores reduced motion: smooth scrolling set on the whole page, scroll-driven effects and page transitions that always run. Gate each one behind prefers-reduced-motion, and skip the blanket 0.01ms reset on every element, which also kills the transitions that show a state change.
- Form errors checked in JavaScript on blur, and a placeholder as the only hint. Style errors with :user-invalid, which waits until the person has touched the field, and keep the format hint above the input, linked with aria-describedby.
Dialogs, gestures and dark mode
- Overlays as fixed divs with click-outside handlers and a stack of timers to animate them. The popover attribute and the dialog element put them in the top layer and close them on Escape, a popover also closes on a click outside, and @starting-style animates both in and out without a single timeout.
- Scroll locked by setting overflow hidden on the page. A modal dialog with overscroll-behavior: contain keeps the scroll where it belongs.
- Swipe to dismiss written as pointermove listeners. CSS scroll snap with scroll-driven animations does it without a script on every frame.
- Dark mode without color-scheme, so form fields and scrollbars stay light. Add the color-scheme meta tag, use light-dark() for paired colours, and offer System, Light and Dark, not a toggle that can never go back to the system setting.
- An Enter key that submits while someone writing Japanese, Chinese or Korean is still confirming a word. Check event.isComposing before treating Enter as submit.
Speed and layout shift
- Long tasks that block the page. Break them up with scheduler.yield(), and keep any task on the main thread under 50 milliseconds, the line Chrome draws for a poor INP score.
- Long lists and grids rendered in full. content-visibility: auto with contain-intrinsic-size skips the work for what's off screen.
- Videos without a width and height, which the browser draws at 300 by 150 until they load. Give the element its aspect-ratio.
- Hero sections sized with vh, which jump when a phone's address bar moves. Use dvh or svh.
- Web fonts that reflow the text when they swap in. font-size-adjust keeps the fallback the same size.
Security the agent never adds
Chrome found that agents didn't add a Content Security Policy or cross-origin isolation headers unless asked, and failed more than half of its security checks even when they were. The usual misses:
- No Content Security Policy at all, or a nonce-based one without 'strict-dynamic'. Ask for a strict policy with nonces or hashes.
- A hand-written HTML sanitiser. Use the browser's setHTML() where it exists and load DOMPurify only where it doesn't.
- Scripts from a CDN without integrity and crossorigin attributes, so a changed file runs unchecked.
- Passkey code with home-made Base64 helpers. The WebAuthn JSON methods (parseCreationOptionsFromJSON, parseRequestOptionsFromJSON and toJSON) replace them.
New features without a fallback
The opposite mistake is just as common: an agent uses a feature only some browsers have and adds no feature check. Baseline is the shared label for this. Widely available means a feature has worked in Chrome, Edge, Firefox and Safari for at least 30 months, Newly available means the last of them has just added it, and Limited availability means at least one still doesn't have it.
Tell your agent which of those you accept. Chrome suggests a short browser support policy in your AGENTS.md or CLAUDE.md, along these lines:
## Browser support policy
- Use Baseline Widely available features directly.
- Newly available or Limited availability features need a fallback: @supports, a feature check, or a polyfill loaded only where it's missing.
- A feature that only makes things nicer (text-wrap: balance) needs no fallback.
- Don't add polyfill dependencies without asking.Check your own site
Chrome's Modern Web Guidance is a free, open-source skill (Apache 2.0) that gives your agent over 200 guides on current web features, each with its Baseline status and a fallback. It works in Claude Code, Codex, Cursor, Copilot and other agents, and the Firefox and Edge teams help write it. Run this in your project folder:
npx modern-web-guidance@latest installThen ask your agent to look for old patterns in your code. The skill runs a scanner that reads your files with parsers and no model calls, so the scan itself costs no tokens. It has no fix flag on purpose: the agent reads the guide for each finding, makes the change, then runs the scan and your tests again.
npx modern-web-guidance legacy-scan src --jsonThe scanner covers about a fifth of the guides. The rest are read as your agent builds, so the prompt below also walks through the areas above by hand. Read what a skill installs before it goes in, and know that this one reports the words of each search to Chrome unless you set DISABLE_TELEMETRY=1. More on installing skills in How to add agent skills, and the release itself in our report.
Set it up with your coding agent
A prompt for Claude Code, Codex, Cursor or the agent you use. Fill in your setup at the end and it walks you through the work, one step at a time. Free with an account.
Questions founders ask
Is Modern Web Guidance only for Chrome?
No. The Firefox and Edge teams support and contribute to it, every guide carries Baseline data for Chrome, Edge, Firefox and Safari, and a feature that isn't in all of them comes with a fallback.
Does it cost anything?
No. It's open source under Apache 2.0 and installs with npx. Searching the guides runs on your own computer.
Is it an MCP server?
No. It's a skill your agent calls through a command line tool, which loads a guide only when the task needs it. Chrome chose that over MCP to keep the agent's context small.
Will the scan rewrite my code?
No. It reports what it finds and your agent makes each change, one guide at a time, then scans again and runs your tests.
Where to go next
- Chrome releases Modern Web Guidance 1.0
Our report on the release and the numbers behind it.
- The agent skills to install before you build a web app
The other skills worth having next to it.
- How to keep API keys safe when you code with AI agents
The security mistake that isn't in the browser.
More guides
All guidesAI search8 min read
How to claim your business in ChatGPT and add products
AI8 min read
Claude new features: how a small team uses each one
A new guide every few days.
Weekly Unpack brings each one to your inbox. One email a week with founder stories, the playbooks behind them and the businesses we unpack in our interviews.
Plusand the Builder Kit come with it
Subscribing makes your account Plus and opens your Builder Kit: what your product needs next, written for your coding agent to do.