Hands-On Evaluation of LLM Front-End Code Generation and Engineering Practices

    This article evaluates how well large language models generate complete front-end projects from a structured requirements document. Based on a real-world test covering a login page, a product listing page, and a form page, it compares a domestic AI coding tool with the corresponding version of a leading overseas model. The findings show that while simple pages are delivered reliably, complex filtering, field dependencies, and validation logic often get simplified or dropped as requirement complexity grows. The article explains why this happens—constraint dilution, relational logic, and the lack of external validation—and offers practical engineering methods: structured prompts, per-page acceptance checklists, incremental generation, and automated tooling to turn inconsistent results into a repeatable delivery process.

    1. Background: From Generating Code to Delivering a Project

    Over the past year, AI coding tools have rapidly expanded their capabilities—from early snippet completion to generating a runnable front-end project in a single pass. This has led many teams to expect that they can hand a requirements document to a model and receive a live, demonstrable, and extensible project URL in return.

    However, there is a clear gap between demo samples and real projects. Demos usually have few pages, few fields, and simple interactions. Real projects involve complex filters, field dependencies, validation rules, and state management. Therefore, evaluating these tools requires more than checking whether the code runs; it requires assessing requirement understanding, interaction fidelity, visual quality, and generation efficiency.

    This article uses a self-built, real-world front-end requirement as a sample, records observations from a complete generation run, and abstracts the findings into reusable engineering methods. To avoid pointing to specific products, the tool used is referred to as “an AI coding tool,” and the comparison target is referred to as “the corresponding version of a leading overseas model.”

    2. Experiment Design: Making the Evaluation Reproducible

    To make the conclusions meaningful, variables must be fixed first. The key design points of this practice are:

    • Input: a structured requirements document containing a page list, field definitions, interaction descriptions, validation rules, and style constraints.
    • No fixed tech stack: the tool chooses its own framework and build approach, so its default engineering habits can be observed.
    • Output requirement: not code snippets, but a fully accessible project URL.
    • Page scope: a login page, a product listing page, and a form page, covering three typical scenarios—simple display, complex querying, and complex data entry.
    • Metrics recorded: end-to-end time, page completeness, filter implementation, field and validation fidelity, and visual and engineering structure quality.

    Note that generation speed is affected by account tier, concurrent queuing, and model load. Speed data therefore reflects only this particular run and should not be treated as a general conclusion.

    3. Hands-On Observations: Capability Layers Revealed by Three Pages

    3.1 Login Page: Close to Production-Ready

    The login page includes a carousel, form inputs, basic validation, and submission feedback. The generated result covered these elements, with a clear page structure and a complete interaction loop—at a “minor tweaks before launch” level. This shows that for pages with clear goals, few fields, and short interaction paths, current tools can deliver reliably.

    3.2 Listing Page: Understanding Starts to Degrade

    The listing page exposed the most typical issue: the document clearly specified multiple filters and their linkage logic, but the generated result omitted the filters entirely. Notably, this was not a one-off miss—similar problems appeared across multiple listing pages, indicating a systemic capability gap rather than random fluctuation.

    The page skeleton was correct: search area, table area, and pagination area were all present, with reasonable visual structure. But the “functional semantics” were not fully implemented. In short: structural fidelity is strong, semantic fidelity is weak.

    3.3 Form Page: Field Relationships and Validation Logic Not Fully Restored

    The form page was runnable overall, but the field set, field linkage, validation rules, and hint text deviated from the document. The core difficulty of complex forms lies in “relationships” rather than “fields”: whether a field is shown depends on another field’s value, a validation rule depends on a combination of fields, and cross-field consistency checks are required before submission. These relational constraints are the most likely to be simplified away during generation.

    3.4 Visuals and Engineering Structure: Engineering Usability First

    The overall visual style was better than a typical wireframe prototype, but still fell short of the effect achieved by directly applying a mature component library or style system; the design felt simple and engineering-oriented. In terms of engineering structure, the generated directory organization and component splitting were basically reasonable, providing a foundation for further development.

    4. Comparative Analysis: The Gap Lies in “Depth of Understanding”

    Running the same document through the corresponding version of a leading overseas model revealed a clear layering pattern:

    • Login page: both versions were close in completeness, with no significant difference.
    • Listing page: the comparison version understood filter conditions and field structures more completely, with fewer omissions.
    • Form page: the comparison version showed a more obvious advantage in restoring field relationships, validation logic, and interaction details.
    • Speed: the comparison version had noticeably shorter end-to-end time; this difference may be related to account tier and queuing strategy.

    The conclusion can be summarized in one sentence: as requirement complexity rises, the main gap between models is not in “writing code” but in “reading requirements.” Whichever model can retain constraints without loss in a long context can deliver a more complete project.

    5. Why Performance Drops: Three Technical Causes

    1. Constraint dilution. The longer the requirements document, the lower the relative weight of key constraints in the context. The model tends to generate a structure that “looks complete” while ignoring low-frequency but critical details.
    2. Relational constraints are hard to express linearly. Filter linkage and field dependencies are essentially conditional logic and state machines. When described in flat natural language, they are easily compressed into a generalized concept like “there is a filter area.”
    3. Lack of an external validation loop. Without checklist-based validation and automated checks, omissions can only be found manually and cannot be self-corrected during generation.

    6. Engineering Methods: Turning “Luck” into “Deliverability”

    6.1 Replace Long Prose with Structured Prompts

    Breaking requirements into a machine-friendly structure significantly reduces the chance of constraint loss. Example:

    1. page: product_list
    2. goal: support multi-condition filtering and paginated browsing
    3. fields:
    4. - name: keyword
    5. type: string
    6. ui: input
    7. - name: category
    8. type: enum
    9. ui: select
    10. options: [A, B, C]
    11. - name: priceRange
    12. type: range
    13. ui: slider
    14. interactions:
    15. - when: category == 'A'
    16. then: hide priceRange
    17. - when: keyword != ''
    18. then: reset page to 1
    19. validation:
    20. - field: priceRange
    21. rule: min <= max
    22. message: invalid price range
    23. acceptance:
    24. - all three filters are visible and usable
    25. - linkage and reset logic work

    6.2 Build an Acceptance Checklist for Each Page

    Write acceptance criteria into the prompt so the model can self-check after generation:

    • Does the page include all fields and filters listed in the document?
    • Are linkage, reset, and default values implemented?
    • Do validation timing and hint text match the specification?
    • Are empty, loading, and error states covered?

    6.3 Generate in Small Steps and Accept in Segments

    Generating three pages at once amplifies omissions. A more reliable approach is to generate and accept page by page before moving to the next; each round adds context for only one page, maintaining constraint density.

    6.4 Add Automated Safeguards

    Apply general engineering capabilities to the generated output: static analysis to catch obvious defects, unit tests to cover validation logic, logging and monitoring/alerting to observe production behavior, and a container platform to host an accessible preview environment. These are all industry-standard technology categories and do not depend on any vendor-specific proprietary interfaces.

    7. Selection Advice: Match Capability to Scenario

    • Simple pages and prototype validation: prioritize generation speed and engineering runnability.
    • Complex listings and complex forms: prioritize constraint retention in long contexts and semantic fidelity.
    • Long-term evolving projects: prioritize maintainability of generated code, directory conventions, and extensibility.

    A pragmatic strategy is to combine tools: use a fast tool for the first draft and structural exploration, use a tool with higher comprehension accuracy for completing and refactoring complex pages, and finally run all output through human review and automated validation.

    8. Conclusion

    The core judgment from this practice is that AI coding tools can now reliably handle the “zero to runnable” stage, but there is still a clear boundary in their depth of understanding for complex requirements. For developers, the real leverage point is not switching tools but changing the input approach—structuring requirements, checklisting acceptance criteria, and automating validation. Doing these three things can improve the stability of generated results by an order of magnitude, turning engineering delivery from an occasional surprise into a controllable process.