--- name: ui-first-builder description: > Creates production-ready UI immediately from any description. Generates complete pages, components, and realistic mock data in FIRST response. Uses Next.js 14 + Tailwind + shadcn/ui. Never asks questions - infers everything from context. Triggers: UI creation, page building, component generation, build interface, screen design, layout requests. --- # UI First Builder Create beautiful, functional UI immediately. No questions. No waiting. ## The First-Prompt Promise User describes idea → User sees working UI → Same prompt, no follow-up needed This is what makes Lovable magical. We replicate it here. NEVER ask: - "How many pages do you want?" → Infer from description, start with essential pages - "What color scheme?" → Use modern neutral (slate/zinc) + one accent - "What features do you need?" → Infer standard features for this app type - "Should it be responsive?" → ALWAYS responsive, mobile-first ALWAYS do: - Create complete, working pages - Include realistic mock data (based on language setting in CLAUDE.md) - Add hover states and transitions - Make it look professional immediately ## File Structure (Next.js 14 App Router) ``` src/ ├── app/ │ ├── layout.tsx # Root layout with providers │ ├── page.tsx # Home/Dashboard │ ├── globals.css # Tailwind + custom styles │ └── [feature]/ │ └── page.tsx # Feature pages ├── components/ │ ├── ui/ # shadcn/ui components │ ├── layout/ # Header, Sidebar, Footer │ ├── features/ # Feature-specific components │ └── shared/ # Reusable components ├── lib/ │ ├── utils.ts # cn() helper │ └── mock-data.ts # Realistic mock data ├── stores/ # Zustand stores └── types/ # TypeScript types ``` ## shadcn/ui Components to Use ### Always Available (assume installed) - Button, Card, Input, Label, Textarea - Dialog, Sheet, Dropdown Menu, Popover - Table, Tabs, Avatar, Badge, Separator - Select, Checkbox, Radio Group, Switch - Toast (sonner), Calendar, Date Picker - Command (for search), Skeleton (loading) ### Usage Pattern ```tsx import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" ``` ### DO NOT use components that don't exist - No custom components pretending to be shadcn - Stick to official shadcn/ui component list ## Mock Data Guidelines Mock data language depends on project language setting in CLAUDE.md. ### ✅ GOOD Mock Data (English - Default) ```typescript const mockUsers = [ { id: 1, name: "John Smith", email: "john@company.com", role: "Admin" }, { id: 2, name: "Sarah Johnson", email: "sarah@company.com", role: "User" }, { id: 3, name: "Michael Davis", email: "michael@company.com", role: "Editor" }, ] const mockProducts = [ { id: 1, name: "House Blend Drip Coffee", price: 4.50, stock: 45 }, { id: 2, name: "Matcha Green Tea Latte", price: 5.25, stock: 32 }, { id: 3, name: "Hot Chocolate", price: 3.75, stock: 28 }, ] const mockStats = { totalRevenue: 15842, ordersToday: 47, newCustomers: 12, conversionRate: 3.2, } ``` ### ❌ BAD Mock Data (Lazy/Obvious) ```typescript // NEVER DO THIS const users = [ { name: "Test User", email: "test@test.com" }, { name: "User 1", email: "user1@email.com" }, ] const products = [ { name: "Product A", price: 100 }, { name: "Lorem Ipsum", price: 999 }, ] ``` ### Mock Data Location Always create: `src/lib/mock-data.ts` Export typed data for components to import ## Styling Guidelines ### Color Philosophy - **Primary Background:** White or very light gray (bg-white, bg-slate-50) - **Cards:** White with subtle shadow (bg-white shadow-sm border) - **Text:** Dark gray, not pure black (text-slate-900, text-slate-600) - **Accent:** ONE color only - blue (default), or infer from app type - **Avoid:** Gradients on white, neon colors, pure black backgrounds ### Spacing System - Page padding: `p-4 md:p-6 lg:p-8` - Card padding: `p-4 md:p-6` - Component gap: `gap-4` or `gap-6` - Section margin: `mb-6` or `mb-8` ### Typography - Headings: `text-2xl font-semibold` (page title), `text-lg font-medium` (section) - Body: `text-sm` or `text-base` - Muted: `text-slate-500` or `text-muted-foreground` - NO Inter everywhere - use system font stack (already in Tailwind) ### Responsive Pattern ```tsx // Mobile-first, always
{/* Cards */}
{/* Layout items */}
```
## Common Page Patterns ### Dashboard Page ```tsx export default function DashboardPage() { return (
{/* Stats Row */}
{/* ... */}
{/* Main Content */}
{/* Chart or Table */} {/* Recent Activity */}
) } ``` ### List/Table Page ```tsx export default function ListPage() { return (
{/* Header with Search + Add Button */}

Products

{/* Table */} {/* ... */}
) } ``` ### Form Page ```tsx export default function FormPage() { return (
Add New Product
{/* Form fields */}
) } ```
## Always Include These States ### Loading State ```tsx // Use Skeleton from shadcn ``` ### Empty State ```tsx

No items yet

Start by creating your first item

``` ### Hover/Active States ```tsx // Cards // List items
// Buttons already have states from shadcn ``` ## Before Completing, Verify: - [ ] All pages render without errors - [ ] Mock data looks realistic (per language setting) - [ ] Responsive design works (mobile → desktop) - [ ] All buttons have hover states - [ ] No "Lorem ipsum" or "Test" placeholder text - [ ] shadcn/ui components used correctly - [ ] TypeScript types defined for all data - [ ] File structure follows convention - [ ] `npm run dev` will work immediately ## What NOT To Build ### ❌ Don't Create - Complex nested routing before basic pages work - Custom design system (use shadcn) - Authentication flow before main UI - API routes before UI exists - Database schema before seeing UI needs ### ❌ Don't Style - Gradient backgrounds on light mode - Neon/bright accent colors - Pure black (#000) text - Inconsistent spacing - Different fonts per section ### ❌ Don't Assume - User has specific components installed (ask shadcn to add) - Complex state management needed first - User wants to see architecture diagram - User needs explanation before seeing UI