AI for frontend development: what agents do well, badly, and how to check

AI for frontend development: what agents do well, badly, and how to check

AI for frontend development works best when an agent writes components, styles and tests inside your existing conventions and then checks its work in a real browser. It is weakest at visual polish, accessibility and design judgment. This guide shows what to delegate, the prompts and project rules that make output fit, and the automated checks that catch what AI gets wrong.

In shortTL;DR
  • Delegate scaffolding, CRUD screens, refactors, tests and conversions; keep design decisions, interaction details and final visual review for yourself.
  • Point the agent at one existing component as the pattern to copy, and list your design tokens and component library in CLAUDE.md or AGENTS.md.
  • Give the agent eyes: a browser it can drive (Claude Code with Chrome, or the Playwright MCP server) so it can compare the result with the mockup and read console errors.
  • Add an axe-core check to your Playwright tests; automated scans catch about 57 percent of WCAG issues, so still test keyboard and screen reader flows by hand.
  • Ask for evidence when the agent says it is done: the test output and a screenshot, not a summary.

How is AI used for frontend development today?

AI for frontend development means using models to write and change UI code: components, styles, state handling, tests and the glue between design and implementation. In 2026 most of that work happens through coding agents that edit a real repository, run the dev server and tests, and increasingly look at the result in a browser.

Four kinds of tools show up in frontend work:

Tool typeExamplesBest for
Coding agentClaude Code, Codex, Cursor agent, GitHub Copilot agentMulti-file changes in your own codebase
Inline assistantEditor autocomplete and chatSmall edits while you type
UI generatorv0, Lovable, BoltFirst drafts of a screen or prototype
Design bridgeFigma MCP server, screenshotsTurning a mockup into code

The Stack Overflow Developer Survey 2026 shows where developers trust AI: technical tasks such as implementation and debugging were rated useful by more than 70 percent of respondents, while design was rated useful by 49 percent. That split matches daily frontend experience. Agents are good at the code; the look and feel still needs a human eye. Our roundup of VS Code AI extensions covers the editor-side tools.

What do AI agents do well and badly in frontend work?

Agents do well on frontend work with a clear pattern to copy and a check they can run: CRUD screens, forms, refactors, type fixes, test writing and conversions. They do badly where the result is judged by eye or by assistive technology: spacing, motion, responsive edge cases and accessibility.

TaskHow AI doesWatch for
New component from an existing patternWellCopies outdated patterns if you point at the wrong file
Forms with validationWellMissing labels, error messages not linked to inputs
Refactors (class to hooks, JS to TS, CSS to Tailwind)WellBehavior changes hidden in large diffs
Unit and component testsWellTests that assert implementation details or always pass
State and data fetchingMixedDuplicated state, missing loading and error states
Responsive layoutMixedLooks right at one width, breaks at others
Pixel-accurate design matchMixedClose but not exact spacing, type scale, colors
AccessibilityWeak by defaultDiv buttons, missing alt text, low contrast, wrong ARIA
Animation and interaction feelWeakJanky timing, no reduced-motion handling
Visual tasteWeakGeneric layouts that look like every other AI page

The pattern behind the table: AI succeeds when success is checkable by a program. Give it a test, a type checker, a linter or a screenshot to compare, and it converges. Without a check, it stops when the code looks plausible.

How do you get AI to write components that fit your codebase?

Show the agent one good existing component, list your conventions in the project instructions file, and ask for a small, specific change. Agents imitate what they see; without a reference they fall back to generic patterns from their training data.

Put the stable facts in CLAUDE.md (Claude Code) or AGENTS.md (Codex and others) so every session starts with them:

CLAUDE.md
## Frontend conventions- React 19 + TypeScript strict. Function components only.- Styling: Tailwind with tokens from `src/styles/tokens.css`. No hex colors or arbitrary values like `p-[13px]`.- UI primitives come from `src/components/ui/`. Do not add a component library.- Data fetching: TanStack Query hooks in `src/api/`. No fetch calls inside components.- Every interactive element is a real `<button>`, `<a>` or form control.- Run `npm run typecheck && npm run test && npm run lint` before saying you are done.- Ask before adding any dependency.

Then write the task like a ticket, with a reference:

prompt
Add an InvoiceTable component at src/features/billing/InvoiceTable.tsx.Follow the structure and styling of src/features/orders/OrdersTable.tsx.Columns: number, customer, amount (formatted with formatMoney), status badge, due date.Include loading, empty and error states like OrdersTable has.Sorting by due date only. No pagination yet.Write component tests with Testing Library next to it.When done, show me the test output and a screenshot of /billing at 375px and 1280px wide.

The last line matters. Anthropic's best practices recommend giving Claude a way to check its work, including "a browser screenshot next to the mockup", and asking for evidence rather than a claim that tests pass. Our guide to CLAUDE.md best practices covers what else belongs in that file.

How do you keep AI-written styles consistent?

Constrain the styling vocabulary: name the design tokens, the spacing scale and the component library, and forbid one-off values. AI writes CSS and Tailwind fluently, but left alone it invents colors, mixes spacing values and duplicates components that already exist.

Practical rules that work:

  • Tokens over values. List the token file in your instructions and ask the agent to use only those names. A lint rule that rejects raw hex colors or arbitrary Tailwind values turns this from a request into a check.
  • Check every breakpoint. Ask for screenshots at a phone, tablet and desktop width. A layout that only ever got checked at 1280px will break on a phone.
  • Dark mode and states. Ask explicitly for hover, focus, disabled and dark-mode styles; agents often skip states the prompt did not mention.
  • Reuse before create. Ask the agent to search src/components for an existing component before writing a new one.
A developer at two monitors with HTML code on one screen
Agents write the markup fast; the review at every screen width is still yours.

Why is AI-generated frontend code often inaccessible, and how do you fix it?

AI-generated UI is often inaccessible because models learn from existing web code, and most of the web fails basic accessibility checks. The fix is to ask for semantic HTML explicitly, run automated accessibility tests on every change, and test keyboard and screen reader flows yourself.

The WebAIM Million 2026 report scanned the home pages of the top one million websites:

95.9%of home pages had detected WCAG 2 failures
56.1average detected errors per home page
57%of WCAG issues axe-core finds automatically, on average
Sources: WebAIM Million 2026; axe-core README (Deque)

The most common failures in the WebAIM report were low-contrast text (83.9 percent of pages), missing image alt text (53.1 percent), missing form labels (51 percent), empty links (46.3 percent) and empty buttons (30.6 percent). WebAIM also found that pages with ARIA present had more errors on average than pages without it. That is a useful warning for AI output: an agent that sprinkles role and aria-* attributes over divs is not making a page more accessible.

Add an automated scan to your end-to-end tests with @axe-core/playwright, as the Playwright docs show:

tests/a11y.spec.ts
import { test, expect } from "@playwright/test";import AxeBuilder from "@axe-core/playwright";test("billing page has no detectable accessibility violations", async ({ page }) => {  await page.goto("/billing");  const results = await new AxeBuilder({ page }).analyze();  expect(results.violations).toEqual([]);});

Agents can read the violation list and fix most items themselves. Automated checks still miss a large share of problems, so before release tab through the page with the keyboard, check that focus is visible and in a sensible order, and try the main flow with a screen reader.

Tip

Add "Use native elements first: button, a, label, fieldset. Use ARIA only when no native element fits" to your project instructions. It prevents most of the div-button problems before they reach review.

How should AI write frontend tests?

Ask for tests that use the page the way a user does: query by role and label, click and type, and assert on visible results. Agents write tests quickly, but without guidance they test implementation details or write assertions that cannot fail.

Three layers cover most frontend code:

  1. Component tests with Testing Library: render, interact with getByRole("button", { name: /save/i }), assert on what appears.
  2. End-to-end tests with Playwright for the main user flows, including the axe scan above.
  3. Visual checks with Playwright's await expect(page).toHaveScreenshot() for pages where layout regressions matter.

Review AI-written tests with two questions: would this test fail if the feature broke, and does it test behavior a user would notice? A quick way to check the first is to break the code on purpose and see whether the test goes red. Our guides on writing tests with AI and AI end-to-end testing with Playwright go further.

How do you turn designs into code with AI?

Give the agent structured design data, not only a picture. A screenshot gets you an approximation; the Figma MCP server gives the agent layout, variables and component data from the frame you select, and Code Connect maps Figma components to the ones in your codebase.

What to expect:

  • Good: structure, layout, typography roles, colors mapped to variables, reuse of mapped components.
  • Needs work: exact spacing, responsive behavior the design does not show, empty and error states, interactions.
  • Tips from Figma's docs: structure the Figma file cleanly and avoid selecting large, heavy frames; build one section at a time.

Without Figma access, a screenshot still helps. In Claude Code you can paste an image of the design straight into the prompt. Our Figma to code guide walks through the full setup.

How do you let an AI agent see what it built?

Connect the agent to a browser so it can open the page, take screenshots, read console errors and click through flows. This closes the loop: the agent compares its result with the mockup and fixes problems before you see them.

Two common setups:

SetupHow to startNotes
Claude Code with Chromeclaude --chrome, then /chrome to check statusUses Chrome or another supported Chromium browser with the Claude extension; reads console and DOM; not supported in WSL
Playwright MCP serverclaude mcp add playwright -- npx @playwright/mcp@latestDrives a browser through accessibility snapshots instead of pixels; works with many agents

The Chrome integration docs list design verification ("build a UI from a Figma mock, then open it in the browser to verify it matches") and live debugging from console errors among its uses. The Playwright MCP server works from the page's accessibility tree, which has a side benefit for frontend work: if the agent cannot find your button by its role and name, neither can a screen reader.

Warning

A browser-connected agent acts with your logged-in sessions. Point it at your local dev server or a staging account, not at production admin panels.

Frontend tasks with a clear spec and a browser check are good candidates for running unattended. Orkio runs Claude Code or Codex on an always-on cloud box, with a ready Web/SaaS (Next.js) kit or your own GitHub repository; you hand over a task from your phone and review the pull request later.

A frontend AI workflow to start with this week

Set this up once and every AI-assisted frontend task gets faster and safer:

  1. Write a short frontend section in CLAUDE.md or AGENTS.md: stack, tokens, component folder, test commands, "ask before adding dependencies".
  2. Pick one well-built component per category (table, form, modal) as the reference to copy.
  3. Add a lint rule against raw colors and arbitrary values.
  4. Add @axe-core/playwright scans to your end-to-end tests for key pages.
  5. Connect a browser: claude --chrome or the Playwright MCP server.
  6. Write tasks like tickets, with a reference file, states to handle and the evidence you want back.
  7. Review every diff at three screen widths, tab through it with the keyboard, and check package.json.
  8. Keep design decisions, motion and final visual sign-off with a person.

Frequently asked questions

Can AI replace frontend developers?

Not as of 2026. AI agents write a lot of frontend code quickly, but they still need someone to set conventions, judge visual quality and interaction details, catch accessibility problems and decide what to build. The work shifts toward specifying, reviewing and testing rather than typing every component.

What is the best AI tool for frontend development?

It depends on the job. Agents such as Claude Code, Codex and Cursor's agent work across a real repository and can run tests and a browser; UI generators such as v0 or Lovable are faster for first drafts of a screen. Most teams use an agent in their own codebase and a generator for exploration.

Is AI-generated frontend code accessible?

Often not by default. Models learn from existing web code, and most of the web fails basic accessibility checks, so generated markup repeats mistakes such as missing labels, low contrast and div buttons. Ask for semantic HTML explicitly, run axe-core in your tests, and test keyboard navigation yourself.

Can AI convert a Figma design to React code?

Yes, with limits. The Figma MCP server gives agents layout, variables and component data from a selected frame, which produces much closer code than a screenshot alone. Expect to fix spacing, responsive behavior and states that the design does not show, and map Figma components to your real ones.

How do I stop AI from adding new libraries to my frontend?

State it in your project instructions file, for example a line in CLAUDE.md saying to use only the existing component library and styling system and to ask before adding dependencies. Review package.json changes in every pull request too, because the agent may still ignore an instruction.

SOURCES

  1. WebAIM: The WebAIM Million 2026
  2. axe-core README (Deque)
  3. Playwright docs: Accessibility testing
  4. Claude Code docs: Use Claude Code with Chrome
  5. Claude Code docs: Best practices
  6. Playwright MCP server (Microsoft)
  7. Figma: Figma MCP server
  8. Stack Overflow Developer Survey 2026: AI
  • #frontend
  • #ai coding
  • #accessibility
  • #testing
  • #react
Orkio team

The team building Orkio. We write about putting AI to work: coding agents that run overnight, always-on boxes and pull requests ready by morning.

Keep reading

All posts

07:06 · YOU MERGED #128

Go to sleep. Wake up to pull requests.

Start for $19 a month
© 2026 Orkio · Hosted in Europe TürkçeStatus