Engineering-Grade Selection of AI Coding Tools: Building a Complete E-Commerce Frontend from Scratch
When evaluating AI coding tools, the real question is not whether they can generate a single page, but whether they can reliably deliver a complete, consistent, and maintainable frontend site. This article turns that challenge into an engineering method, using an e-commerce frontend as a benchmark: defining acceptance criteria, comparing tools on the same business flow, organizing code structure, scripting fixes for common failure points, and knowing when to take over manually. It also covers how to connect a prototype to general cloud capabilities.
When a development team adopts AI coding tools, the real question is not “can it generate a page?” but “can it reliably deliver, from scratch, a structurally complete, visually consistent, and continuously iterable frontend site?” An e-commerce site is an ideal benchmark: long business flows, many page states, and intertwined forms and permissions. This article abstracts that product experience into an engineering method—how to define the task, how to verify the output, and where generated results typically fail.
1. Write the Acceptance Criteria Before the Tool Starts
Selection failures usually stem not from weak models but from vague task descriptions that list only a tech stack and page names, without a definition of done. A good practice is to fix a “minimum viable e-commerce frontend” as ten user paths, written as checkable acceptance items rather than slogan-style requirements.
The page scope can include: home product list, product detail, checkout, payment success, login, register, user center overview, order list, wallet and coupons page, and account settings. For each page, agree on at least four things: where the entry point comes from, where it navigates on success, how empty states and errors are displayed, and whether the primary action can be completed on both desktop and narrow screens.
Completeness should also cover cross-page consistency: the same navigation, the same primary color and type scale, the same button and form components, and the same meaning for price and stock fields. If the list page says “price,” the detail page says “amount,” and the checkout page says “total due,” you will create hidden defects when integrating real APIs later. Authentication state must be unified too: unauthenticated access to checkout and the user center should redirect to login, and successful login should return to the original intended page rather than always the homepage.
Prompts should be short and strict. Avoid mixing aesthetic preferences, directory structure, validation rules, and data sources into one long paragraph. A recommended structure is four sections: information architecture, interaction constraints, engineering constraints, and prohibitions. For example: use a component-based frontend approach; share one unified routing scheme; separate styles from behavior; keep products, users, and orders in independent mock data modules and forbid writing large chunks of fake data into views; use replaceable image URLs with fallback placeholders for load failures; give every submittable form required-field, format, and duplicate-submission protection; on narrow screens, primary buttons and inputs must not overlap or lack contrast. Explicit prohibitions significantly reduce the “looks like ten pages but is actually ten copies” outcome.
2. Compare Tools on the Same Business Flow, Not on Screenshots
When comparing different AI coding environments, use the same prompt, the same acceptance checklist, and the same cap on automatic repair rounds. Allow at most three rounds of automatic fixes, and record whether the first run starts, whether errors are locatable, and whether fixes introduce new page breakage. Judging only by a good-looking first screen overestimates a tool; judging only by final lines of code underestimates interaction completeness.
Observable dimensions:
First, single-pass task completion. Some environments generate the whole site in one shot, some plan first and build step by step, and some offer multiple agent roles. The pattern name doesn’t matter—what matters is: whether planning exposes directories and routes, whether the generation process can be interrupted while keeping pages that already passed, and whether a failure triggers redoing only the failed module. One-shot generation is fast, but once a directory is nested incorrectly, later repair costs exceed those of step-by-step generation.
Second, running and diagnostics. The ideal result is that after dependency installation the project starts, the console shows no blocking errors, and all ten pages are reachable by route. Common failures include: same-named directories nested recursively breaking entry resolution, references to modules that were never created, route paths inconsistent with file names, and builds that pass but hit null references at runtime. In these cases, require the tool to first output the dependency relationships and startup commands, then modify business code—avoid patching repeatedly on a broken project skeleton.
Third, interaction completeness. The purchase flow should include at least: selecting specifications or quantity, validating stock and address-type fields, a submitting state, and a success page showing the order number. Login and registration should have format validation, password visibility toggling, error messages, and duplicate-submission protection. The user center should allow navigating from an order back to the detail page semantically, not just display static copy. Complete form validation and richer detail fields are usually more valuable than “hitting the page count.”
Fourth, UI consistency and accessibility. Unified primary color, sufficient button-background contrast, login and registration that don’t break on narrow screens, and tap targets not obscured by fixed bars. White text on white backgrounds, desktop-only widths, and irreplaceable image placeholders are all delivery defects—even if the navigation flows work, they should not pass.
Fifth, code maintainability. Separated styles and scripts, independent mock data, and centralized route configuration are the minimum bar. Beyond that, look for clear page, component, service, and state layers—rather than empty extension folders for show. An empty state-management or shared-logic directory means the tool “knows good structure” but never actually extracted the state; you will still rewrite it when connecting real APIs.
Sixth, responsiveness and cost. Slow generation, repeated fixes, and context loss all turn nominally free usage into high time cost. Record the wall-clock time from submitting the prompt to a clickable demo, and whether output converges within three rounds. Don’t mistake occasional speed for capability—check whether the same task is stable across two runs.
3. A Recommended Information Architecture and Code Organization
Whatever the tool generates, define the target structure manually first and pull the output back to it when it drifts. A sufficient, non-over-engineered frontend structure:
- Site level: app entry, route table, global layout (header, footer, user entry), theme variables.
- Page level: the ten route pages handle orchestration only and never hard-code product arrays.
- Component level: product card, price display, quantity stepper, address form, order row, empty and error states.
- Data level: four mock data sets—products, session, orders, coupons—with field names decoupled from page copy.
- Capability level: form validation functions, price formatting, route guards. Guards only check “is there a session” and never duplicate redirect logic per page.
A minimal route-and-guard sketch, framework-agnostic enough for any AI coding environment to complete:
routes = [{ path: "/", page: "ProductList", auth: false },{ path: "/product/:id", page: "ProductDetail", auth: false },{ path: "/checkout/:id", page: "Checkout", auth: true },{ path: "/checkout/success", page: "PaySuccess", auth: true },{ path: "/login", page: "Login", auth: false },{ path: "/register", page: "Register", auth: false },{ path: "/account", page: "Dashboard", auth: true },{ path: "/account/orders", page: "Orders", auth: true },{ path: "/account/wallet", page: "Wallet", auth: true },{ path: "/account/settings", page: "Settings", auth: true }]
Stabilize fields from day one: a product includes an identifier, name, summary, price (stored in cents), stock, image URL, and specification list; an order includes an identifier, product snapshot, quantity, amount, status, and creation time; a user includes an identifier, phone or email, and nickname. Storing amounts as integer cents avoids the common floating-point accumulation errors in generated code. The product snapshot prevents order pages from becoming inaccurate if product prices change later.
For styling, a small set of design tokens is enough to constrain site-wide consistency: background, surface, primary color, danger color, main text, muted text, radius, and spacing. Require all pages to consume tokens only, and forbid scattered color values inside pages. Even if the tool’s aesthetic judgment is unstable, a human can fix contrast in one place. Check the narrow-screen breakpoint at least once: collapsed navigation, single-column product cards, stacked form labels, and full-width primary buttons with clear contrast against the background.
4. Turn High-Failure Points into a Repair Playbook
Based on common deviations in multi-page generation, repairs should not start with “regenerate everything,” but should proceed in dependency order.
Fix the project skeleton first. If directories nest inside themselves, entry files are duplicated, or the dependency manifest doesn’t match actual imports, ask the tool to output only the file tree and startup steps, and let a human confirm the single entry point before continuing. Otherwise, the more business code you patch, the harder migration becomes.
Then fix routes and the auth guard. Ensure all ten paths are directly reachable, refreshing doesn’t lose the page, and protected pages redirect unauthenticated users while preserving the origin. The payment success page must be reachable only from checkout, and repeated refreshes must not create unlimited orders—in the mock implementation, adopt a “one submission writes one order” convention using in-memory or local storage.
Then fix data boundaries. Move arrays hard-coded in pages into independent modules, with pages calling read functions only. The detail page should look up by identifier and show a clear empty state when nothing is found, not a blank screen. Centralize image URLs, and show a neutral placeholder on failure to avoid layout collapse.
Then fix forms and feedback. List rules separately for login, registration, checkout, and settings forms: non-empty, length, format, two-entry match, quantity a positive integer not exceeding stock. Error copy sits next to the field, and the submit button is disabled while a request is in flight. Never delete validation just to silence errors.
Finally fix visuals and responsiveness. Check contrast and tap targets before decoration. Distorted login/registration layouts, invisible buttons, and layouts that look only mobile or only desktop all count as incomplete. If the detail page is too thin, add specifications, stock, shipping notes, and an after-sales summary—but don’t pile on unrelated marketing paragraphs.
5. When to Stop Auto-Generation and Take Over Manually
Stop prompting the tool and switch to manual skeleton refactoring with localized generation when you see these signals: the project still won’t start after three repair rounds; directory semantics are chaotic and the tool cannot explain its own imports; the state directory is empty while pages duplicate large amounts of conditional logic; mock data and views keep coupling and spreading with every fix. AI coding tools are good at filling in pages and boilerplate logic—not at endlessly patching a wrong abstraction.
The minimal takeover actions are: freeze the route table and field table, extract the layout and three to five reusable components, and rewire existing pages to a single mock data source. Then let the tool fill in page by page, for example: “modify only the checkout page, do not add routes, must reuse the existing price component and validation functions.” The narrower the constraints, the less likely it will break pages that already passed.
6. Connecting to General Cloud Capabilities
A frontend demo can start with mock data, but the selection verdict should consider “the cost of swapping in real dependencies.” Images can live in object storage with pages holding only resource URLs; login and registration should eventually connect to a unified identity service rather than keeping credential checks in the browser; order creation and stock deduction are server-side transactions, with the frontend only displaying results and idempotency hints; critical failures need logging and monitoring alerts to distinguish runtime errors in generated code from API errors.
These are general capability categories, and you don’t need to bind to a specific interface shape at the prototype stage. Cloud platforms such as Baidu AI Cloud typically cover compute, storage, networking, identity, and observability, and can be adopted as needed when the site moves from demo to integration. A selection article should not assume any cloud vendor has already completed custom development for your business, nor should it put unverified performance figures into acceptance criteria. On the frontend side, simply ensure: resource URLs are configurable, API failures are retryable with user feedback, and secrets and passwords never appear in the repository or page source.
7. A Directly Executable Conclusion
To judge whether an AI coding environment suits daily team use, run this e-commerce flow as a regression test: stable network access without extra proxies; within the fixed repair rounds, the project starts and the browse, login, purchase, order, and account settings flows work end to end; style tokens are unified and narrow screens are operable; data, validation, routing, and views are separated; no empty directories padding the structure; and repairs converge by module. Whether the UI feels “friendly” only affects operation cost—it cannot replace these engineering standards.
Teams can turn this article’s page checklist, field conventions, design tokens, and three-round repair cap into an internal evaluation script. Every time you switch models or coding environments, rerun the same script and record first-round passes and remaining defects. This compares delivery capability rather than slogans or single-page screenshots—and avoids being misled by one occasionally beautiful generation.
