Practice and Evaluation of Building E-commerce Sites with AI Coding Tools
This article evaluates the real-world performance of AI coding tools in complex engineering scenarios by using the task of building a React e-commerce site from scratch as a benchmark. It analyzes common pain points such as architectural planning, UI responsiveness, and execution stability, and proposes practical engineering strategies—including structured prompting, progressive generation, and rigorous code review—using Baidu Comate as an example to help developers effectively leverage these tools.
With the rapid evolution of large language models (LLMs), AI coding tools have become essential for improving development efficiency. From early code completion to project-level generation in modern AI IDEs, AI is gradually taking over tedious coding tasks. However, how do these tools perform in complex business scenarios? This article uses “building a React e-commerce site from scratch” as a benchmark task to deeply analyze the capability boundaries and practical strategies of current AI coding tools in complex engineering scenarios.
1. Benchmark Task Definition and Challenges
To comprehensively evaluate AI coding tools, we defined a representative frontend task: building a complete e-commerce site using React. The site must include 10 core pages: Home (Product List), Product Detail, Checkout, Checkout Success, Login, Register, User Dashboard, User Orders, User Wallet (Vouchers), and User Settings.
The core difficulty is not implementing a single page, but ensuring the site’s completeness and overall consistency. An e-commerce system involves complex state transitions, form validations, route navigation, and persistent user identity states. This requires the AI tool not only to write component code but also to possess global architectural planning, consistent styling control, and engineering thinking for data flow management.
2. Typical Pain Points and Technical Analysis
When testing various AI coding tools, we found that while they excel at single-file generation, they generally expose the following engineering shortcomings when handling multi-page, full-process applications:
1. Lack of Architectural Planning and Engineering Awareness
Many tools tend to use the flattest structure when generating code, leading to highly coupled mock data and view logic. For instance, in the product list and detail pages, AI hardcodes mock data directly inside components without extracting it to a separate Service or API layer. While acceptable in the prototyping phase, this incurs massive refactoring costs in real-world engineering. More seriously, some tools make elementary mistakes during project initialization, such as creating duplicate subfolders of the same name, causing build tools to fail parsing and preventing the project from starting. This reflects the LLM’s limitations in understanding complex directory tree contexts.
2. Fragile UI Standards and Responsive Layout
Visually, AI-generated interfaces often focus either on the PC or on extreme mobile adaptation, lacking mature responsive breakpoint designs. On pages with complex forms, such as login and registration, components frequently suffer from severe style deformation. Furthermore, incomplete CSS style isolation is a high-frequency issue. Because LLMs lack global class namespace management when generating styles for multiple components, style conflicts occur. A typical example is a button component being overridden by its parent container’s styles, resulting in an embarrassing “white text on white background” that makes the button invisible. Additionally, generated pages are often filled with placeholder images, and detail pages are too simplistic for product demonstrations.
3. Trade-off Between Execution Modes and Stability
Current AI IDEs typically offer different generation tiers (e.g., fast generation, auto-build, or architect mode). When handling complex tasks like a ten-page project, the auto-build mode—though claiming to “finish in one go”—often comes with numerous runtime errors, requiring developers to manually intervene repeatedly. Conversely, step-by-step execution offers better controllability but sacrifices overall coherence. Moreover, some tools suffer from slow response speeds due to computing power or scheduling issues, severely disrupting the developer’s flow.
3. Practical Strategies for AI R&D: The Baidu Comate Example
Among various R&D solutions, tools like Baidu Comate have introduced multi-Agent collaboration and layered processing architectures, offering new approaches to the aforementioned issues. Taking Baidu Comate as an example, it provides different modes for tasks of varying complexity.
Its Zulu mode focuses on agile generation, excelling in speed for simple scripts or single pages. However, when building a multi-page e-commerce system, relying solely on this mode easily leads to chaotic directory structures and unclear component responsibilities. To address this, Baidu Comate offers an Architect mode designed for complex engineering. This mode first performs overall architectural planning before dispatching tasks to specific execution modules. Nevertheless, in actual long-chain generation, the Architect mode still faces challenges such as slow service responses and occasional errors during multi-file collaborative generation.
Faced with the capability boundaries of the tools, developers need to shift from “passively accepting code” to “actively guiding the architecture.” When encountering generation errors using Baidu Comate or similar intelligent tools, relying solely on the tool’s “auto-fix” often leads to an infinite loop. The correct approach is to treat it as a “junior developer” and mitigate its flaws through clear engineering constraints.
4. Engineering Recommendations for Efficiently Mastering AI Coding Tools
To maximize the value of AI coding tools in complex scenarios like e-commerce systems, the following practical strategies are recommended:
1. Structured and Constrained Prompts
Avoid throwing broad instructions like “help me write an e-commerce website.” Prompts should be structured, specifying the tech stack (e.g., React 18 + TypeScript + React Router + Zustand), UI framework (e.g., Tailwind CSS), and mandating data decoupling.
Example prompt structure:
Task: Build a React e-commerce frontendArchitecture Requirements:1. The directory structure must include components, pages, services, hooks, context, types.2. All API requests must be encapsulated in services/api.js; components must not contain Mock data directly.3. Styles must use CSS Modules or Tailwind to ensure class name isolation and prevent style override issues like white text on a white background.Page List: [Attach the list of 10 pages]Responsiveness: Use media queries to ensure compatibility with both mobile and PC.
2. Progressive Generation and Modular Acceptance
Even if a tool supports generating an entire project at once, it is not advisable to complete all work in a long context. Break down the 10 pages into independent sub-tasks: foundational architecture setup, core transaction flow (Home - Detail - Checkout), user authentication flow (Login - Register), and the user center module. After completing each module, immediately run it locally to verify there are no errors before proceeding. This effectively prevents fatal errors, such as nested folders with the same name, from being discovered late in the project.
3. Strengthen Context Documentation and Review Mechanisms
Before having the AI generate dependent pages like orders or wallets, prompt it to read the already-generated relevant Context or Hooks files to ensure state management consistency. For the generated code, developers must perform a Code Review, focusing on checking for hardcoded routes, unhandled Promise rejections, and empty directory placeholders.
5. Conclusion
AI coding tools have shown great potential in lowering coding barriers and improving single-point efficiency, but they are still far from autonomously delivering complex e-commerce systems. Whether it is general intelligent IDEs on the market or tools with multi-Agent exploration capabilities like Baidu Comate, developers are required to guide and constrain them from an architect’s perspective. Through structured prompts, progressive generation strategies, and rigorous human review, we can truly integrate these advanced productivity tools into modern software engineering systems, achieving the transition from AI-assisted to AI-collaborative development.
