User Experience Basics for AI Coders
Pretty doesn't mean usable. Here's how to make your site feel great.
In this chapter
- The 5 UX principles every AI coder needs to know
- How to design for tap targets on mobile
- Loading, empty, and error states (the three states people forget)
- How to give users feedback so they know what just happened
The 5 Principles That Cover 90% of UX
You don't need a design degree. Just remember these five rules and your site will already feel better than 80% of the web.
The Three States Everyone Forgets
When AI builds you a feature, it usually shows you the "happy path": what the screen looks like when everything works perfectly. But there are three other states that matter just as much:
“For every place in my app that shows a list of items, add proper loading, empty, and error states. Use animated skeleton loaders while data loads, a friendly empty state with a CTA when there's nothing to show, and a clear error message with a retry button when fetching fails.”
Tap Targets: The Biggest Mobile UX Mistake
Every clickable element on a phone needs to be at least 44 pixels by 44 pixels. That's about the size of an adult fingertip. Smaller than that and people miss.
The trick: even if a button looks small visually, you can give it invisible padding so the tap area is bigger. Your AI tool knows how to do this.
Bad
- Tiny X to close a modal (8×8 px)
- Two icons side by side with no spacing
- Text links that are 12px tall on mobile
- Checkboxes you can't hit with a finger
Good
- Close button with 12px padding (44×44 total)
- Icons separated by 8px or more
- Links with vertical padding so the row is tappable
- Checkboxes wrapped in a clickable label
Feedback: Tell Users What Just Happened
Every action a user takes should produce visible feedback. If they click a button and nothing changes for a second, they assume it's broken and click again. Now you have two of whatever they were doing.
10 Common UX Mistakes
Do these and people bounce. Fix these and your site instantly feels professional.
Visual Hierarchy in Practice
When you look at a well-designed page, your eye is guided through it in a deliberate order. Big headline first. Subheadline second. Then the CTA button. Then the supporting details.
You create hierarchy with three tools: size, weight, and color. Bigger = more important. Bolder = more important. More colorful = more important.
Build your first app
Without writing a single line of code.
No credit card required.
Real World Example: Auditing your homepage UX in 5 minutes
You just shipped your new landing page and asked a friend to look at it. They say "it looks nice" but don't click the signup button. Instead of guessing why, run a UX audit prompt to find what's wrong with the page from a usability standpoint.
“Audit my homepage for UX problems. Check for: visual hierarchy (is the main CTA obvious?), tap target sizes on mobile, loading and empty states, missing feedback after actions, and accessibility basics. List every problem you find with a screenshot description and suggest a fix for each one.”
Prompt This
“Find every place in my app that fetches data and add a proper loading state. Use skeleton loaders (gray animated placeholder boxes) instead of generic spinners. Make sure no part of the UI shows blank while data is loading.”
“Audit my site for tap targets that are too small on mobile. Every button, link, icon, and checkbox should have at least 44×44 pixels of tappable area. Add invisible padding where needed without changing the visual design.”
“Whenever a user successfully saves, deletes, copies, sends, or otherwise completes an action in my app, show a small toast notification confirming what just happened. Use Sonner or a similar library. Make sure errors show as red toasts and successes as green ones.”
Frequently Asked Questions
What is the difference between UX and UI?
UI (user interface) is what something looks like: colors, fonts, button shapes. UX (user experience) is what it feels like to use: is it confusing, slow, frustrating, satisfying? Pretty UI with bad UX is like a beautiful car with no steering wheel.
I'm not a designer. How do I build good UX?
You don't need to design from scratch. Just remember three things: (1) make the most important action obvious, (2) tell users what's happening at every step, and (3) prevent mistakes before they happen. Most UX problems break one of those rules.
Do I need to test with real users?
Eventually, yes. But for your first version, ask three friends to use it without instructions and watch what they do. You'll learn more in 15 minutes of watching than 5 hours of guessing.
What is a 'click target' and why does it matter?
A click target is the clickable area of a button or link. If it's smaller than your fingertip on a phone (44x44 pixels minimum), people miss it and get frustrated. Tiny tap targets are the #1 mobile UX mistake.