ui-patterns

Use this skill when the user needs to build a dashboard, settings page, data table, or any page layout. Also use when choosing component libraries, implementing responsive design, dark mode, or handling UI states (loading, empty, error). Covers component selection, page composition, and responsive implementation.

157 stars

Best use case

ui-patterns is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use this skill when the user needs to build a dashboard, settings page, data table, or any page layout. Also use when choosing component libraries, implementing responsive design, dark mode, or handling UI states (loading, empty, error). Covers component selection, page composition, and responsive implementation.

Teams using ui-patterns should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ui-patterns/SKILL.md --create-dirs "https://raw.githubusercontent.com/whawkinsiv/solo-founder-superpowers/main/skills/ui-patterns/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ui-patterns/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ui-patterns Compares

Feature / Agentui-patternsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use this skill when the user needs to build a dashboard, settings page, data table, or any page layout. Also use when choosing component libraries, implementing responsive design, dark mode, or handling UI states (loading, empty, error). Covers component selection, page composition, and responsive implementation.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# UI Patterns

This skill covers how to build pages and compose components for SaaS applications. It provides the structural decisions — which components to use, how to lay out pages, and how to handle every UI state. For visual styling (colors, typography, spacing systems), see the beautify skill. For user flow design, see ux-design. For accessibility requirements (semantic HTML, keyboard nav, ARIA), see ux-design/ACCESSIBILITY.md.

## Component Library Selection

**Default: shadcn/ui + Tailwind CSS.** This is the correct choice for 90% of founder-built SaaS apps. shadcn/ui provides copy-paste components built on Radix primitives — you own the code, can customize freely, and avoid dependency lock-in.

Decision framework:

| Situation | Choice | Why |
|---|---|---|
| Public-facing SaaS product | shadcn/ui + Tailwind | Full design control, great defaults, accessible |
| Internal admin tool / back-office | Ant Design or MUI | Dense data display, built-in table/form patterns, faster to ship |
| Need one specific primitive (tooltip, dialog) | Radix directly | Skip the styling layer, use just the behavior |
| Existing MUI/Chakra codebase | Stay with current lib | Migration cost rarely worth it mid-project |
| React Native / mobile app | React Native Paper or Tamagui | Web component libs don't apply |

When using shadcn/ui: install components individually (`npx shadcn-ui@latest add button`), don't install everything upfront. Configure the `components.json` path aliases to match the project structure.

## Page Composition Principles

Every SaaS page follows a predictable anatomy. Structure pages using these content zones:

**Page header** — Title, description, primary action button (top-right). Breadcrumbs above the title if nested. Height: 64-80px.

**Primary content** — The main purpose of the page. Takes 60-70% of width on desktop. This is the "spine" — the vertical column the user's eye follows.

**Secondary content** — Supporting information, filters, related items. Sidebar or below primary content. Takes 30-40% width or full-width below on mobile.

**Actions area** — Sticky bottom bar for forms, floating action button, or inline with content. Never hide primary actions in menus.

The page spine principle: every page has one dominant vertical column. On a dashboard, it's the metrics-to-activity flow. On a settings page, it's the form sections. On a list page, it's the table. Identify the spine and give it visual priority — other content supports it.

Standard page container: `max-w-7xl mx-auto px-4 sm:px-6 lg:px-8`. For content-heavy pages (docs, settings forms): `max-w-3xl`. For full-bleed layouts (dashboards): no max-width, use the sidebar to constrain.

## The State Matrix

Every data-driven component must handle five states. Missing any one of these creates a broken experience. When building any component that displays dynamic data, implement all five:

### Loading State
Use skeleton loaders that match the shape of the real content. Never use spinners for inline content — spinners are only for full-page loads or button actions.

- Tables: render 5-8 skeleton rows with column-width-matched blocks
- Cards: render the card shell with pulsing placeholder blocks
- Lists: render 3-5 skeleton items
- Use `animate-pulse` with `bg-muted` blocks. Match heights and widths to actual content.

### Empty State
The most neglected state. Every empty state needs: an icon or illustration, a headline explaining what will appear here, a description of how to populate it, and a primary CTA button.

```
No projects yet → "Create your first project" button
No search results → "Try different keywords" suggestion
No notifications → "You're all caught up" message (no CTA needed)
```

Empty states are onboarding moments. Use them to teach users what to do next.

### Error State
Display what went wrong in plain language and provide a retry action. Never show raw error codes or stack traces.

- Inline errors: red text below the failed component + retry button
- Full-page errors: centered message with retry and "go back" options
- Network errors: "Connection lost. Retrying..." with auto-retry logic
- Always preserve user input on form errors — never clear fields

### Success State
The normal content display. This is what most developers build first (and sometimes only). Ensure it handles variable content lengths — long titles, missing optional fields, various image aspect ratios.

### Overflow State
What happens when there's too much data:

- Tables: paginate at 10-25 rows, show total count, provide page size selector
- Lists: infinite scroll or "Load more" button. Show count: "Showing 20 of 148"
- Text: truncate with ellipsis and "Show more" expand option. Use `line-clamp-2` or `line-clamp-3`
- Tags/badges: show first 3 + "+N more" pill

## Responsive Strategy

Use mobile-first with Tailwind's breakpoint system. Default styles target mobile, then layer on complexity:

| Breakpoint | Width | Target |
|---|---|---|
| default | 0-639px | Mobile phones |
| `sm` | 640px+ | Large phones, small tablets |
| `md` | 768px+ | Tablets |
| `lg` | 1024px+ | Small laptops, landscape tablets |
| `xl` | 1280px+ | Desktops |
| `2xl` | 1536px+ | Large monitors |

**What changes at each breakpoint:**

- **Mobile (default):** Single column. Bottom navigation. Cards stack vertically. Tables become card lists. Sidebar hidden behind hamburger. Modals go full-screen. Horizontal padding: 16px.
- **sm:** Minor adjustments. Two-column grids where appropriate. Slightly more padding.
- **md:** Sidebar can appear as collapsible overlay. Tables can show with horizontal scroll. Two or three column grids. Padding: 24px.
- **lg:** Full sidebar visible. Tables display normally. Multi-column layouts activate. Dashboard grids expand. Padding: 32px.
- **xl+:** Max-width containers center content. Extra whitespace on sides. Optional: wider sidebar, more columns.

**Key responsive patterns:**

| Desktop Pattern | Mobile Adaptation |
|---|---|
| Sidebar navigation | Bottom tab bar (5 items max) or hamburger menu |
| Data table | Stacked cards with key fields visible |
| Multi-column grid | Single column, stacked |
| Side-by-side panels | Tabbed or stacked sections |
| Hover tooltips | Tap-to-reveal or always-visible labels |
| Right-click context menu | Long-press menu or action row with icons |
| Modal dialog | Full-screen sheet sliding up from bottom |

For the sidebar-to-bottom-nav pattern: don't just hide the sidebar. Build a dedicated `BottomNav` component with 4-5 icon+label items. The items should map to the top-level sidebar sections, not be a 1:1 copy.

## Dark Mode

**When to implement:** If building an MVP for validation, skip dark mode. If building a product users will spend hours in (dashboards, dev tools, writing apps), implement from day 1. Adding dark mode later requires touching every component — it's significantly cheaper to build it in from the start.

**Implementation approach:**

1. Define all colors as CSS custom properties in `:root` and `.dark`
2. Use Tailwind's `dark:` prefix for overrides
3. If using shadcn/ui, this is already set up — just configure the theme in `globals.css`
4. Toggle with a class on `<html>` element: `document.documentElement.classList.toggle('dark')`
5. Respect system preference with `prefers-color-scheme` media query, but let users override
6. Persist preference in `localStorage`

**What changes beyond swapping background/text colors:**

- Shadows: reduce opacity significantly or remove entirely. Dark surfaces don't cast visible shadows — use subtle borders or lighter surface colors to create elevation instead.
- Borders: increase visibility. Use `border-border` (which maps to a lighter value in dark mode) rather than hardcoded colors.
- Images and illustrations: reduce brightness slightly (`brightness-90`). Avoid pure-white images on dark backgrounds.
- Status colors: adjust saturation down and lightness up. A red that works on white won't work on dark gray — it needs to be softer.
- Hover states: use `hover:bg-muted` rather than hardcoded opacity changes. Light mode hovers darken, dark mode hovers lighten.
- Focus rings: ensure visibility on dark backgrounds. Default blue rings work; custom colored rings may not.

## Common Mistakes

| Mistake | What to do instead |
|---|---|
| Building a custom component library from scratch | Use shadcn/ui. Customize after shipping. |
| Only implementing the success state | Build all five states (loading, empty, error, success, overflow) for every data component |
| Using spinners everywhere | Skeleton loaders for inline content, spinners only for page-level or button loading |
| Fixed layouts that don't respond to screen size | Mobile-first responsive with Tailwind breakpoints, test at 375px width |
| Hiding critical actions in dropdown menus | Primary actions get dedicated buttons, only secondary/tertiary go in menus |
| Pixel-perfect custom breakpoints | Use Tailwind's standard breakpoints — they cover real devices |
| Dark mode as an afterthought | Decide at project start: implement now or explicitly defer. Don't half-implement. |
| Tables on mobile with horizontal scroll only | Transform tables into card layouts on mobile, showing key data points |
| Modals on top of modals | One modal at a time. Use sheets/slide-outs for secondary actions from a modal. |
| Inconsistent spacing between sections | Pick a page section gap and stick with it: `space-y-8` for page sections, `space-y-4` within sections |

Related Skills

validate

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to validate a business idea, test demand before building, run a smoke test, create an MVP experiment, or decide whether an idea is worth pursuing. Covers demand validation, smoke tests, fake-door tests, landing page experiments, and go/no-go decision frameworks for bootstrapped founders.

ux-design

157
from whawkinsiv/solo-founder-superpowers

Use this skill when flows feel clunky, users are confused, navigation needs planning, onboarding needs design, or accessibility needs implementation. Covers information architecture, user flows, interaction patterns, progressive disclosure, and error handling UX.

translate

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user is a domain expert (lawyer, doctor, contractor, accountant, etc.) who wants to turn their professional knowledge into a software product. Also use when the user says 'I have an idea for my industry,' 'I know this problem exists,' 'I want to build something for [profession],' or is struggling to describe what they want the software to do. Helps identify which professional pain is worth building for, then translates it into requirements AI tools can execute.

test

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to test features before deployment, create test scenarios, find edge cases, or verify bug fixes. Covers manual testing workflows, cross-browser testing, edge case identification, and testing checklists for non-technical founders.

technical-seo

157
from whawkinsiv/solo-founder-superpowers

Use this skill to implement technical SEO optimizations in code — meta tags, schema markup, Core Web Vitals, crawlability, robots.txt, sitemaps, and GEO (Generative Engine Optimization) for AI search engines. This is the implementation skill — for strategy see seo, for content writing see seo-content, for auditing see seo-audit.

support

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to create help docs, build a knowledge base, set up self-serve support, or reduce support tickets. Covers documentation strategy, help center structure, support tone, and scaling support without hiring.

social-media

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to grow a social media presence, create content for Twitter/X, LinkedIn, or other platforms, build a founder brand, or use social media as a distribution channel. Covers platform strategy, content frameworks, posting cadence, and audience building for bootstrapped SaaS founders.

seo

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to plan SEO content, do keyword research, build a content calendar, map search intent to page types, or create an internal linking strategy. Also use when the user says 'how do I rank higher,' 'what should I write about for SEO,' 'SEO plan,' 'what keywords should I target,' or 'how to get organic traffic.' This is the strategy and planning skill — for writing content see seo-content, for technical implementation see technical-seo, for auditing see seo-audit.

seo-content

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to write SEO content — blog posts, landing pages, feature pages, comparison pages, how-to guides, or any content meant to rank in search and get cited by AI. Covers content briefs, humanized writing that avoids AI detection, SERP feature targeting, entity optimization, content refresh, and quality self-checks. This is the writing skill — for strategy see seo, for technical implementation see technical-seo, for auditing see seo-audit.

seo-audit

157
from whawkinsiv/solo-founder-superpowers

Audit a codebase for SEO and AI-answer visibility, then produce a prioritized fix-it plan. Use this skill whenever a user says things like "audit my SEO", "check my site for search visibility", "how do I rank better", "optimize for Google", "optimize for AI answers", "SEO review", "GEO audit", "run the SEO agent", or anything about improving organic traffic or search rankings. Also trigger when someone mentions wanting visibility in AI-generated answers (ChatGPT, Gemini, Perplexity, Claude). Works on any web project — static sites, Next.js, Astro, Hugo, WordPress themes, or anything that outputs HTML.

secure

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to secure their SaaS app, implement authentication, protect user data, secure APIs, or check for vulnerabilities. Also use when the user says 'is my app secure,' 'security check,' 'I'm worried about hackers,' 'how do I protect user data,' or 'security before launch.' Covers OWASP Top 10, auth best practices, data protection, and security checklists for apps built with AI tools.

sales

157
from whawkinsiv/solo-founder-superpowers

Use this skill when the user needs to find their first customers, write cold outreach, build a prospect list, or close early sales. Covers founder-led sales methodology, outreach templates, personalization, LinkedIn strategy, and landing the first 100 customers.