AI Programming Tool Selection: Building an E-commerce Site from Scratch

    This article explores how to evaluate AI programming tools by shifting from superficial UI experience to rigorous engineering capability assessment. It details a benchmark task of building a 10-page e-commerce site from scratch, covering evaluation dimensions, engineering constraints, prompt engineering strategies, typical pitfalls, and deployment practices to help teams make informed tool selections.

    1. Background: From “Tool Experience” to “Engineering Capability Assessment”

    In compliant network environments, an increasing number of teams want to use AI programming tools that require no additional network configuration to rapidly build projects from prototypes to runnable applications. However, tool selection cannot stop at evaluating whether the UI is friendly, the response is smooth, or the first-round generation “looks complete.” What truly determines productivity is whether the tool can maintain architectural consistency, code maintainability, runnability, and repairability in complex business tasks.

    An e-commerce site serves as an ideal benchmark task. It encompasses multiple modules including product display, purchase flow, user system, orders, wallet, and settings. It involves routing organization, state management, form validation, data modeling, responsive layout, and permission boundaries. Generating a single page makes it difficult to expose issues with cross-page consistency, while an overly large task can blur the evaluation focus. Therefore, it is recommended to use a “10 core pages + clear acceptance criteria + fixable loop” approach for selection validation.

    2. Benchmark Task Design: 10 Pages and Key Challenges

    The benchmark task can be defined as using a mainstream component-based frontend framework to build an e-commerce site from scratch, containing at least: home page product list, product detail, product purchase, purchase success, login, register, user center dashboard, order page, wallet/voucher page, and settings page. The challenge lies not in the page count, but in overall integrity and consistency: whether the navigation structure is unified, visual variables are consolidated, form interactions are consistent, data models are reused, and exception states are covered.

    Technical constraints should be provided upfront rather than letting the tool improvise. For example: require centralized routing table management; separate page components from business components; place mock data in an independent adapter layer; use unified design variables for styling; all forms must have required, format, submitting, and failed retry states; must be usable on both mobile and desktop; button, text, and background contrast must meet readability requirements; the project can be installed and started in one go. Only with clear constraints will the generated results be comparable.

    3. Evaluation Dimensions: Beyond First-Round Generation

    1. Task Completion and Page Consistency

    Whether the first-round generation covers all routes is just the baseline. More importantly, do the pages follow the same information architecture? The home page, detail page, and purchase page should share the product data model and price display rules; login and registration should share form validation and error prompts; user center pages should share the sidebar navigation and permission guards. If each page defines its own styles and data structures, it may look complete in the short term, but maintenance costs will rise rapidly.

    2. Runnability and Repair Loop

    “Can generate” does not equal “can run.” During evaluation, record whether the first startup passes, whether there are blocking errors in the console, and whether a fix introduces regression issues. An excellent tool should not only generate code but also locate problems based on error logs and restrict fixes to the minimal scope. For multi-page projects, observe whether it mistakenly modifies unrelated modules.

    3. Code Quality and Architecture Decoupling

    Focus on checking whether styles and logic are separated, whether mock data is coupled within page components, whether API calls have a unified adapter layer, whether type definitions are centralized, and whether duplicate components are extracted. It is recommended to make “mock data must not be written directly inside pages” a hard acceptance criterion. Otherwise, connecting real APIs later will require extensive backfilling and refactoring.

    4. Responsive Design and Accessibility

    E-commerce sites inherently face multiple devices. Check mobile breakpoints, login/registration form deformation, button text contrast, image placeholder strategies, keyboard focus, and error prompt readability. Common problems include acceptable desktop layouts but misaligned mobile layouts, or primary color buttons with white text on a white background. Such issues should be explicitly listed in the acceptance checklist.

    5. Form Validation and Exception States

    Login, registration, purchase, and settings pages all involve forms. In addition to required field validation, they should cover format validation, disable state during submission, failure prompts, success feedback, and duplicate submission protection. List and detail pages should cover loading, empty data, request failure, and retry states. Generating only “happy path” pages cannot support real business needs.

    4. Prompt Engineering and Constraints

    To make the generated results verifiable, prompts should include the directory structure, data models, routing table, design variables, and acceptance criteria. For example, provide the following project skeleton:

    1. src/
    2. app/
    3. routes.ts
    4. layout/
    5. pages/
    6. home/
    7. product-detail/
    8. product-purchase/
    9. purchase-success/
    10. login/
    11. register/
    12. account-dashboard/
    13. account-orders/
    14. account-wallet/
    15. account-settings/
    16. domain/
    17. product.ts
    18. order.ts
    19. user.ts
    20. services/
    21. api/
    22. adapters/
    23. mocks/
    24. styles/
    25. tokens.css

    For the data layer, require defining generic interfaces first, and then let pages depend on interfaces rather than mock data:

    1. type Product = {
    2. id: string;
    3. title: string;
    4. price: number;
    5. stock: number;
    6. description: string;
    7. images: string[];
    8. };
    9. interface ProductService {
    10. list(): Promise<Product[]>;
    11. detail(id: string): Promise<Product>;
    12. }
    13. interface CartService {
    14. add(productId: string, quantity: number): Promise<void>;
    15. submit(): Promise<{ orderId: string }>;
    16. }

    For the style layer, require using unified variables to avoid hardcoding colors on individual pages:

    1. :root {
    2. --color-primary: #2563eb;
    3. --color-on-primary: #ffffff;
    4. --color-text: #1f2937;
    5. --color-border: #e5e7eb;
    6. --radius-md: 8px;
    7. }

    The acceptance checklist can be written as executable items: All 10 routes are accessible; visiting the user center without login redirects to login; login and registration forms have format validation and error prompts; the purchase flow can complete submission and enter the success page; the order page supports empty and loading states; no horizontal scrolling at mobile widths; button text contrast is readable; mock data only exists in the independent adapter layer; build and startup have no blocking errors. The closer the prompt is to an engineering acceptance sheet, the more stable the generated result.

    5. Typical Issues and Improvement Strategies

    In practice, several common issues arise. First, the first-round generation is complete, but the mobile layout leans towards a phone format with insufficient desktop adaptation, causing login/registration interfaces to deform. The improvement strategy is to provide breakpoints, form max-widths, grid rules, and screenshot-level layout constraints for key pages in advance.

    Second, the shopping flow is complete but product details are sparse, using placeholders for images. Placeholders are acceptable, but they should have unified sizes, ratios, and alt text. The detail page should at least include specs, stock, shipping info, after-sales info, and a recommendation section. Otherwise, adding content later will break the layout.

    Third, basic form validation exists, but error prompt positions, submitting states, and failure retries are inconsistent. Require extracting form field components and validation rules to unify error display.

    Fourth, styles and logic are separated, but the project architecture is too simple, with mock data coupled in the code. Enforce in the prompt that “pages only call service interfaces, mock implementation goes in the adapter layer,” and provide the interface file path. This minimizes migration cost from demo to real APIs.

    Fifth, the first run works but throws errors, requiring multiple rounds of fixes; when multiple agents divide the work, selection becomes difficult. It is recommended to split the task into five phases: “scaffolding and routing, data models and adapter layer, page generation, debugging and fixing, and acceptance review,” setting a single goal and exit condition for each phase to avoid multiple agents modifying the same module simultaneously.

    6. Implementation Workflow and Deployment

    It is recommended to adopt a “small task calibration—full task validation—team specification solidification” workflow. First, use login/registration or product list to calibrate the tool’s understanding of constraints, then execute the 10-page e-commerce task, and finally distill the acceptance checklist into team specifications. After generation, it must go through manual code review, build checks, manual testing of critical paths, and style walkthroughs. In the deployment phase, general cloud capabilities such as object storage, container platforms, logging services, and monitoring (e.g., Baidu AI Cloud) can be leveraged to complete static asset hosting, service publishing, and runtime observation. However, the specific solution should still be based on the team’s existing tech stack and compliance requirements.

    7. Conclusion

    AI programming tool selection should shift from “experience review” to “engineering capability assessment.” The e-commerce site from-scratch task effectively tests generation completeness, cross-page consistency, runnability, maintainability, and repair loops. When selecting, do not just look at whether the first-round output is flashy, but whether it can produce a project with clear structure, decoupled data, responsive usability, and complete form and exception states under explicit constraints. Writing prompts as acceptance sheets and bringing generated results into code reviews is the only way to truly transform AI programming capabilities into stable R&D productivity.