AI Coding Tools in Real Projects: A 10-Page E-commerce Frontend Test
This article evaluates mainstream AI coding tools by asking them to build a complete 10-page e-commerce frontend from a single prompt. It covers the engineering challenges, a multi-dimensional evaluation framework, common failure patterns, generation modes, practical workflows, and a quality acceptance checklist for teams using AI to build complex frontend projects.
1. Background: Using a Complete Site to Test AI Coding Tools
Around 2024, AI coding tools were mainly used for code completion. Since 2025, conversational programming assistants and autonomous coding agents have become more common. Their role is shifting from “helping write a line of code” to “helping complete a feature.” Discussions about whether these tools can replace traditional IDEs or specialized AI coding products are also increasing. Instead of focusing on brand competition, a more useful question is: what can current mainstream AI coding tools actually deliver in real engineering projects, where do they fail, and how should teams use and constrain them?
A representative test is to ask an AI tool to build an e-commerce frontend from scratch using only one requirement sentence. This may sound like “just making a web page,” but it tests several capabilities at once:
- Engineering understanding: identifying relationships between pages, routes, state, and data;
- Large-scale generation: producing ten pages and over a hundred components in one output;
- Consistency control: maintaining a unified design language, directory structure, and code style;
- Attention to detail: handling easily overlooked engineering details such as form validation, responsive layouts, and error handling;
- Self-repair ability: locating and fixing runtime errors autonomously.
This article first defines the task setup and key difficulties, then proposes a multi-dimensional evaluation framework. It then analyzes common weaknesses based on typical practices and finally provides practical methods and quality acceptance strategies.
2. Task Setup: Why a 10-Page E-commerce Site Is a Useful Test Case
Basic conditions: Provide only one natural-language requirement, specify a component-based frontend framework, and ask the tool to produce a complete project with the following ten pages in one go:
| Area | Pages | Core capability tested |
|---|---|---|
| Product browsing | Homepage (product list), Product detail | List rendering, route navigation, information organization |
| Purchase flow | Checkout page, Purchase success page | Form validation, order summary, flow continuity |
| Identity authentication | Login page, Registration page | Form rules, password confirmation, field constraints |
| User center | Dashboard, Orders, Wallet (vouchers/coupons), Settings | Data state management, cross-page consistency, authorization awareness |
Why can this task distinguish tool capabilities effectively? The core difficulty is not any single page, but overall completeness and consistency:
- Completeness: Is the flow from browsing, ordering, to payment completion fully connected? Are all user-center pages actually reachable, or do they only contain directories and titles?
- Consistency: Ten pages are generated by the same tool in a short time. Can they share the same design language and code conventions?
- Data continuity: Can states such as shopping cart and orders be maintained across pages, rather than each page maintaining its own fake data?
- Maintainability: Can developers take over the generated code and continue iterating, rather than only viewing the result once?
It is important to note that single-page generation and multi-page engineering are different in scale. The former only needs to ensure that one component renders correctly. The latter involves route configuration, state management, data contracts, reuse conventions, and error handling. If any part fails, the problem will often appear as chaotic directory structures, inconsistent page styles, or runtime errors.
3. Evaluation Framework: Five Dimensions from “Can It Run?” to “Can It Be Maintained?”
When comparing different AI coding tools, it is better to use a reusable evaluation framework rather than judging only by whether the first-run UI looks good.
1. Completeness and runnability
- Are all ten pages generated and reachable through routes?
- Can the project run directly after the first generation, or does it require several rounds of error fixing?
- Can the purchase flow complete: add to cart → go to checkout → submit order → reach success page?
2. Consistency
- Are colors, fonts, spacing, border radius, and button styles unified?
- Do similar pages, such as the orders page and wallet page, share a consistent layout structure?
- Are components reused, or does every page define its own cards and buttons?
3. Detail completeness
- Do forms include validation for required fields, formats, length, and secondary confirmation?
- Are error states, empty states, and loading states handled?
- Are static resources such as images and icons complete?
4. Responsive design and accessibility
- Are layouts reasonable on desktop, tablet, and mobile devices?
- Are there mobile issues such as horizontal scrolling, truncated text, or overflowing buttons?
- Does the contrast between foreground and background colors meet readability standards?
5. Architecture and code quality
- Is the directory structure clear, with pages, components, state, services, and mock data separated?
- Are there nested duplicate directories, empty shell files, or placeholder implementations?
- Is business logic tightly coupled with presentation code? Are styles inline?
A simplified reference scoring table is shown below (weights can be adjusted based on team priorities):
| Dimension | Suggested weight | Key scoring points |
|---|---|---|
| Completeness | 25% | All pages present, complete flow, runnable on first attempt |
| Consistency | 20% | Unified design, component reuse, tidy structure |
| Detail completeness | 20% | Form validation, state handling, complete resources |
| Responsive design and accessibility | 15% | Multi-device adaptation, compliant contrast |
| Architecture and code quality | 20% | Clear layering, no coupling, maintainable |
4. Generation Mode Analysis: One-Shot Generation vs Iterative Repair
In practice, AI coding tools generally provide two collaboration modes, each with suitable boundaries.
1. Single-agent one-shot generation
Under a single task instruction, the agent plans and generates all code at once. The advantage is low interaction overhead and coherent context. For a new project starting from zero, this mode can often produce a runnable version quickly.
However, one-shot generation has an implicit constraint: output size is directly related to context capacity. Ten pages often mean dozens of files and thousands of lines of code. Once the context window is exceeded, the model may have to compress details. Common consequences include:
- Later pages are simplified or even omitted;
- Shared components and states across pages exist only in name and are effectively empty;
- Details not emphasized in the requirement, such as mobile adaptation or contrast, are ignored by default.
2. Iterative repair mode
In this mode, the tool first runs the project, and the agent repeatedly fixes issues based on error logs and screenshots. This “generate → run → repair” loop can significantly improve the final success rate, but the cost is not negligible:
- Multiple rounds increase time cost, and generation speed becomes a user-experience bottleneck;
- If repairs are not focused, fixing one issue may break another, making the code harder to manage;
- When the agent lacks access to the runtime environment, it often has to modify code based on inference, reducing the accuracy of repairs.
3. Recommendations for mode selection
| Scenario | Recommended mode | Reason |
|---|---|---|
| New project from scratch with clear requirements | Generate a skeleton in one shot, then iterate to complete it | Reduce context switching and maintain design consistency |
| Incremental development in an existing project | Make small changes and verify locally | Avoid broad changes that introduce regressions |
| Error repair | Provide the full error stack and reproduction steps | Improve repair accuracy |
| Complex multi-module collaboration | Generate in stages and assign work across multiple agents | Reduce single-agent context pressure |
5. Seven Common Problems in Practice and Their Causes
Based on common feedback for tasks such as building an e-commerce site, the following high-frequency issues can be summarized. They are not unique to any specific tool, but rather common boundaries of current generative programming.
Problem 1: It can run, but errors keep appearing
After the first generation, multiple rounds of repair are often required before the complete result can be seen. The cause is that the model lacks real awareness of the runtime environment, including dependency versions, build tools, and routing configuration, and can only infer based on common patterns in training data. A practical strategy is to leave running and verification to deterministic tools, letting AI focus on generation and diagnosis rather than guessing the environment.
Problem 2: Duplicate subdirectories appear
During multi-agent collaboration or repeated generation, directory structures may become chaotic, with a folder nested inside a folder of the same name, eventually causing build failures. The cause is that multiple agents maintain their own file lists without a global directory constraint. A practical strategy is to place a directory rules file in the project root and provide it as context before every generation, clearly stating that “creating directories not registered in the specification is prohibited.”
Problem 3: Hooks and context are reserved but empty
The directory structure may look well organized, but the actual business logic is still piled inside page components. Reserved contexts and custom hooks are merely empty shells. This is a typical sign of “structural imitation” rather than “structural understanding.” A practical strategy is to explicitly require that state lifting and data access must be implemented in designated modules, and to check during acceptance whether these files contain actual implementations.
Problem 4: Mock data is coupled with business code
Product, order, and user data may be hard-coded inside page components, requiring large-scale changes when connecting to real APIs later. The cause is that the model tends to make pages look complete first, using the shortest code path. A practical strategy is to enforce contract-first development: define types and interfaces first, let pages depend only on interfaces, place mock data in an independent directory, and replace it through dependency injection or an adapter layer.
Problem 5: Mobile layouts do not adapt well, and color contrast is insufficient
The desktop version may look acceptable, but horizontal scrolling appears when the width is reduced to mobile size. Some buttons may become invisible due to white text on a white background. The former is usually caused by not using flexible layouts and breakpoint strategies. The latter is caused by the model lacking contrast awareness. A practical strategy is to explicitly require responsive breakpoints, agree on design tokens so that colors, spacing, and border radii use variables, and use automated contrast checking tools for validation.
Problem 6: Missing details
The product detail page may contain too little information, all images may be placeholders, and form validation may be inconsistent. This is an inevitable trade-off of breadth-first generation: the model prioritizes page count and leaves details for later. A practical strategy is to proceed in stages: first generate a skeleton, then fill in details page by page, with a clear definition of done for each stage.
Problem 7: Slow generation and response latency
In multi-agent mode, slower service response can significantly extend the overall timeline, and teams often feel the need to speed things up. A practical strategy is to turn waiting time into parallel value: let one agent generate code while human reviewers review the architecture and prepare test cases, avoiding serial waiting.
6. Practical Methods: Making AI Deliver Complex Projects Reliably
1. Generate in stages: Break a large task into verifiable steps
Do not ask the tool to generate a complete ten-page e-commerce site in one request. A more reliable approach is to proceed in stages, with clear deliverables and acceptance criteria for each stage.
Stage 1: Project skeleton- Deliverables: directory structure, route table, dependency list, basic layout components- Acceptance: project can start, homepage displays placeholder contentStage 2: Data contracts- Deliverables: type definitions for products, cart, orders, users, and a mock data directory- Acceptance: types can be referenced by any page, mock data can be accessed through a unified entry pointStage 3: Shared modules- Deliverables: reusable components such as navigation, footer, product card, button, and input- Acceptance: actually referenced in at least two pagesStage 4: Core flow pages- Deliverables: list page → detail page → checkout page → success page- Acceptance: flow can be completed, state persists across pagesStage 5: User center- Deliverables: login, registration, dashboard, orders, wallet, settings- Acceptance: form validation is complete, unauthenticated users are redirected to login when accessing protected pagesStage 6: Responsive design and accessibility- Deliverables: breakpoint adaptation, contrast fixes, keyboard accessibility- Acceptance: no horizontal scrolling on mobile, contrast meets standardsStage 7: Cleanup and finalization- Deliverables: remove placeholder resources, unify naming, add basic tests- Acceptance: build has no warnings, lint passes
2. Constrain generation behavior with a rules file
Maintain a concise PROJECT_RULES.md file (or an equivalent rules file) in the project root and provide it as context in every conversation. Recommended contents include:
- Directory conventions: where pages, components, state, and mock data should be placed;
- Prohibited actions: do not create directories not registered in the specification; do not hard-code business data inside page components; do not use inline styles that override design tokens;
- Definition of done (DoD): every page must include loading, empty, and error states;
- Naming conventions: components use PascalCase, utility functions use camelCase, constants use uppercase.
The purpose of this file is to make implicit engineering rules explicit so that the model has clear references rather than relying freely on training data each time.
3. Define data contracts first and decouple mock data
The following illustrative code shows a recommended organization pattern for a typed frontend project:
// src/types/product.ts — shared data contractsexport interface Product {id: string;title: string;price: number; // stored in the smallest currency unit to avoid floating-point errorscurrency: 'CNY';cover: string;stock: number;description: string;}export interface CartItem {productId: string;quantity: number;}export interface Order {id: string;items: CartItem[];total: number;status: 'pending' | 'paid' | 'shipped' | 'completed' | 'cancelled';createdAt: string;}
// src/services/productService.ts — pages depend on the interface, not the data sourceimport type { Product } from '../types/product';export interface ProductRepository {list(): Promise<Product[]>;getById(id: string): Promise<Product | undefined>;}export function createProductRepository(source: Product[]): ProductRepository {return {async list() {return source;},async getById(id) {return source.find((item) => item.id === id);},};}
// src/data/mockProducts.ts — mock data is stored centrally and can be replaced with real requests laterimport type { Product } from '../types/product';export const mockProducts: Product[] = [{id: 'p-1001',title: 'Example Product A',price: 19900,currency: 'CNY',cover: '/assets/product-a.webp',stock: 120,description: 'Product description for demonstration.',},];
The benefit of this approach is that switching to a real backend only requires replacing the implementation of createProductRepository; page components do not need to change. Conversely, if product data is scattered across page components, connecting to an API becomes a full-site refactoring effort.
4. State management and cross-page consistency
Data that needs to be shared across pages, such as the shopping cart, login state, and orders, should be placed in a global state layer, such as Context + Reducer or a state management library, rather than maintained separately by each page. Recommended conventions include:
- Single source of truth: maintain cart item counts only in global state; both the navigation badge and checkout page should read from there;
- Do not duplicate derived data: calculate totals and discounts with selectors instead of storing separate copies;
- Make persistence explicit: states that must survive refresh should be handled by a unified persistence middleware, rather than each page reading and writing local storage independently.
// src/store/cartStore.tsx — example: global cart stateimport { createContext, useContext, useReducer } from 'react';interface CartState {items: { productId: string; quantity: number }[];}type CartAction =| { type: 'add'; productId: string; quantity: number }| { type: 'remove'; productId: string }| { type: 'clear' };function cartReducer(state: CartState, action: CartAction): CartState {switch (action.type) {case 'add': {const existing = state.items.find((i) => i.productId === action.productId);if (existing) {return {items: state.items.map((i) =>i.productId === action.productId? { ...i, quantity: i.quantity + action.quantity }: i,),};}return { items: [...state.items, { productId: action.productId, quantity: action.quantity }] };}case 'remove':return { items: state.items.filter((i) => i.productId !== action.productId) };case 'clear':return { items: [] };default:return state;}}const CartContext = createContext<CartState | null>(null);export function CartProvider({ children }: { children: React.ReactNode }) {const [state, dispatch] = useReducer(cartReducer, { items: [] });return <CartContext.Provider value={state}>{children}</CartContext.Provider>;}export function useCart() {const ctx = useContext(CartContext);if (!ctx) throw new Error('useCart must be used within CartProvider');return ctx;}
5. Design tokens: Solving poor colors and insufficient contrast at the source
Consolidating colors, spacing, border radii, and font sizes into design tokens reduces style drift and contrast issues. When the model generates new pages, it references variables instead of hard-coded color values.
/* src/styles/tokens.css */:root {--color-primary: #1f5eff;--color-on-primary: #ffffff; /* text on primary color; contrast with primary should be at least 4.5:1 */--color-surface: #ffffff;--color-on-surface: #1a1a1a; /* body text on surface */--color-border: #e5e6eb;--space-1: 4px;--space-2: 8px;--space-3: 16px;--space-4: 24px;--radius-sm: 4px;--radius-md: 8px;--font-size-sm: 14px;--font-size-md: 16px;}
If the requirement explicitly states that all colors must come from design tokens and hard-coded hexadecimal color values inside components are prohibited, low-level defects such as white text on a white background can be largely eliminated.
6. Write responsive strategy into the requirements
/* Mobile-first: default single column; expand to multiple columns on wider screens */.product-grid {display: grid;gap: var(--space-3);grid-template-columns: 1fr;}@media (min-width: 640px) {.product-grid { grid-template-columns: repeat(2, 1fr); }}@media (min-width: 1024px) {.product-grid { grid-template-columns: repeat(4, 1fr); }}
Also add a requirement such as “the page must not have horizontal scrolling at 375px width,” which can significantly improve mobile behavior.
7. Explicitly declare form validation rules
Form validation for login, registration, and checkout pages should not be left entirely to the model. It is better to provide a clear rule list:
- Email: non-empty and matches a basic email format- Password: 8–20 characters, containing at least letters and numbers- Confirm password: must match the password- Shipping address: cascading administrative region selection; phone number must follow a valid format for the selected country/region- Coupon code: non-empty, length 6–12, only uppercase letters and digits allowed
The more specific the rules, the more stable the generated result. A vague instruction such as “do good form validation” almost certainly leads to omissions.
7. Quality Acceptance Checklist
After generation, verify the following items one by one before delivering the result:
- All ten pages are reachable through routes, with no 404 or blank pages
- Build and type checks pass without errors or warnings
- All image resources exist, with no placeholders remaining
- Form validation covers required fields, formats, length, and secondary confirmation
- Cart item counts remain consistent across navigation, detail page, and checkout page
- No horizontal scrolling at 375px mobile width
- Body text contrast ratio ≥ 4.5:1; large text ≥ 3:1
- Protected pages redirect unauthenticated users to the login page
- No nested duplicate directories or empty shell files
- Mock data is centralized in an independent directory, making replacement cost low
The first four items relate to functional correctness, the next four to experience and accessibility, and the final two to maintainability. The weights of these areas should be adjusted according to the project stage. During prototype validation, the latter two groups may be relaxed; before formal development, all items must be met.
8. Practical Recommendations for Teams
1. Clarify human-AI division of labor
Let AI handle repetitive and templated work, such as page skeletons, forms, list rendering, and initial style drafts. Humans should remain responsible for architecture decisions, data modeling, security strategy, and acceptance review. Fully letting go or fully distrusting AI will both reduce overall efficiency.
2. Establish a “generate → validate → accumulate” loop
After each generation, immediately run builds and checks, and send error logs back to the tool as-is. At the same time, accumulate effective prompts, rules files, common issues, and fixes into a team knowledge base so that they become reusable assets.
3. Multi-agent collaboration needs a single owner for directory structure
If multiple agents work in parallel, designate a single authoritative source for directory structure and require each agent to read that specification before writing files. Without constraints, multi-agent collaboration most often results in chaotic structure and build failures.
4. Pay attention to data security and compliance
Avoid including real business data, user information, and internal API details in requirement descriptions. For confidential projects, prefer options that support private deployment or data residency, and clarify ownership and usage boundaries of code assets at the organizational level. Enterprises can also use common cloud capabilities such as object storage, image repositories, and logging services to bring AI-generated artifacts into unified artifact management and observability.
9. Conclusion
The value of tasks such as “use AI to build a ten-page e-commerce site from scratch” is not to compare which tool generates a better-looking interface, but to compress a complex engineering project into a capability stress test. Completeness, consistency, responsiveness, accessibility, and architecture clarity will all be amplified at the scale of ten pages.
For developers, a more practical mindset is to treat AI as a junior engineer who is capable but needs clear instructions and acceptance criteria. If you provide clear directory rules, explicit data contracts, specific validation rules, and an executable acceptance checklist, AI can significantly reduce the time spent on boilerplate code and page construction. Conversely, if you provide only a vague requirement and expect perfect delivery, the result is likely to be “runnable but hard to maintain.”
Tools will continue to evolve, and generation quality will keep improving. However, engineering judgment, architecture design ability, and quality awareness remain irreplaceable core competencies for developers.
