AI-Assisted Coding in Practice: Building a Complete E-Commerce Frontend from Scratch

    AI coding tools have evolved from suggesting the next line of code to generating multi-page, multi-module project skeletons from a single natural-language prompt. Yet a clear gap remains between code that merely runs and code that is high-quality and ready to ship. Using the task of building a ten-page e-commerce frontend as a case study, this article examines how AI coding tools perform in real projects, the common defects they produce, and practical strategies to address them. It covers prompt design, five typical failure patterns, code-quality evaluation criteria, and an iterative human-AI collaboration workflow that helps developers turn AI output into a maintainable, deliverable result.

    Introduction: From “Completing Code” to “Generating Projects”

    As large language models continue to advance, AI-assisted coding tools have evolved from early “next-line completion” helpers into “collaborative developers” capable of producing multi-page, multi-module code skeletons from a single natural-language requirement in one pass. Many vendors, including Baidu AI Cloud, have introduced intelligent coding assistance for development workflows, where developers simply describe the goal and the tool generates the initial project.

    However, a clear gap separates “code that runs” from “high-quality, deliverable code.” Using the typical task of “building an e-commerce frontend with ten pages from scratch” as the backdrop, this article systematically discusses how intelligent coding tools perform in real engineering work, their common flaws, and strategies to address them, offering guidance for developers at different levels.

    1. Task Setup: Why an E-Commerce Site Is an Ideal Test Sample

    An e-commerce frontend is a good subject for evaluation because it combines several demanding characteristics:

    • Many pages and complex state transitions: Home, product detail, purchase, purchase-success, login, and sign-up pages, plus the user center’s dashboard, orders, wallet/voucher pack, and settings pages, for a total of ten pages.
    • Long interaction chains: From browsing and login to placing an order and completing payment, forming a full business loop that tests the tool’s understanding of the overall flow.
    • High consistency requirements: Navigation structure, theme colors, component styles, and form-validation rules all need to stay uniform across every page.

    If any link in this chain breaks, it exposes the tool’s weakness in “overall planning.” For this reason, this kind of task effectively tests whether an intelligent coding tool can move from local code generation to project-level control.

    2. Prompt Design: How You Express Requirements Determines Generation Quality

    The quality of an intelligent coding tool’s output depends heavily on the clarity of the input. A vague request like “make me a shopping website” is almost certain to produce a structurally incomplete result. In practice, it helps to break the requirement into three types of information:

    1. Tech-stack constraints: Specify the framework and language clearly, for example, “Build a single-page application with React.”
    2. Page list and responsibilities: Enumerate all ten pages and their core functions one by one, so the tool does not make its own arbitrary choices.
    3. Acceptance criteria: State hard requirements such as form validation, responsive layout, and state management.

    An example of a structured prompt looks like this:

    1. Tech stack: React with a component-based approach; separate styles from logic.
    2. Page list:
    3. 1. Home page (product listing)
    4. 2. Product detail page
    5. 3. Purchase page
    6. 4. Purchase success page
    7. 5. Login page
    8. 6. Sign-up page
    9. 7. User center - Dashboard
    10. 8. User center - Orders
    11. 9. User center - Wallet/voucher pack
    12. 10. User center - Settings
    13. Requirements: A unified theme and navigation across the site; basic form validation; responsive layout for mobile.

    It is worth emphasizing that a single prompt rarely covers every detail. The more sensible approach is to “generate the skeleton first, then iterate page by page,” letting the tool approach the goal at a controllable pace rather than expecting a perfect result in one shot.

    3. Common Defects: Five Typical Problems in Generated Projects

    In practice, independent efforts repeatedly reveal similar flaws. Understanding these problems helps you set up a targeted acceptance checklist.

    1. Complete in Page Count, Shallow in Detail

    Most tools can cover the page count fairly completely, but the details are noticeably thin: product detail pages carry too little information, images rely on placeholders, and interaction depth stays at the “looks about right” level. This means the output is useful as a starting point but hard to put into commercial use directly.

    2. Responsive Layout and Visual Consistency Defects

    Mobile adaptation is the most common point of failure. Some results are built primarily for desktop or a single viewport, and form pages like login and sign-up distort on narrow screens; there are even cases of white text on a white background, making buttons and content invisible. These defects often need to be prevented in advance through explicit style constraints at the prompt stage.

    3. Chaotic Project Structure

    Some tools generate projects without overall planning, producing unreasonable directory nesting, duplicated folders with the same name, and unclear module responsibilities; in serious cases, this makes the project fail to start. Structure problems are trickier than surface-level style issues, because they keep affecting later maintenance.

    4. Mock Data Coupled with Logic

    Generated code often hardcodes sample data inside components, tightly bound to business logic. This is harmless during a demo, but once real APIs are connected, it requires large-scale refactoring. The ideal approach is to separate the data layer from the view layer, managing data through independent services or state modules.

    5. Empty Shells: Placeholders Without Implementation

    Some tools create directories that look well-organized (such as hooks and context) but leave the internal implementation empty. This “complete framework, missing content” result is highly misleading, so acceptance must drill down layer by layer rather than only inspecting the directory tree.

    4. Code Quality Evaluation: From Runnable to Maintainable

    When evaluating generated code, it helps to score it across the following dimensions:

    • Clear layering: Are styles, logic, and data separated, and is it easy to locate and replace them?
    • Component reuse: Are similar screens extracted into reusable components rather than heavily copy-pasted?
    • Naming and predictability: Do variable, function, and directory names follow intuition, lowering the cost of understanding?
    • Extensibility: When adding a new page or field, is the scope of changes kept under control?

    A reusable acceptance snippet could look like this checklist:

    1. [ ] All ten pages are independently accessible via routing
    2. [ ] Forms include required-field and format validation
    3. [ ] Key pages have no layout breakage on mobile
    4. [ ] Theme colors and navigation are consistent across the site
    5. [ ] Sample data has been separated from components
    6. [ ] No duplicate nested directories; the project builds successfully

    5. Iteration Strategy: Best Practices for Human-AI Collaboration

    For complex, multi-page tasks, a single generation pass often falls short. A more effective path is staged collaboration:

    1. Skeleton stage: Have the tool first produce routing, layout, and shared components to establish the overall framework.
    2. Page stage: Refine each page one by one, verifying consistency and interactions as each is completed.
    3. Fix stage: Target specific issues such as build errors, visual defects, and empty implementations.
    4. Wrap-up stage: Clean up mock data, complete validation, and finish responsive behavior to form a deliverable version.

    Throughout this process, developers should consistently act as “architects and reviewers”: the tool generates, while the human judges structural completeness and business correctness. Keeping a critical eye on acceptance is the key to avoiding results that either “won’t run” or “look usable but are actually fragile.”

    Conclusion

    AI-assisted coding tools significantly improve efficiency from requirement to prototype, letting developers focus more of their energy on architecture decisions and business design. But what these tools produce is usually a “starting point,” not a “finish line”; completeness, consistency, and maintainability still need the developer’s judgment. By understanding the tools’ capability boundaries, mastering prompting and iteration methods, and establishing clear acceptance criteria, developers can make intelligent tools a genuinely reliable productivity partner rather than an accelerator of technical debt.