From Bare Prompts to Designed Pages: Raising the Quality of AI-Generated Front-End Interfaces
This article walks through building a local image slicing tool with an AI coding assistant. It compares a basic version, generated from functional requirements alone, with a version generated after design guidelines were added. It also covers key implementation points, a manual test checklist, and low-cost static hosting.
1. Background: Working Is Not the Same as Usable
More developers now use AI coding tools to build web apps quickly. For lightweight tools such as image processing, content operations, and data organization, AI can often produce the page structure, interaction logic, and basic styling in a short time.
However, a page that opens is only the minimum requirement. In real use, people also care about the following:
- Whether the page has a clear visual hierarchy.
- Whether the main action stands out.
- Whether the upload, processing, and download steps are easy to understand.
- Whether the empty, error, and completed states are all handled.
- Whether the image preview uses screen space well.
- Whether the layout breaks on mobile or narrow windows.
- Whether controls, spacing, colors, and fonts stay consistent.
If an AI coding tool receives only a feature description, it usually prioritizes “it works” over “it looks good, is easy to use, and can be maintained.” As a result, the same requirement can produce noticeably different results depending on whether front-end design guidelines are included.
This article uses a local image slicing tool as an example. The tool is for content operations staff. It splits one large image into a nine-grid, four-grid, or vertical three-part set of slices, and supports previewing and downloading the results.
2. Goals and Scope
This project does not rely on a server to process images. All operations run locally in the browser. This has three direct benefits:
- Images are never uploaded to an external service, which lowers the risk of privacy leaks.
- No backend API needs to be configured, so deployment costs are low.
- The page works as soon as it is opened, which suits personal tools and small internal tools.
The core features include:
- Selecting a single image by clicking or by dragging and dropping it.
- Choosing nine-grid, four-grid, or vertical three-part slicing.
- Previewing the slices on the page.
- Showing a sequence number on each slice.
- Downloading each slice individually.
- Downloading all slices as one package.
- Showing clear messages for unsupported files, empty files, and processing errors.
One point needs to be clear: design skill cannot replace functional design. A page with attractive colors is still not a good tool if the upload flow is unclear, buttons give no feedback, or the downloaded results are incomplete. The sound approach is to define the functional scope first, then use design guidelines to improve usability and visual polish.
3. Preparing a Clean Development Directory
Create a separate working directory so experiment files do not mix with other projects. For a common command-line environment:
mkdir image-splitter-democd image-splitter-demo
Then launch your local AI coding environment. When it asks you to confirm trust, choose to trust the current directory. A dedicated directory helps with management, and it also lets the AI assistant identify the project scope more accurately, reducing the chance that it reads unrelated files.
If your tool supports skills or capability modules, first check whether any modules related to web design, UI layout, interaction guidelines, or visual optimization are already enabled. You can use a prompt like this:
Please check whether capabilities related to web design, user interface layout, interaction guidelines, and visual optimization are already enabled in the current environment.List the existing capabilities and explain what problem each one is suited to solve.If no suitable capability exists, install a public, general-purpose capability module for improving front-end design quality.After completing the task, report the result of the activation, but do not modify any project files.
The key at this step is not to install modules blindly. First, have the tool explain which capabilities exist and what each one solves. In practice, more modules do not always help. Duplicate or conflicting rules can make the output unstable.
4. Generate a Basic Version as a Baseline
To see how design guidelines change the result, first ask the AI coding tool to generate a basic page without any extra design capability. The prompt should state the functional scope, how to run the page, and the acceptance criteria:
Please create a standalone index-basic.html in the current directory that implements a local image slicing tool.Requirements:1. The page must run by opening it directly in a browser, without a backend service.2. Images are processed only in the browser and are not uploaded to any external address.3. Support selecting an image by clicking, as well as by dragging and dropping.4. Provide three slicing modes: nine-grid, four-grid, and vertical three-part.5. After upload, show the slicing results on the page, with a sequence number on each image.6. Each slice can be downloaded individually.7. Support downloading all slices as one package.8. Show a clear empty state when no image is loaded.9. Show an error message when the file type is unsupported or reading fails.10. Build with native web technologies, and keep the code in a single file.11. Make sure all features work first, then use simple, restrained styling.
The basic version serves as a reference point. It usually produces the upload area, mode buttons, image drawing logic, and download logic quickly. Visually, however, it tends to look plain. Common issues include:
- All content sits in a single white panel.
- Primary and secondary buttons are not clearly differentiated.
- The upload area and the results area lack visual hierarchy.
- Slice cards are inconsistent in size.
- There are no processing states.
- Error messages appear in unpredictable places.
- Large images and narrow screens are not handled well.
These problems do not mean AI cannot build a better interface. They show that the original prompt did not describe the design goals clearly.
5. Add Design Guidelines and Generate an Enhanced Version
Once the basic features work, ask the tool to generate a second version with its design capability enabled. Do not just say “make the page beautiful,” because “beautiful” is not an actionable standard. A more effective prompt describes the users, the scenario, the visual direction, and the interaction requirements:
Based on the features of the current image slicing tool, please create a standalone index-designed.html.Do not modify the original basic version, so the two can be compared.The target users are content operations staff who need to process images for articles quickly.The page should feel clear, reliable, fast, and professional, rather than like a plain form.Design requirements:1. The upload entry should stand out on the first screen, and clearly state that both drag-and-drop and click-to-select are supported.2. Use a clear visual hierarchy to separate upload, slicing settings, result preview, and download actions.3. The primary action button should be prominent, and secondary actions should stay restrained.4. Use a consistent system of spacing, corner radius, borders, font hierarchy, and colors.5. Before upload, show a friendly empty state. During processing, show progress or status feedback. After completion, show a summary of the results.6. The results area should use a regular grid. Sequence numbers should be clear but must not cover the main subject of the image.7. Each slice should have a clear download entry, and there should be one prominent button for batch download.8. The page should adapt to common desktop windows and narrower screens.9. Provide understandable messages for invalid files, oversized images, read failures, and duplicate uploads.10. Keep all processing local, and do not add any network upload logic.11. Keep the code structure clear, add comments where necessary, and make sure every button actually works.12. After finishing, test the upload, the three slicing modes, single downloads, and batch download flows yourself.
The key to this type of prompt is turning design goals into rules that can be verified. For example, “professional” can be broken down into a consistent color system, stable spacing, clear button hierarchy, and complete state feedback. “Easy to use” can be broken down into fewer steps, an obvious current state, and timely error messages.
6. Typical Differences Between the Two Versions
First, layout.
The basic version often stacks everything from top to bottom. The enhanced version organizes content around the task flow: a short description at the top, a prominent upload area in the middle, slicing settings next, and results at the bottom. Users can understand the next step without reading much text.
Second, actions.
The basic version usually provides buttons, but they have no clear priority. The enhanced version separates primary, secondary, and destructive actions. For example, “Start slicing” can use a high-contrast button, “Choose another image” can use a secondary button, and “Clear results” can use a low-emphasis style.
Third, states.
A good tool handles more than the success path. It also handles empty, loading, success, and failure states. After an image is uploaded, users should know the system is reading it. When slicing finishes, users should see the number of slices and their dimensions. When a file is unsupported, users should know how to fix the problem.
Fourth, visual consistency.
Enhanced versions often define a set of design tokens, such as:
:root {--color-primary: #2563eb;--color-text: #172033;--color-muted: #667085;--color-border: #d9e0ea;--color-surface: #ffffff;--radius-panel: 18px;--space-unit: 8px;}
Managing colors and spacing through variables means that later adjustments require changing only a few values, not searching for repeated values across many selectors.
Fifth, maintainability.
Pages built only for visual effect often contain many repeated styles. Pages built on design guidelines are usually easier to split into components and reuse. Even when a project is a single HTML file, the upload area, control panel, result cards, and message area should still have clear boundaries.
7. Key Technical Points
Image slicing can usually be done with the canvas capabilities that browsers provide. The basic approach is:
- Read the image the user selected.
- Get the original width and height.
- Calculate the region for each slice based on the number of rows and columns.
- Draw each region onto a new canvas.
- Export the canvas as an image file.
- Create a temporary download URL.
A nine-grid layout uses three rows and three columns. A four-grid layout uses two rows and two columns. A vertical three-part layout uses three rows and one column. When the image width or height cannot be divided evenly, assign the remainder to the last column or row. This prevents blank pixels or missing content at the edges.
For batch download, convert each slice to binary data first, then add it to a compressed archive. Keep these points in mind:
- Include the sequence number in each file name.
- Check that results have been generated before starting a batch download.
- When processing large images, avoid creating too many duplicate objects at once.
- Release temporary resources when the page is closed or the image is processed again.
- If the browser does not support a required capability, provide single-file download as a fallback.
8. Test Checklist: Do Not Rely Only on Screenshots
After the page is generated, test it using real user flows:
- Click the process button without uploading an image. Check whether a message appears.
- Upload a non-image file. Check whether processing is blocked.
- Drag a file onto the designated area. Check whether it is recognized.
- Replace one image with another. Check whether the old results are cleared.
- Confirm that all three slicing modes produce the correct number of slices.
- Confirm that the sequence numbers start at one and run continuously.
- Open a single downloaded file to confirm it works.
- Confirm that the batch download contains all slices.
- Use a very wide or very tall image. Check whether the preview is distorted.
- Narrow the window. Check whether buttons or the grid overflow.
- Process a large file. Check whether the page gives feedback during the wait.
- Confirm that error messages are clear and do not cover the main content.
If you use an AI coding tool to run the self-check, you can send a prompt like this:
Please test the current page by following real user flows.Focus on uploading, drag-and-drop, the three slicing modes, clearing results, single downloads, batch download, error messages, and narrow-screen layout.List the problems you find first, then fix them one by one.After fixing, do not remove any existing features, and explain the reason for each change.
9. Low-Cost Publishing
A front-end tool like this does not need a complex server. As long as the HTML, CSS, and JavaScript files can be served as static files, you can publish them with a static file host. Common options include:
- Using a personal computer as a temporary preview environment.
- Deploying to a static website hosting service.
- Using the static website feature of object storage.
- Using a content delivery network to speed up static assets.
- Publishing with a simple file server inside an organization.
If you want to add cloud services later, such as Baidu AI Cloud, choose general capabilities like object storage, content delivery, or log services based on your scale and your region’s availability. For a tool that processes images entirely in the browser, the cloud mainly hosts the page. Users’ images never need to be uploaded, so there is no need for a complex backend API.
10. Conclusion: The Value of Design Guidance Is Lower Communication Cost
The main difference between the basic version and the enhanced version is not just colors and rounded corners. It is how deeply the tool understands the user’s task.
A basic generation focuses on whether the feature exists. Design guidance goes further and asks:
- Can users find the entry point quickly?
- Does each step give clear feedback?
- Can the page support a real workflow?
- Are error cases handled carefully?
- Are the code and visual rules easy to maintain later?
For this reason, the most effective way to work with an AI coding tool is not to ask it once to “make it look good,” but to proceed in stages:
- Define the technical boundaries first.
- Build the minimum usable features.
- Create a basic version as a baseline.
- Add general design guidelines.
- Complete the states, error handling, and responsive layout.
- Test with real workflows.
- Finally, deploy as a static site.
For personal tools, content operations tools, and internal productivity apps, this approach can produce pages closer to production quality without writing much code by hand. More importantly, it turns a subjective aesthetic problem into an engineering problem that can be described, checked, and improved.
