Functional UI Prototype
Goal
Produce a browser-based, fully interactive prototype that is indistinguishable in behavior from a feature backed by a real server. The prototype must use localStorage as its persistence layer, simulate realistic network latency on every data operation, and meet the same quality bar as production code in both visual fidelity and code standards.
Constraints
No Backend Changes
Do not create, modify, or extend any backend code, API route, server endpoint, serverless function, database migration, or server-side configuration. The prototype must be entirely self-contained in the frontend.
Production-Grade Quality
A prototype is not an excuse for lower quality. Apply the same standards the project enforces for production code:
- Visual quality must match the project's existing UI.
- Code quality must pass the project's linting, formatting, and type-checking rules.
- Component structure, naming, file organization, and styling must follow the project's established conventions.
Responsive to All Supported Display Modes
The prototype must support every screen size, viewport, orientation, and display mode that the project's application already supports. If the application is responsive, the prototype is responsive. If the application supports specific breakpoints, the prototype honors those breakpoints. Do not build for a single viewport and leave other supported sizes broken or degraded.
Workflow
1. Detect the Project Stack and Conventions
Before writing any code:
- Identify the framework, component model, styling approach, design-system packages, state management, and data-fetching patterns already in use.
- Read existing components, pages, and data-access layers to understand how the project structures frontend code.
- Identify how the project handles loading states, error states, empty states, and optimistic updates, because the prototype must behave the same way.
- Identify the project's existing conventions for abstracting data access so the localStorage layer follows the same patterns.
2. Design the Local Data Layer
Build a data layer that mirrors how the project would interact with a real backend:
- Store all prototype data in localStorage using structured keys that avoid collisions with other application data. Use a consistent key prefix or namespace for all prototype entries.
- Model the data shapes as the project would model them. Use the same types, interfaces, or schemas the feature would use with a real API.
- Expose the data layer through the same abstraction the project uses for data access. If the project uses repositories, build a repository. If it uses hooks, build hooks. If it uses services, build services. Match the pattern.
- Every read and write operation must go through a simulated latency delay before resolving. This includes creates, reads, updates, deletes, listings, and any filtered or paginated queries.
3. Simulate Realistic Latency
Wrap every data operation in an asynchronous delay that mimics real-world network conditions:
- Use reasonable latency ranges that reflect typical web application behavior. Reads are generally faster than writes. Bulk operations take longer than single-item operations.
- Add slight random variation to each delay so the UI does not feel artificially uniform.
- The delay must happen before the operation resolves, not after. The caller must await the result as it would with a real network call.
- Never skip the delay, even during development. The purpose is to validate that the UI handles asynchronous flows correctly under realistic timing.
4. Handle Async UI States
Because every operation is asynchronous, the UI must present appropriate feedback at every stage:
- Follow the project's existing patterns for loading indicators, skeleton screens, spinners, progress bars, or any other feedback mechanism already in use.
- Show loading feedback during the simulated delay. Do not let the UI appear frozen or unresponsive.
- Handle and display error states if the prototype simulates failure scenarios.
- Handle empty states when no data exists in localStorage yet.
- If the project uses optimistic updates, apply the same technique in the prototype.
5. Build the UI
Construct the interface following every convention the project already enforces:
- Use the project's existing components, design-system primitives, and styling tokens before creating new ones.
- Follow the project's component composition patterns, naming conventions, and file structure.
- Build the prototype so it integrates naturally into the existing application. Navigation, routing, layout, and shared state must work as they do for any other feature.
- Make the prototype fully interactive. Every button, form, list, detail view, modal, and transition must work. Do not leave placeholder interactions or non-functional elements.
6. Ensure Data Survives Across Sessions
Verify that the localStorage layer behaves like durable storage:
- Data written during one session must be available when the user reloads the page or reopens the browser.
- The prototype must initialize correctly whether localStorage is empty or already contains data from a previous session.
- Provide a way to reset the prototype data without clearing unrelated localStorage entries. This can be a developer-facing utility or a visible control in the prototype UI, depending on the project's preference.
Review Questions
When reading or reviewing prototype code, ask:
- Does any code touch backend files, API routes, or server-side logic?
- Does the data layer follow the same abstraction the project uses for real data access?
- Does every data operation go through a simulated asynchronous delay?
- Does the UI show appropriate loading feedback during delays?
- Does the visual quality and code structure match the rest of the project?
- Does the prototype work correctly at every screen size and display mode the project supports?
- Does data persist across page reloads?
- Are localStorage keys namespaced to avoid collisions?
If any answer is no, fix it before considering the work complete.
Report the Outcome
When finishing the task:
- State which features the prototype covers and confirm that all interactions are functional.
- State which data-access abstraction was used and confirm it matches the project's patterns.
- State the simulated latency ranges applied to read and write operations.
- State how loading, error, and empty states are handled and confirm they follow project conventions.
- State the localStorage key namespace used.
- State how to reset the prototype data.
- State which screen sizes or display modes were verified and confirm they match the project's supported targets.
- Confirm that no backend code was created or modified.
1---2name: functional-ui-prototype3description: Build functional UI/UX prototypes that run entirely in the browser. Use when creating, extending, or refactoring a prototype that must look and behave like a complete feature without touching backend code. All data persistence is simulated through localStorage with realistic latency so the prototype can be used under the same conditions as a full implementation. Backend modification is strictly prohibited.4---56# Functional UI Prototype78## Goal910Produce a browser-based, fully interactive prototype that is indistinguishable in behavior from a feature backed by a real server. The prototype must use localStorage as its persistence layer, simulate realistic network latency on every data operation, and meet the same quality bar as production code in both visual fidelity and code standards.1112## Constraints1314### No Backend Changes1516Do not create, modify, or extend any backend code, API route, server endpoint, serverless function, database migration, or server-side configuration. The prototype must be entirely self-contained in the frontend.1718### Production-Grade Quality1920A prototype is not an excuse for lower quality. Apply the same standards the project enforces for production code:2122- Visual quality must match the project's existing UI.23- Code quality must pass the project's linting, formatting, and type-checking rules.24- Component structure, naming, file organization, and styling must follow the project's established conventions.2526### Responsive to All Supported Display Modes2728The prototype must support every screen size, viewport, orientation, and display mode that the project's application already supports. If the application is responsive, the prototype is responsive. If the application supports specific breakpoints, the prototype honors those breakpoints. Do not build for a single viewport and leave other supported sizes broken or degraded.2930## Workflow3132### 1. Detect the Project Stack and Conventions3334Before writing any code:3536- Identify the framework, component model, styling approach, design-system packages, state management, and data-fetching patterns already in use.37- Read existing components, pages, and data-access layers to understand how the project structures frontend code.38- Identify how the project handles loading states, error states, empty states, and optimistic updates, because the prototype must behave the same way.39- Identify the project's existing conventions for abstracting data access so the localStorage layer follows the same patterns.4041### 2. Design the Local Data Layer4243Build a data layer that mirrors how the project would interact with a real backend:4445- Store all prototype data in localStorage using structured keys that avoid collisions with other application data. Use a consistent key prefix or namespace for all prototype entries.46- Model the data shapes as the project would model them. Use the same types, interfaces, or schemas the feature would use with a real API.47- Expose the data layer through the same abstraction the project uses for data access. If the project uses repositories, build a repository. If it uses hooks, build hooks. If it uses services, build services. Match the pattern.48- Every read and write operation must go through a simulated latency delay before resolving. This includes creates, reads, updates, deletes, listings, and any filtered or paginated queries.4950### 3. Simulate Realistic Latency5152Wrap every data operation in an asynchronous delay that mimics real-world network conditions:5354- Use reasonable latency ranges that reflect typical web application behavior. Reads are generally faster than writes. Bulk operations take longer than single-item operations.55- Add slight random variation to each delay so the UI does not feel artificially uniform.56- The delay must happen before the operation resolves, not after. The caller must await the result as it would with a real network call.57- Never skip the delay, even during development. The purpose is to validate that the UI handles asynchronous flows correctly under realistic timing.5859### 4. Handle Async UI States6061Because every operation is asynchronous, the UI must present appropriate feedback at every stage:6263- Follow the project's existing patterns for loading indicators, skeleton screens, spinners, progress bars, or any other feedback mechanism already in use.64- Show loading feedback during the simulated delay. Do not let the UI appear frozen or unresponsive.65- Handle and display error states if the prototype simulates failure scenarios.66- Handle empty states when no data exists in localStorage yet.67- If the project uses optimistic updates, apply the same technique in the prototype.6869### 5. Build the UI7071Construct the interface following every convention the project already enforces:7273- Use the project's existing components, design-system primitives, and styling tokens before creating new ones.74- Follow the project's component composition patterns, naming conventions, and file structure.75- Build the prototype so it integrates naturally into the existing application. Navigation, routing, layout, and shared state must work as they do for any other feature.76- Make the prototype fully interactive. Every button, form, list, detail view, modal, and transition must work. Do not leave placeholder interactions or non-functional elements.7778### 6. Ensure Data Survives Across Sessions7980Verify that the localStorage layer behaves like durable storage:8182- Data written during one session must be available when the user reloads the page or reopens the browser.83- The prototype must initialize correctly whether localStorage is empty or already contains data from a previous session.84- Provide a way to reset the prototype data without clearing unrelated localStorage entries. This can be a developer-facing utility or a visible control in the prototype UI, depending on the project's preference.8586## Review Questions8788When reading or reviewing prototype code, ask:8990- Does any code touch backend files, API routes, or server-side logic?91- Does the data layer follow the same abstraction the project uses for real data access?92- Does every data operation go through a simulated asynchronous delay?93- Does the UI show appropriate loading feedback during delays?94- Does the visual quality and code structure match the rest of the project?95- Does the prototype work correctly at every screen size and display mode the project supports?96- Does data persist across page reloads?97- Are localStorage keys namespaced to avoid collisions?9899If any answer is no, fix it before considering the work complete.100101## Report the Outcome102103When finishing the task:104105- State which features the prototype covers and confirm that all interactions are functional.106- State which data-access abstraction was used and confirm it matches the project's patterns.107- State the simulated latency ranges applied to read and write operations.108- State how loading, error, and empty states are handled and confirm they follow project conventions.109- State the localStorage key namespace used.110- State how to reset the prototype data.111- State which screen sizes or display modes were verified and confirm they match the project's supported targets.112- Confirm that no backend code was created or modified.