Full-Stack Prototype Delivery with AI Agents: Engineering Practices

    This article explores how to move from AI-generated code snippets to runnable full-stack prototypes. It covers requirement decomposition, frontend design tokens and motion accessibility, backend concurrency control for booking systems, acceptance testing, and risk governance for generative delivery.

    1. From Code Snippets to Runnable Systems

    Over the past period, the capability boundary of code generation tools has expanded significantly. Early usage often involved completing a function or explaining an error message. Now, a well-structured requirement description can lead an agent to produce page structure, styles, interaction scripts, and backend interfaces at the same time. This capability is often called “full-stack delivery.”

    Full-stack delivery is fundamentally different from code completion. The results of completion are handed over to developers for line-by-line verification. Delivery results are expected to run independently and satisfy business rules. The criteria are whether data can be written, rules can be enforced, and exceptions can be handled correctly. Page appearance is only one part of it.

    2. Break Requirements into Verifiable Engineering Goals

    Vague requirements produce vague systems. Before issuing generation instructions, it is advisable to decompose requirements into the following five types of information:

    1. Brand and visual: primary color, type hierarchy, image style, motion intensity.
    2. Information architecture: number of pages, navigation relationships, and the content each block should convey.
    3. Interaction flow: every step from landing on the page to completing an action, including form fields and validation rules.
    4. Business rules: capacity limits, state transitions, and handling after capacity is reached.
    5. Non-functional requirements: responsive layout, accessibility, data storage location, and security requirements.

    Below is a structured task template that can be used directly to describe requirements:

    1. [Role] Senior full-stack engineer
    2. [Goal] Build an official website for a space travel service, including flight search and seat booking
    3. [Pages] Home, flight details, booking flow, order confirmation
    4. [Visual] Dark background, single accent color, monospace font for data display
    5. [Business rules] Maximum 6 seats per flight; no new bookings after full
    6. [Data] Booking information must be persisted, with fields including date, seat number, passenger name
    7. [Acceptance] Provide runnable frontend and backend code with startup instructions, and list uncovered scenarios

    The purpose of the template is to turn “is it done?” into a checklist that can be verified item by item. The more specific the checklist, the more controllable the generation result.

    3. Frontend: Visual Systems and Narrative Pages

    Narrative pages often use full-screen backgrounds, vertical timelines, and segmented scrolling. When generating this type of page, three engineering points need attention.

    First, design tokens should be defined before use. When colors, font sizes, and spacing are written as variables, later adjustments only require changing one place, and it is easier to keep the whole site consistent.

    1. :root {
    2. --color-bg: #05070d;
    3. --color-accent: #ff8a1f;
    4. --font-data: ui-monospace, monospace;
    5. --space-section: 96px;
    6. }
    7. .timeline-item__metric {
    8. font-family: var(--font-data);
    9. color: var(--color-accent);
    10. }

    Second, motion must be disable-able. Full-screen video backgrounds and continuously blinking status dots increase device load and may cause discomfort for some users. The prefers-reduced-motion media query should be used to provide a fallback.

    1. @media (prefers-reduced-motion: reduce) {
    2. .hero-video { display: none; }
    3. .status-dot { animation: none; }
    4. }

    Third, numbers, times, and locations on the page should come from business configuration, not be filled in arbitrarily by the model. If a generated timeline includes “the overload value of a phase” or “the mileage at a time point,” this content must be verified by the business side before launch. Alt text, loading strategy, and size budgets for assets also need to be planned separately.

    4. Backend: The Core of Booking Logic Is Concurrency Control

    The difficulty of booking features lies in shared state such as “remaining seats.” When two users submit the last seat at the same time, a read-then-check-then-write approach can lead to overselling.

    A common approach is to complete the check and write in the same database transaction, with a unique constraint as the last line of defense. The following example illustrates this approach:

    1. MAX_SEATS_PER_FLIGHT = 6
    2. def book_seat(conn, flight_id, seat_no, passenger_name):
    3. with conn: # Complete the check and write in the same transaction
    4. cur = conn.cursor()
    5. # Lock the flight record to serialize concurrent bookings for the same flight
    6. cur.execute("SELECT id FROM flights WHERE id = %s FOR UPDATE", (flight_id,))
    7. cur.execute("SELECT COUNT(*) FROM bookings WHERE flight_id = %s", (flight_id,))
    8. if cur.fetchone()[0] >= MAX_SEATS_PER_FLIGHT:
    9. raise FlightFullError(flight_id)
    10. # The unique constraint (flight_id, seat_no) prevents duplicate seat occupancy
    11. cur.execute(
    12. "INSERT INTO bookings (flight_id, seat_no, passenger_name) VALUES (%s, %s, %s)",
    13. (flight_id, seat_no, passenger_name),
    14. )

    The following points also need attention during implementation:

    • All queries should use parameterized statements, not concatenated user input.
    • A “full-flight lock” can be derived from the seat count; there is no need to maintain an extra status field that can easily become inconsistent.
    • Unique constraints should be written into the table schema, not rely only on application-layer checks.
    • The data tables should include at least a flights table and a bookings table, linked by a foreign key.

    5. Acceptance: How to Determine Whether the System Really Runs

    “ The page opens” does not mean “the system is deliverable.” Acceptance should cover the following dimensions:

    • Startup verification: whether dependencies can be installed correctly, whether database migration scripts can be executed, and whether the service can start.
    • Main flow: select a date, select a seat, enter passenger information, and submit; data should still exist after refreshing the page.
    • Boundary conditions: submission of the seventh seat is rejected, duplicate seats are rejected, and invalid dates are rejected.
    • Concurrency scenarios: when multiple requests for the same flight are submitted at the same time, the number of successful requests does not exceed the limit.
    • Security checks: input length and format are validated, and error messages do not expose internal structure or stack details.
    • Page quality: mobile layout works normally, the keyboard can complete all operations, and the page remains usable in reduced-motion mode.

    Acceptance results should be saved as records, including test cases, execution results, and uncovered scenarios. The “uncovered scenarios” listed by the agent at delivery are valuable information in themselves and should be included in the follow-up iteration plan.

    6. Risks and Governance

    Generative delivery introduces specific risks that require governance measures to be designed in advance.

    • Factual risk: generated numbers, routes, and timelines may not match reality. The business side should verify them item by item before launch.
    • Fabricated data risk: the model may fill in plausible-looking metrics. They should be replaced with real sources or clearly marked as sample data.
    • Security risk: generated code may contain hardcoded secrets, unvalidated input, or insecure default configurations. Secrets should be placed in environment variables or a dedicated secret management service.
    • Licensing risk: authorization for images, videos, and fonts needs to be confirmed separately. Output from a generation tool cannot be assumed to be commercially usable by default.
    • Maintainability risk: code that no one understands is difficult to evolve, so maintainability should be an explicit delivery requirement.