How to get Claude Code to check your site on every screen size
A coding agent writes the CSS and tells you the page is finished. Whether it is finished on a phone depends on whether the agent could look. Here are three ways to let Claude Code, Codex or Cursor see the page at several sizes, with the prompts to use.
Updated 26 November 2026
CLAUDE.md or AGENTS.md so the agent runs the check after every interface change.Why agents get mobile layouts wrong
An agent edits files. Unless it has a tool that renders the page, it reasons about layout from the code alone, and responsive faults rarely show in code: a long word that pushes a card wider than the screen, a hero that is exactly one toolbar too tall, a footer behind the keyboard. When the agent does have a browser tool, the default is usually one desktop-size window.
The fix is the same for every agent that speaks the Model Context Protocol (MCP): give it a server that can open your local URL at phone, tablet and desktop sizes, and tell it when to use it.
Three routes at a glance
| Route | One call covers | Engines | You get back | Cost |
|---|---|---|---|---|
| Playwright MCP | One viewport; the agent loops through sizes | Chromium, Firefox or WebKit, one per server instance | Screenshots and accessibility snapshots | Free, open source |
| Chrome DevTools MCP | One emulated device per call | Chrome | Screenshots, console and network detail, performance traces | Free, open source |
| ViewPortal | A named set of devices and browsers | WebKit and Chromium together; Firefox after one more install | A verdict, numbered issues with selectors, full-size captures, light and dark pairs | 7-day free trial, then £9 a month or £79 a year (Mac) |
Route 1: Playwright MCP and a resize loop
Microsoft’s Playwright MCP is free and works on any desktop OS. Add it to Claude Code with:
claude mcp add playwright npx @playwright/mcp@latest
Then ask for the sizes you care about:
Open http://localhost:3000 with Playwright. Resize to 390x844, 820x1180
and 1440x900. Take a screenshot at each size and list anything that
overflows, overlaps or is cut off.
The agent calls browser_resize and browser_take_screenshot for each size. To start in a phone profile, launch the server with --device "iPhone 15", or with --browser webkit to render in WebKit. Each server instance drives one engine, so a Safari-and-Chrome comparison means two server entries.
Route 2: Chrome DevTools MCP emulation
Google’s Chrome DevTools MCP (npx -y chrome-devtools-mcp@latest) drives Chrome through the DevTools protocol. Its emulate tool sets viewport size, device pixel ratio, touch and dark mode, and take_screenshot captures the result. It is the strongest route when the question is also about speed: it records performance traces and runs Lighthouse.
Use Chrome DevTools to emulate a 390x844 phone at 3x with touch,
load http://localhost:3000, take a screenshot, then repeat in dark mode.
Report console errors and any horizontal scroll.
Route 3: ViewPortal presets, a whole device set in one call
ViewPortal for Mac includes an MCP server built for this check. Open the app, go to Settings → Agent access and press Install for Claude Code, Codex or Cursor. Or run:
"/Applications/ViewPortal.app/Contents/Resources/qc/viewportal-qc" mcp install --client claude --skill
Then ask in plain words:
QC localhost:3000 on phones
One call renders the page on a preset of devices and comes back like this (a real run on a test page with planted faults, shortened here):
FAIL · 8 issues on 4 targets (phones, light)
1. all 4 targets: sideways scroll 307–372px — #readout, div.wide
2. all 4 targets: 1 broken image — img
4. all 4 targets: text contrast 1.3:1 — p.low
6. all 4 targets: 100vh can extend under expanded browser bars — div.hero
8. iPhone 17, iPhone 17 Pro Max, iPhone SE (Safari 27.2): small input
text may trigger focus zoom — #small
Pictures in ~/…/runs/20261122-021725-ipcl/
The pictures are full-size captures with each browser’s toolbars drawn in, so the agent (and you) can see what sits under Safari’s address bar. Other presets include tablets, desktop and everything, which adds tablets and desktop Safari, Chrome and Firefox so all three engines render in the same call (install Firefox from Settings → Agent access first). “What breaks in dark mode?” returns labelled light and dark pairs, and “Compare before and after on phones” shows what a change did. More examples are on the MCP setup page.
Make it a habit with one rule
Agents follow standing instructions in CLAUDE.md (Claude Code) and AGENTS.md (Codex and others). Add a rule so the check runs without being asked:
## Interface changes
After any change to HTML, CSS or components, check the page at phone,
tablet and desktop sizes before reporting the work as done.
- With ViewPortal: run QC on the changed URL with the phones preset,
then desktop. Fix every FAIL item and run it again.
- Attach the verdict line and the picture folder to your summary.
With ViewPortal you can also save the site once (“Set up a ViewPortal project for this site”) and the rule becomes “run my-shop QC”: the project remembers the URLs and the devices that matter.
Prompts worth keeping
- Before a merge: “QC the checkout page on phones and desktop. Worst first.”
- After a redesign: “Compare before and after on phones.”
- Theme work: “What breaks in dark mode?”
- A bug report from a user: “Show me /pricing on an iPhone SE in Safari and a Pixel 9 in Chrome.”
- Foldables: “Check the home page on the iPhone Duo, closed and open.” The Duo’s four widths catch layouts that pass on every other phone.
One prompt, every device
ViewPortal for Mac gives Claude Code, Codex and Cursor a single call that renders your page in WebKit and Chromium, and in Firefox once installed, across phones, tablets and desktops, and answers with a verdict, numbered issues and pictures. The same devices sit side by side on the Mac board when you want to look yourself.
Every feature is open in a 7-day free trial with no card needed, then £9 a month or £79 a year for up to 3 Macs.
Mac: 7-day free trial (no card), then £9/month or £79/year · iOS: free, Pro £4.99 once.
Questions people ask
Can Claude Code see my website?
How do I make Claude Code test a mobile layout?
Does this work with Codex and Cursor?
Can an agent test Safari and Firefox, not only Chrome?
How do I make the agent check layouts every time?
Sources and references
Sources checked 26 November 2026 on each tool’s own documentation or repository.
- Microsoft: Playwright MCP repository and README
- Google Chrome DevTools: chrome-devtools-mcp repository
- ViewPortal: MCP setup, presets and real runs
- Model Context Protocol: introduction