AI Coding Tool Selection Guide: Engineering Practices for Building an E-commerce Site from Scratch
This article provides a technical framework for evaluating AI coding tools in complex projects, focusing on task planning, project architecture, code consistency, error repair, and responsiveness. Using a 10-page e-commerce frontend as a practical scenario, it examines common engineering challenges, prompt design strategies, code review checklists, and best practices for integrating AI assistants into existing development workflows.
Introduction: AI Coding Tools Enter an Engineering-Oriented Competition Phase
As large language model technology evolves rapidly, AI coding tools have moved beyond early code-completion plugins to become intelligent development assistants capable of understanding project context, planning tasks autonomously, and editing multiple files collaboratively. The industry generally frames competition at this stage around three dimensions: model capability (code generation quality and reasoning depth), engineering capability (project structure management, dependency handling, and cross-file consistency), and interaction experience (transparency of task planning and efficiency of error repair).
For developers working in regions with network restrictions, or those working primarily in a non-English language context, additional practical factors include network reachability, language-context understanding, and compatibility with local mainstream technology stacks. This article does not evaluate or recommend any specific commercial product. Instead, it takes a general technical perspective to outline the performance dimensions of AI coding tools in complex projects and uses “building an e-commerce site from scratch” as a practical scenario to analyze common engineering challenges and best practices.
1. Core Evaluation Dimensions for AI Coding Tool Selection
When choosing an AI coding tool, it is advisable to evaluate it systematically across the following five dimensions rather than focusing only on the speed or accuracy of a single code generation.
1.1 Task Planning and Execution Modes
Common task execution modes in the industry currently fall into two categories:
- Single-turn instruction mode: The user enters a natural-language description, and the tool generates code in one pass. This is suitable for small scripts or independent components, but in multi-page, multi-module projects it can easily lose global consistency.
- Agent mode: The tool breaks a complex task into multiple subtasks and plans, executes, and verifies them step by step. Some tools support an Auto Mode in which the model decides the next action autonomously; others use a guided mode (such as Craft or Builder) that requests user confirmation at key points.
From an engineering practice perspective, agent mode is better suited to medium and large projects, but attention should be paid to whether its task decomposition granularity is reasonable, whether intermediate states are traceable, and whether error handling includes self-repair capability. Decomposition that is too coarse can produce results that deviate significantly from expectations, while decomposition that is too fine-grained may slow overall efficiency.
1.2 Project Structure and Architectural Soundness
A maintainable frontend project should have a clear layered structure: routing layer, page component layer, common component layer, state management layer, service layer (API requests), utility function layer, and static asset layer. Whether an AI tool generates a project that follows this layering directly determines the effort required for subsequent development.
Common architectural issues include:
- Repeatedly creating folders with the same name in the project root, causing confusion in path resolution
- Coupling mock data with business logic in the same file instead of maintaining an independent mock layer
- Failing to split style files by component and piling everything into global styles
- Creating reserved directories such as
hooksandcontextbut leaving them empty, resulting in a “pseudo-architecture”
1.3 Code Quality and Consistency
Code quality can be measured from three angles: readability, maintainability, and extensibility. Specific indicators include whether styles and logic are separated, whether duplicate code exists, whether naming is standardized, whether form validation is complete, whether error boundaries are handled, and whether responsive adaptation is in place.
Cross-page consistency is a key challenge in e-commerce projects. Ten pages involve a unified navigation structure, a unified color scheme, and unified interaction feedback (loading, empty, and error states). AI tools need to maintain consistency in these design tokens during generation.
1.4 Error Repair and Iteration Efficiency
The probability of perfection on the first generation is extremely low, so a tool’s error localization capability and repair iteration efficiency are more important. A strong tool should be able to accurately read runtime error messages, locate the specific file and line number, provide a fix and apply it automatically, and verify whether the fix introduces new problems.
1.5 Response Speed and Stability
Service response speed directly affects development flow. Key considerations include first-token latency for code generation, timeout handling for long tasks, and service stability under high concurrency. For users in regions with network restrictions, it is also important to confirm whether the service can be accessed stably without extra network configuration.
2. Practical Scenario: Engineering Challenges in Building an E-commerce Site from Scratch
The following uses a typical frontend e-commerce site as an example to analyze problems that may arise when using AI coding tools in a real project and how to address them. The project requirements are as follows:
Technology stack: React + React Router + state management (Context or a lightweight solution)
Page list (10 pages total):
- Home page (product list page)
- Product detail page
- Product purchase page
- Purchase success page
- User login page
- User registration page
- User center - Dashboard
- User center - Orders
- User center - Wallet (coupons and cards)
- User center - Settings
Prompt example:
Build a frontend shopping site with React that includes the following 10 pages: [page list].Requirements: a unified navigation bar and footer, responsive layout for mobile, complete form validation,mock data stored separately, and separation of styles and logic.
2.1 Common Issues During Task Planning
In agent mode, the tool first needs to decompose the requirements into an executable sequence of subtasks. A reasonable decomposition should follow the “infrastructure first” principle: first set up the project scaffold and routing skeleton, then implement common layout components, then develop pages one by one, and finally integrate and test.
Common deviations in practice include:
- Disordered page development order: Building the user center before the home page, causing repeated adjustments to navigation structure and data flow
- Ignoring dependencies: Developing pages that depend on the user login state before defining the global state structure
- Missing verification steps: Trying to run the project only after all code is generated, exposing many errors at once and making them difficult to localize
It is advisable to explicitly require the tool in the prompt to first output an architecture design summary (including directory structure, route table, and state data structure) and then proceed to coding after confirmation. Some tools support inserting manual confirmation points during task execution, and this capability should be fully used.
2.2 Strategies for Ensuring Code Consistency
For an e-commerce site with 10 pages, the most common problem is that “each page has a different style.” When generating each page independently, an AI tool may make different choices for navigation bar height, button border radius, and spacing system.
Solutions include:
Strategy 1: Define design tokens first. Create a unified theme configuration file during project initialization:
// src/styles/theme.jsexport const theme = {colors: {primary: '#165DFF',success: '#00B42A',warning: '#FF7D00',danger: '#F53F3F',textPrimary: '#1D2129',textSecondary: '#4E5969',bgPage: '#F7F8FA',},spacing: { xs: 4, sm: 8, md: 16, lg: 24, xl: 32 },radius: { sm: 4, md: 8, lg: 12 },fontSize: { body: 14, title: 18, heading: 24 },};
Strategy 2: Extract common layout components. Encapsulate the navigation bar, footer, and page container into a Layout component for reuse across all pages:
// src/layouts/MainLayout.jsximport { NavBar, Footer } from '../components';export default function MainLayout({ children }) {return (<div className="page-container"><NavBar /><main className="page-content">{children}</main><Footer /></div>);}
Strategy 3: Establish page component conventions. Each page component follows the same file structure: index.jsx (entry), styles.module.css (styles), hooks.js (page-level logic), and mock.js (mock data for that page).
Clearly specifying these constraints in the prompt can significantly improve the consistency of generated results. For example:
First create theme.js to define design tokens, then create the MainLayout component.All pages must be wrapped in MainLayout, and styles must use CSS Modules.
2.3 Form Validation and Business Completeness
An e-commerce site involves multiple form scenarios such as login, registration, purchase, and settings. Complete form validation should cover:
- Required-field validation: Prompt when a field is empty
- Format validation: Email, phone number, password strength
- Business validation: Password confirmation consistency, coupon code validity
- State feedback: Position and style of error messages when validation fails
Common issues in AI-generated forms include incomplete validation rules (only required-field validation), error messages not associated with fields, no loading state after submission, and failure to preserve user input after an error.
It is advisable to provide a clear validation rule table in the prompt:
Login form: phone number (required, 11 digits), password (required, 6–20 characters)Registration form: phone number (required, 11 digits), verification code (required, 6 digits),password (required, 6–20 characters, including letters and numbers), confirm password (must match password)
2.4 Responsive Adaptation and Visual Details
Mobile adaptation is a hard requirement for e-commerce sites. Pages generated by AI tools may perform normally on desktop but often exhibit issues on mobile: abnormal navigation bar collapse, horizontal table overflow, tap targets that are too small, and font sizes that are not scaled.
It is advisable to introduce responsive breakpoint conventions at the start of the project:
/* src/styles/breakpoints.css */:root {--bp-mobile: 375px;--bp-tablet: 768px;--bp-desktop: 1024px;}@media (max-width: 768px) {.page-content { padding: 0 12px; }.nav-links { display: none; }.nav-mobile-toggle { display: block; }}
For visual details, pay particular attention to the contrast between button text color and background color, the display effect of image placeholders, and the presentation of empty states and loading states. AI tools often use placeholder image services; verify their reachability in the target network environment or replace them with local placeholder images.
2.5 Mock Data Management
Coupling mock data with page code is a common issue in AI-generated projects. This leads to the need to search file by file when modifying data, the inability to simulate API latency, and difficulty switching to a real API.
A recommended practice is to establish an independent mock layer:
// src/mocks/products.jsexport const productList = [{ id: 1, name: 'Product A', price: 99.00, image: '/assets/p1.png', stock: 100 },// ...];// src/services/productService.jsimport { productList } from '../mocks/products';export async function fetchProducts() {await new Promise(r => setTimeout(r, 300)); // Simulate network latencyreturn productList;}
When it is time to connect to a real backend, only the implementation in productService.js needs to be changed; page components do not need modification.
3. Technical Analysis of Multi-Agent Modes
Some tools offer multiple agent modes, such as a “fast mode” and an “architecture mode.” From a technical perspective, the core difference is:
- Fast mode: The model generates code directly from requirements with fewer planning steps and faster response, but it can easily lose the global structure in complex tasks.
- Architecture mode: The model first performs requirements analysis, architecture design, and task decomposition, and then generates code step by step. Response is slower, but the structure is more reasonable.
The choice should be based on task complexity rather than personal preference. For an e-commerce site with 10 pages, it is advisable to use architecture mode or phased execution: the first phase generates the project skeleton and common components, the second phase generates pages module by module, and the third phase performs integration testing and repair.
Note that regardless of the mode, AI-generated code requires human review. Common review points include:
- Whether the route configuration covers all pages and whether path naming is standardized
- Whether state management is necessary (simple page-level state should not be elevated to global state)
- Whether there are unused imports and variables
- Whether styles pose a risk of global pollution
- Whether sensitive operations (such as payment confirmation) have a secondary confirmation mechanism
4. Best Practices Summary and Tool Selection Recommendations
4.1 Prompt Engineering Key Points
- Specify the technology stack and versions: Avoid incompatible dependency versions selected by the tool
- Provide the page list and route table: Help the tool build a global view
- Architecture before coding: Require the tool to first output the directory structure and data flow design
- Execute in phases: Split large tasks into multiple prompts such as “scaffold → common components → page development → integration and repair”
- Specify validation rules and mock data conventions: Reduce later rework
4.2 Code Review Checklist
□ Does the project start normally without missing dependencies?□ Does routing cover all 10 pages?□ Are the navigation bar and footer displayed consistently on all pages?□ Is form validation complete, and are error messages user-friendly?□ Is there no horizontal scrolling at mobile width (375 px)?□ Is the contrast between button text and background sufficient?□ Is mock data independent of page components?□ Are styles separated from logic?□ Is there duplicate code that can be extracted into shared components?□ Are there any errors or warnings in the console?
4.3 General Capability Reference for Cloud Services
In AI-assisted development, Baidu AI Cloud offers general capabilities spanning model invocation, application development, and coding assistance, including LLM inference services, intelligent coding assistants, and DevOps toolchain integration. When selecting tools, developers can use criteria such as whether a provider offers stable model API services, supports private deployment or data isolation, and provides complete documentation and SDKs as general standards for evaluating cloud service providers. Baidu AI Cloud provides products and services across these general capability dimensions; the specific choice should be evaluated against the team’s technology stack and compliance requirements.
Conclusion
AI coding tools are evolving from “code generators” into “development collaborators.” For projects such as e-commerce sites that have a clear structure but many details, a tool’s task planning capability, architectural soundness, and ability to ensure code consistency are more important than single-generation speed. Developers should establish a complete workflow of “prompt design → phased execution → code review → iterative repair,” embedding AI tools into existing engineering practices rather than replacing them. Regardless of which tool is chosen, final delivery quality still depends on the developer’s control over architecture design and understanding of business details.
