Agentic Coding in Practice: Building and Evaluating Single-File Desktop Web Apps

    Building a desktop-style web app with an AI coding agent requires more than polished windows and icons. This article explains how to define browser constraints, prioritize complete workflows, organize a single-file application, preserve user data, adapt desktop interactions for mobile, and coordinate implementation through shared interfaces. It also outlines security considerations and a reproducible evaluation framework for assessing functionality, maintainability, and sustained development quality.

    1. From Attractive Interfaces to Working Systems

    A common agentic coding task is to generate a desktop-style web application from a natural-language description. Users should be able to open multiple windows, edit text, manage files, draw, play small games, and use appropriate controls on different devices.

    Although this may look primarily like a UI generation task, it also involves requirements analysis, interaction design, module organization, state management, and browser runtime constraints. A polished background, taskbar, and set of icons do not establish that the application works reliably. The interface becomes functional only when users can complete a workflow such as creating a file, editing its contents, saving it, and reopening it.

    Evaluation should therefore separate two questions:

    • Presentation quality: Is the layout coherent? Is the visual hierarchy clear? Is interaction feedback consistent?
    • Engineering quality: Do the features actually work? Is state reliable? Are failures handled? Is the code easy to modify?

    Visual quality can indicate how well an agent understands interaction requirements, but it cannot independently demonstrate the ability to sustain coding work over time. That requires multiple rounds of changes, debugging, and regression testing—not conclusions drawn from a single generated page.

    2. Define the Boundaries: A Desktop Web App Is Not an Operating System

    A desktop-style web application reproduces operating-system interaction patterns; it does not replace the operating system. It may provide windows, menus, a taskbar, and application launchers, but it remains subject to browser permissions and execution constraints.

    Local Resource Access Has Limits

    A web page generally cannot read arbitrary local directories or modify system files without restrictions. File access requires an explicit user selection or an authorization mechanism supported by the browser.

    A “file manager” must therefore identify what it manages:

    • Virtual files maintained within the application.
    • Copies of files imported by the user.
    • Local resources accessed with explicit authorization.

    These resources have different lifecycles and permission scopes and should not be treated interchangeably. In particular, a virtual directory interface must not be presented as full access to the host computer’s file system.

    A Terminal Interface Is Not an Execution Environment

    A terminal with an input field and output area demonstrates only that a command interface exists. Without an interpreter, execution service, or appropriate runtime, it cannot execute arbitrary scripts or directly operate on the host system.

    A reasonable starting point is a controlled command set: help, listing virtual files, reading text, and clearing output. If script execution is required, document the runtime, dependency loading, accessible resources, and security restrictions separately.

    A Single File Is Not Necessarily Offline

    “Put the code in one HTML file” and “run without a network connection” are different requirements. An application with a single entry file may still load fonts, images, media, or runtime components from external sources.

    Before delivery, clarify:

    • Whether external dependencies are allowed.
    • Whether initial setup requires an internet connection.
    • Which features remain available offline.
    • Whether opening the file directly behaves the same as accessing it through a server.

    Writing these constraints into the requirements helps prevent an application from working in a demonstration environment but failing after delivery.

    3. Turn Broad Requests into Testable Features

    “Include all common applications” is not an actionable technical specification. A more effective approach is to prioritize features by their value and implementation risk.

    Layer 1: Desktop and Window Infrastructure

    Start with application launching, window activation, dragging, resizing, minimizing, maximizing, and closing. These are shared capabilities on which every application depends.

    Acceptance testing should focus on consistent state, not the number of buttons. Clicking a taskbar item after minimizing a window should restore that window, not create a new blank one. Closing a window should also update the taskbar and window list.

    Layer 2: Basic Applications with Complete Workflows

    Prioritize a text editor, virtual file manager, and drawing tool. These applications have clear input, processing, and output paths, and they help validate the shared file system.

    The text editor should support creating, opening, editing, and saving documents, along with warnings about unsaved changes. The file manager should display those files and correctly handle duplicate names, deletion, and nonexistent paths. The drawing tool should provide verifiable features such as a brush, color selection, clearing the canvas, and export.

    Layer 3: Complex Features and Optional Extensions

    Evaluate script terminals, code editors, media editors, and complex games separately. They may require execution environments, syntax handling, media decoding, timeline calculations, and substantial resource management. Adding interface elements alone is not enough.

    For example, selecting video assets, previewing playback, marking segments, and exporting the final result are separate stages. A draggable timeline does not prove that video editing and export work. If only preview and segment selection are implemented, label those limitations rather than calling the result a complete editor.

    4. Single-File Delivery Still Requires Modular Architecture

    Delivering fewer files does not eliminate the need for structure. A single-file application should still separate responsibilities so that window control, file storage, and application logic do not become entangled.

    A useful logical structure is:

    Desktop shell → Window management → Application registry → Application instances → Shared services

    Desktop Shell

    The shell manages the desktop area, application launchers, taskbar, system notifications, and global settings. It should launch applications through a common entry point rather than implement their internal behavior directly.

    Window Management

    Window management should centrally track each window’s identifier, application, position, size, stacking order, and display state. Dragging, maximizing, and focus changes should use the same logic across windows to avoid inconsistent behavior.

    Window state can be represented as:

    1. Window state:
    2. Unique identifier
    3. Application type
    4. Horizontal and vertical position
    5. Width and height
    6. Stacking order
    7. Minimized status
    8. Maximized status
    9. Position and size before maximization

    Preserving the layout before maximization is important. Otherwise, restoring a window may lose its original position and dimensions.

    Application Registry and Instance Management

    Application registration describes the name, icon, default size, and creation method. An application instance holds its current document, editing content, and temporary state.

    Keep these separate. Two text editor windows can share the same application definition, but they must have independent editing state. Otherwise, content in one window may overwrite content in the other.

    Shared Services

    Centralize the virtual file system, settings storage, notifications, and inter-application messaging. When an editor saves a file, the file manager should receive a change notification. The editor should not directly manipulate the file manager’s interface elements.

    With this structure, new applications can follow shared interfaces without requiring changes throughout the desktop system.

    5. Data Reliability Matters More Than Demo Appeal

    Desktop-style web applications often produce user data, so persistence should not be treated as an optional embellishment.

    Distinguish Three Types of State

    • Transient state: Coordinates during dragging, hover positions, and the current menu.
    • Session state: Open windows, the selected file, and unsaved content.
    • Persistent state: Explicitly saved files, user preferences, and layout settings.

    Each category needs an appropriate strategy. Persisting every drag movement may introduce unnecessary overhead, while failing to preserve document content makes page refreshes a data-loss risk.

    Handle Save Failures

    Browser storage is not unlimited, and its retention behavior is not identical in every environment. Saving must account for insufficient capacity, write failures, and invalid data formats.

    Show “Saved” only after a successful write. If saving fails, retain the current content and offer an export option. Clicking the save button alone must not mark the document as saved.

    Retain Import and Export Options

    Local persistence is convenient, but it is not a substitute for backups. Where possible, support export for text, drawings, or the entire virtual workspace, and validate data formats during import.

    For important data, version fields and migration logic can help an updated application recognize older data instead of clearing storage.

    6. Mobile Support Is More Than Shrinking the Desktop

    Desktop interaction relies on precise pointers, multiple windows, and a large viewport. Mobile devices favor touch input, focused tasks, and clear navigation back to previous views. Both modes should share application capabilities without necessarily sharing every layout decision.

    Desktop Mode Supports Parallel Work

    Allow overlapping windows and adjustable sizes, with a taskbar for switching applications. Dragging areas should be clear, and windows should not easily move beyond the user’s reach.

    Mobile Mode Supports Focused Tasks

    Applications can occupy the main viewport, while an application switcher manages open tasks. Free-form dragging often adds little value on small screens and can conflict with page scrolling.

    Switching modes should preserve documents and application instances while changing only their presentation. A responsive layout that clears editing content still fails functionally, even if it looks correct.

    Account for Keyboard and Touch Input

    Common actions should have reasonable keyboard access, and touch controls should provide sufficiently large targets. Menus, dialogs, and window focus need consistent rules. Color changes must not be the only indication of state.

    Accessibility is not a finishing step after visual design. It directly affects window navigation, input focus, and the discoverability of controls.

    7. Coordinate Agents Around Interfaces, Not Task Counts

    Complex generation work can be divided into window systems, file services, application implementations, and testing. However, parallel tasks do not automatically produce higher quality.

    Integration is the real challenge. If separate tasks use incompatible data structures or independently modify global styles, the result may include overlapping windows, inconsistent file state, and duplicate event bindings.

    Before coding begins, define a brief shared contract covering:

    • How applications are created and destroyed.
    • How files are read, saved, and reported as changed.
    • How windows request focus.
    • How errors are presented to users.
    • Which state may be persisted.

    Then proceed incrementally: complete one minimal end-to-end workflow, add a second application, and only then expand into complex features. Run existing tests at every step to confirm that new code has not broken established behavior.

    This process also provides evidence of sustained coding ability. Can the agent preserve architectural consistency when requirements change? Can it identify the root cause of a defect? Does the application still pass regression tests after repeated fixes?

    8. Security Must Cover Input and Resource Lifecycles

    Although a desktop-style web application is not an operating system, it may still process untrusted text, imported files, and user scripts.

    Display ordinary text in a way that does not interpret it as page structure. Do not insert file contents directly into executable page markup: malicious input could affect application state or access data available to the page.

    If code execution is offered, restrict available capabilities and provide runtime limits, a stop control, and output limits. Any isolation mechanism needs an explicit threat model. Running code in a separate execution area is not, by itself, proof of complete security isolation.

    Resource cleanup is also part of security and stability. Closing a window should release its listeners, scheduled tasks, media resources, and temporary objects. Otherwise, prolonged use may cause duplicate responses, growing memory consumption, or background tasks that continue running.

    9. Establish a Reproducible Acceptance Framework

    Use test records rather than vague statements that a generated result “works better.”

    Complete Functional Workflows

    Verify that file creation, saving, reading, and deletion remain consistent. Check whether closing and restoring windows behave as expected and whether applications produce usable output.

    Visual and Interaction Quality

    Check text readability, visual hierarchy, alignment, feedback, and layouts at different viewport sizes. Record visual quality separately; it must not substitute for functional results.

    Stability and Error Handling

    Test empty files, long text, duplicate filenames, storage failures, repeated window opening and closing, and frequent layout switching. Watch for lost state or unresponsive behavior.

    Maintainability

    Check whether module responsibilities are clear, shared state is centrally managed, and adding an application requires extensive changes to existing code.

    Continued Development

    Introduce concrete follow-up requirements, such as autosave, workspace restoration, or a different window policy. Then verify that existing features still work.

    Every conclusion should include the runtime environment, dependency conditions, and testing scope. A single demonstration establishes behavior under specific conditions, not a general capability.

    10. Rewrite Generation Prompts as Engineering Specifications

    Instead of asking for “the most impressive interface with every feature,” use a specification such as:

    Build a desktop-style web application delivered as a single file. Prioritize window management, virtual file management, text editing, and drawing, and ensure that creating, saving, reopening, and exporting work end to end. Design separate desktop and mobile layouts, preserving application state when switching between them. Document external dependencies, offline requirements, and browser permission boundaries. Clearly label unimplemented complex features; do not present placeholder interfaces as working functionality. Include a test checklist, known issues, and suggestions for future extensions with the deliverable.

    This approach does not constrain creativity unnecessarily. It gives creativity verifiable boundaries.

    The value of agentic coding is not generating as many windows and buttons as possible in one pass. It is reducing the communication effort needed to understand requirements, design structure, implement functionality, and make ongoing corrections.

    For a single-file desktop web application, the reliable sequence is to define constraints first, establish complete workflows next, refine the user experience, and then validate engineering quality through iteration.