Skip to main content

AI-assisted development has made frontend work feel much faster. A developer can ask for a form, a dashboard card, a table, a modal, or a responsive layout and get a decent first version almost immediately. The code may compile. The page may render. At first glance, the UI may look done.AI 辅助开发,前端快了。要表单、卡片、表格、弹窗或响应式布局,问一声,马上出来。代码能跑,页面能显。一眼看去,像做好了。

But frontend developers know that “it looks done” and “it works well” aren’t the same thing.但前端心里清楚,“看着像做好”和“真好用”,是两码事。

A generated form might show validation errors visually but fail to announce them to a screen reader. A modal might open but not move focus to the right place. A dropdown might work perfectly with a mouse and still be unusable from a keyboard. A loading state might look fine in a demo but become confusing when the network is slow. A component might behave well with sample data and break as soon as real content is longer, missing, delayed, or unexpected.表单报错,眼睛能看见,读屏软件却读不出。弹窗开了,焦点没跟上。下拉菜单鼠标能点,键盘却动不了。加载状态演示时看着行,网一慢就乱套。数据少时没问题,真要数据长了、丢了、迟到了,组件就崩。

That is the frontend verification gap in AI-assisted development. In this context, verification means checking whether an interface actually works properly for users under realistic conditions, not just whether the code compiles, the page renders, or the screen matches a design. It includes things like accessibility, keyboard behavior, focus management, state changes, loading and error handling, and whether someone can complete the intended task from start to finish. AI can help teams produce interface code faster than they can confidently answer those questions.这就是 AI 辅助开发的前端验证缺口。验证,不是看代码能不能跑,也不是看页面对不对设计图。是看用户在真实环境里,到底能不能用。无障碍、键盘操作、焦点管理、状态切换、加载与出错处理,能不能从头到尾办成事。AI 写代码快,但这些问题,它回答不了。

This isn’t an argument against AI tools. They can be genuinely useful. They can reduce repetitive work, help developers get unstuck, and speed up the first draft of a feature. But AI-generated frontend code should still be treated as a draft. The next challenge isn’t just generating UI code faster. It’s verifying that code with enough care.不是不用 AI。AI 有用,能省重复劳动,能帮人破局,能做草稿。但 AI 写的代码,还是草稿。往后的难点,不是写得快,是验证得细。

Frontend correctness is harder than it looks前端没看着那么简单

Some kinds of code are easier to verify than user interfaces. A function returns the expected value or it doesn’t. An API sends back the right response or it doesn’t. A script completes successfully or it fails.有的代码好验证。函数给值,对不对,一测便知。API 响应,对不对,一查便知。脚本跑完,成没成,一目了然。

Frontend work is different because the interface is where software meets people. A UI has to satisfy many expectations at once. It has to render correctly, respond to input, preserve state, support keyboard navigation, expose the right information to assistive technologies, and handle loading, errors, empty states, and unexpected data. It also has to fit the design system so the experience feels consistent.前端不一样。界面是软件和人碰头的地方。要渲染对,要响应快,要存状态,要支持键盘,要照顾残障人士,还要处理加载、报错、空数据。还得跟设计系统合拍,别显得突兀。

AI tools are often good at producing the visible part of this work. They can generate a form, card, or table that looks reasonable in the default state. That’s helpful, especially when a developer needs a starting point.AI 擅长做表面的。给个表单、卡片、表格,默认状态看着像样。这够用,当个起点挺好。

The problem is that the default state is only one part of the experience. The harder questions come after the screen appears. Can someone complete the flow using only a keyboard? What happens when the request fails? Does focus move somewhere useful after an error? Are field labels and error messages connected correctly? Does the UI still make sense when there are no results? Is the generated code using existing design-system patterns, or did it quietly introduce a new one?难的是默认状态之后。只用键盘能不能走完流程?请求失败怎么办?报错后焦点往哪跳?标签和报错信息连上了吗?没数据时界面还像话吗?代码是复用的系统组件,还是 AI 自己瞎编的新样式?

These aren’t small details. They are part of whether the interface actually works.这些不是细枝末节。这是界面能不能用的关键。

A quick review is not enough草草过一遍,不够

A common AI-assisted workflow looks something like this: write a prompt, generate code, review the result, make a few edits, and move on. That may be fine for prototypes or internal experiments. It is much weaker for production frontend work.现在的路子:写提示词,出代码,看一眼,改两下,过。做原型、玩实验行。做生产环境的前端,太弱。

The issue isn’t simply that AI makes mistakes. Developers make mistakes too. The issue is that AI can make incomplete work look surprisingly polished. The code may be clean. The structure may look familiar. The component may follow common framework conventions. That polish can make reviewers less likely to question the behavior.不是 AI 会错,人也会错。问题是,AI 能把半成品做得光鲜。代码整洁,结构眼熟,框架用得对。这一光鲜,审的人就容易松懈。

Frontend problems are often missed this way. Accessibility issues, focus bugs, race conditions, missing empty states, and unclear error messages usually don’t jump out from a quick visual scan. They show up when someone interacts with the feature under less-than-perfect conditions.前端毛病多半这么漏掉。无障碍、焦点、竞态、空状态、报错信息,扫一眼看不出。非得在烂网、复杂操作下,人才会撞上。

AI-generated tests can create the same problem. A test may confirm that a component renders but not that a user can complete the task. Another test may check internal state changes while missing keyboard behavior, validation messages, loading states, or failure paths.AI 写的测试也一样。测了渲染,没测任务流程。测了内部状态,漏了键盘交互、验证信息、加载路径。没用。

So the workflow needs to be stronger than “prompt, code, review.” Teams need better validation around AI-generated frontend work. That doesn’t have to mean a heavy process. It simply means being more intentional about what must be checked before a generated UI is considered ready.流程不能只靠“写、看、过”。得有验证。不用搞得太重,但得有心。什么叫“做好了”,得有个准头。

Be clearer about what “done” means把“做好了”说清楚

One of the simplest ways to improve AI-generated frontend code is to give the tool clearer expectations before it starts writing code. Some of those expectations shouldn’t have to be repeated in every prompt. Rules such as using existing design-system components, following accessibility standards, preferring native HTML, and handling loading and error states can often be placed in a persistent project instruction file, such as CLAUDE.md, or another startup file that the agent reads at the beginning of its work. That gives the agent a shared baseline for the whole project and reduces the chance that important standards are forgotten from one task to the next.想让 AI 写得好,先给规矩。别每次都说。用什么设计系统,什么无障碍标准,原生 HTML 优先,怎么处理报错。这些丢进 CLAUDE.md 或者启动文件里。AI 一读,心里就有底,不容易忘。

A task-specific prompt can then focus on the details that are unique to the feature. For example, instead of simply asking for a form, the task might explain which fields are required, what should happen after submission, where focus should move after validation, and how the user should recover if the request fails.具体的任务提示词,只管特有的细节。比如表单,别只说“写个表单”。要说:哪些必填,提交后干嘛,报错后焦点去哪,失败了怎么回退。

The persistent instructions and the task-specific prompt serve different purposes. The first captures the team’s standing engineering expectations. The second explains what this particular feature needs to do.规矩是底线,任务是细节。两头分开。

This also makes review easier. The reviewer is no longer asking only whether the screen looks close to the mockup. They can check whether the feature follows the project’s established rules and whether the specific flow behaves as intended.审的人也轻松。不用盯着设计图对,看它守没守规矩,流程对不对就行。

This matters because many frontend quality expectations are easy to leave unstated. Accessibility, focus behavior, loading states, and error recovery should be part of the agent’s working context wherever possible, rather than depending on a developer remembering to mention them in every prompt.前端质量,很多时候是没说出来。无障碍、焦点、加载、报错,都得进 AI 的上下文。别指望人每次都记得提。

Let the design system do more work让设计系统多干活

AI tools are most useful when they operate inside clear boundaries. For frontend teams, one of the best boundaries is a strong component system.AI 在框子里干活最稳。前端的框子,就是组件系统。

If every generated feature creates its own buttons, inputs, modals, dropdowns, alerts, and tables, the team has to review the same concerns again and again. Is this button accessible? Does this modal manage focus correctly? Is this error message connected to the field? Does this dropdown support keyboard interaction? Are the styles consistent with the rest of the product?要是每个功能都现写按钮、弹窗、下拉菜单,审的人就要累死。这按钮无障碍吗?弹窗焦点对吗?报错信息连上了吗?键盘能用吗?样式乱没乱?

That creates unnecessary rework. A stronger pattern is to put those decisions into reusable components. A button component should already handle variants, disabled states, focus styles, and accessible naming expectations. A modal component should already handle focus movement, escape behavior, labeling, and returning focus to the trigger. A form field component should already connect labels, helper text, required state, and validation messages. Then AI isn’t being asked to invent the pattern from scratch. It’s being asked to compose pieces that already carry the team’s standards.这是重复劳动。把这些逻辑塞进组件。按钮自带样式、禁用态、焦点。弹窗自带焦点管理、Esc 键、标签。表单字段自带关联信息。AI 不用发明轮子,只管拼装。拼的都是标准件。

There’s a big difference between prompting, “Build a modal form,” and prompting, “Use the existing Modal, TextField, Button, and FormMessage components to build this flow.” The second request gives the tool a safer path. It also gives the reviewer fewer things to worry about because the riskiest interaction patterns are already handled by shared components.“写个弹窗表单”和“用现有的 Modal、TextField、Button 拼个流程”,完全两码事。后者路子稳,审的人也放心,因为最险的坑,组件已经填平了。

In that sense, a design system isn’t only about visual consistency. It can become a verification layer. It narrows the possible output and helps teams reduce the number of problems they need to catch manually.设计系统不只是为了好看。它是验证层。它锁死输出,省得人去抠那些琐事。

Test the behavior users actually depend on测用户真正在乎的

Automated checks will never catch everything. They can’t tell you whether a flow feels intuitive, replace a thoughtful review, or guarantee that every user will have a good experience. But they can catch common problems early, which makes them an important part of frontend verification.自动测试不是万能。它测不出顺不顺手,替不了人脑,保不了体验。但能防住常见问题,必须得有。

Accessibility checks can flag missing labels, invalid ARIA usage, some landmark problems, and other frequent mistakes. Component tests can check state changes and validation behavior. End-to-end tests can confirm that someone can complete an important flow, while visual tests can catch certain layout regressions. The important thing is to test behavior, not just structure.无障碍测标签、ARIA。组件测状态、验证。端到端测流程。视觉测试防乱码。重点是测行为,别光测结构。

For example, a basic test might confirm that a form renders. A more useful test checks whether a user can enter values, trigger validation, understand the errors, correct them, submit the form, and receive clear success or failure feedback. Similarly, instead of checking only that a modal appears in the DOM, a test can confirm that focus moves into the modal, keyboard navigation works, the Escape key closes it, and focus returns to the original trigger.基础测试看表单能不能显。好点的测试看:人能不能输值、触发验证、看懂报错、改对、提交、收到反馈。弹窗测试看:焦点进没进、键盘能动吗、Esc 能关吗、焦点回没回原位。

This is where Playwright-style user-flow testing can be especially useful. It allows teams to test an interface in a way that is closer to how a person actually experiences it. The question becomes less about whether the interface renders and more about whether the user can complete the task.Playwright 那种流测试好用。它模拟人怎么用。不是看界面显没显,是看任务成没成。

AI can help generate these tests, but the team still has to define which behaviors matter. Asking an AI tool to “write tests for this component” leaves too much open to interpretation. A request to test keyboard navigation, validation errors, loading behavior, empty states, and failed submissions gives it a much clearer target. The quality of an AI-generated test still depends on the quality of the verification intent behind it.AI 能写测试,但得人定规矩。别只说“给组件写测试”。要说:测键盘交互、测报错、测加载、测空数据、测失败回退。AI 写得好不好,看你验证的意图清不清。

Review the experience, not just the code审体验,别光审代码

Code review still matters, but AI-assisted frontend work needs a slightly different review mindset. Reviewers need to look beyond whether the code is clean and whether the screen matches the expected layout. They should also ask: Are we using existing design-system components? Did the generated code introduce a custom control where native HTML would have been better? Are labels and errors connected correctly? Can the flow be completed with a keyboard? What happens when data is empty, delayed, or invalid? Do the tests cover real user behavior or mostly implementation details?代码得审,但得换个脑子。别只看代码净不净、布局对不对。要问:用了系统组件吗?是不是该用原生 HTML 却瞎用了自定义控件?标签报错连上了吗?键盘能走完吗?没数据、网慢、报错时怎么显?测试测的是实现细节,还是用户行为?

These questions help shift the review from syntax to experience. That doesn’t mean every pull request needs a long checklist. The process can still be lightweight. But the important concerns need to be visible somewhere. If accessibility, focus behavior, loading states, and error recovery never come up during review, they’ll continue to be missed.这些问题,把重心从语法挪到体验。不用搞长清单,但这些事得摆在台面上。审的时候不提,上线就得漏。

AI doesn’t automatically solve that. In some cases, it makes the gap easier to miss because the generated result looks more complete than it really is.AI 解决不了这事。甚至因为 AI 给的结果看着太像样,反而更容易漏。

Use AI without lowering the bar用 AI,别降标准

The goal isn’t to make AI-assisted development feel risky or slow. The goal is to use AI for what it does well without letting it quietly lower the quality standard.AI 是为了快,不是为了冒险。用好 AI,别让质量滑坡。

AI is useful for first drafts, repetitive scaffolding, alternate implementations, test ideas, and refactoring suggestions. It can help developers move through routine work faster. But it shouldn’t define what “good enough” means.AI 做草稿、脚手架、重构建议行。能省力。但别让它定义什么是“够好”。

Frontend teams can get more value from AI when they pair it with clear engineering habits. Use existing components instead of generating new patterns each time. Include accessibility and interaction behavior in the prompt. Ask for loading, empty, error, and success states. Add automated checks for common problems. Test important flows the way a user would experience them. Review behavior, not just code structure.前端团队用 AI,得有习惯。复用组件,别乱造。提示词里写明无障碍和交互。要求加上加载、空状态、报错反馈。加上自动测试。测用户流程。审行为,别光审结构。

These habits reduce rework. They also make AI-generated code easier to trust, because the trust comes from verification rather than from how confident or polished the generated output looks.这些习惯能省返工。代码也才信得过。信的是验证,不是 AI 的那股光鲜劲。

The frontend engineer’s role is shifting前端工程师的角色变了

AI-assisted development does not make frontend engineering less important. It changes where the value is. The value is not only in writing every line of UI code by hand. It’s in defining good component boundaries. It’s in knowing which patterns should be reused. It’s in understanding accessibility and interaction details. It’s in writing meaningful tests. It’s in noticing when a UI looks finished but isn’t actually ready.AI 没让前端变轻。价值变了。不是手写每一行代码,是定好组件边界。是知道哪能复用。是懂无障碍,懂交互细节。是能写出有用的测试。是能一眼看出界面看着像样,其实不能用。

That judgment matters because frontend failures are often experienced directly by users. A backend failure may return an error. A frontend failure may leave someone confused, stuck, or unable to complete a task. The user may not know whether they did something wrong, whether the application failed, or whether the interface was never designed for their way of navigating. Good verification protects users from that confusion.这判断力值钱。后端挂了,报个错。前端挂了,用户就懵了,卡住了,办不成事。用户不知道是自己笨,还是软件烂,还是设计没考虑周全。好的验证,替用户挡住这些懵。

Closing the gap补上缺口

AI is making frontend development faster. That’s a real benefit. But faster code generation doesn’t automatically create better interfaces. In many teams, the bottleneck will move from writing code to checking whether the code behaves well.AI 让前端快了。这是好事。但快不等于好。很多团队,瓶颈从写代码,变成了验代码。

The teams that benefit most from AI-assisted development won’t be the ones that generate the most UI code. They’ll be the ones that build strong feedback loops around that code.谁能围绕 AI 代码建起反馈闭环,谁才赢。

For frontend teams, that means treating verification as part of development from the start. Component contracts, design-system guardrails, accessibility checks, user-flow tests, and behavior-focused reviews aren’t extra polish. They’re how teams keep quality high while still using AI productively.前端团队,验证得从头开始。组件契约、设计系统护栏、无障碍检查、流程测试、行为审查,这些不是点缀。这是在 AI 时代保质量的命门。

The future of AI-assisted frontend development is not just better prompting. It is better verification.AI 辅助开发的未来,不在于提示词写得多花哨。在于验证做得多扎实。

The views expressed are my own and do not represent those of my employer. 文中观点仅代表个人,与雇主无关。

AI use acknowledgmentAI 使用说明

AI assistance was used lightly for phrasing, editing, and tightening parts of this draft. The article’s ideas, structure, examples, and final review are my own.本文用 AI 润色过措辞、编辑和精简。思路、结构、例子、定稿,都是我自己的。

Post topics: AI & ML