ui
Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.
- License 许可
- Apache-2.0
- 所属仓库
- enowdev/enowxcli
- 最近更新
- 2026-10-06
- Stars
- ★ 67
- Forks
- 21
01 前言 Front Matter
- name
- ui
- description
- Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.
03 SKILL.md 正文
Interface design
Generated interfaces fail in a way anyone can spot: a gradient hero, three identical feature cards, invented numbers, an icon on every line, everything centred, nothing that could not belong to any other product. This is how to build one that belongs to its product and works for the people using it.
1. Find the direction, or set one
Look before designing: DESIGN.md, a brand or style guide, the logo, the
colours and fonts already in the CSS or theme, screenshots in the repository.
Use what is there, including its tokens and components.
When there is nothing, set a direction from what the product is and who uses it, and write it as one line in your report:
Reading this as: a booking page for a neighbourhood physio clinic, calm and plain, one warm accent, no motion beyond hover.
Hold it on every screen. A direction you cannot state in a line is not one.
A mood and a palette are not yet a direction; they leave the page to fall back on the default for its category. Give it a concept: one idea taken from the subject itself that decides the layout, the type and the details.
- A developer who builds local-first command-line tools: the page as a well-made manual. Dense and typographic, sections set like a manual's headings, real commands with their real output as the images.
- A wedding photographer: the photographs full-bleed and in sequence, text small and sparse, the layout following the pictures' own proportions.
- A neighbourhood bakery: warm paper and a menu board's structure, prices in their own column, this week's bake as the headline.
Every category has a default that reads as generated. For a developer, a dark page with monospace labels and one amber or green accent; for a startup, a gradient hero over three cards; for a clinic, stock photographs of smiling people; for a restaurant, a full-screen food photo under a script font. Name the default for the category you are designing, then do something else, or take it further on purpose because the concept asks for it.
Write it down in DESIGN.md at the project's root when the project has
none, so every later change keeps to it. Keep it short, decisions not
essays:
# Design
Direction: a booking page for a neighbourhood physio clinic, calm and plain.
Concept: the clinic's own appointment card: one column, times in a grid.
Audience: adults booking a first visit, many on phones.
Theme: light only.
Palette: paper #F6F2E9, ink #15302A, muted #4C6058, accent #0F6B4F (the one
primary action), line #DCD4C4. Defined as tokens in styles.css.
Type: Fraunces for headings, Plus Jakarta Sans for text; scale 14/16/20/25/31/39.
Spacing: 4px base, tokens --s-1 to --s-9. Radii 6/12. Shadows only on overlays.
Icons: Tabler, outline, 20px beside text.
Motion: hover and focus only.
Placeholders: clinic name, phone, address, hours, prices (listed in README).
Read it before every change, and update it when the user changes a decision. Do not fall back to the generated default: a dark page, a blue-to-purple gradient, glowing buttons and a grid background say "made by a model" and nothing about the product.
Worked references
Four hand-designed sites, measured into skills: their skeleton, wireframes, measures and the anatomy of their parts. Read the one closest to the page you build, before you lay it out:
| Building | Read |
|---|---|
| A launch, waitlist or single-product page | ui-reference-launch |
| A product or SaaS site with features, proof and pricing | ui-reference-saas |
| A studio, agency, consultant or project portfolio | ui-reference-studio |
| A store, marketplace or catalogue | ui-reference-marketplace |
Take their structure and their decisions: how a section is introduced, what stands where an icon or a stock photo would, how a card carries its facts, how few buttons and colours they use. Never their words, names, figures, logos, images or colours, and never their concept: each came from its own product, as yours must (above). What they share is worth keeping on any page:
- One concept, visible in every section, not only in the hero.
- Evidence in the image slots: the product's real output, real pieces of its interface, dated numbers. Not icons in circles or stock photos.
- A section introduced by a pair: a small label and the heading on one side, the sentence that explains it on the other, over a hairline. Not a centred heading and subtitle over three cards.
- Headlines with a turn: the claim, then its consequence in the muted colour or an italic.
- Hairlines, rules and outlines instead of shadows and filled boxes; one filled button per view at most.
- Small uppercase labels with wide tracking as the page's signposts and data labels, one style used everywhere.
- A footer that says in one line what the thing is, then only the links that exist.
2. Layout
- One focal point per screen: what the user came for is the strongest element, and everything else defers to it. One primary action per view; secondary actions look secondary.
- Structure follows the content and the task, not a template. A section exists because the product has something to say there. Shapes to avoid by default: hero, three identical cards, a "trusted by" logo row, testimonials, FAQ, CTA band, four-column footer, in that order on every page; "how it works" in exactly three numbered circles; a bento grid; a fake terminal window as the hero.
- Group by proximity: related things sit closer together than unrelated ones, and the space between sections is larger than the space inside them.
- Align to a grid: a few column widths, one gutter, edges that line up. Body text at 60 to 75 characters a line. Page content inside a maximum width (around 1100 to 1280px) while backgrounds may run full width.
- Vary the rhythm: not every section is a centred heading over a grid of equal cards. Alternate text-led and image-led, contained and full-width, dense and open.
- App screens: build around the decision the user makes there. The default admin shell (sidebar, four stat cards, a chart, a table) fits every product and so none. In tables, choose columns from that decision, put the deciding field first, left-align text and right-align numbers.
Layout mechanics (not optional)
A page built from hand-placed boxes drifts: a card a few pixels taller than its neighbour, a gap that differs by row, a control that renders one way on macOS and another on Windows. These rules keep it tidy everywhere; check them before anything else.
- Every layout is flexbox or grid. Grid for anything with rows and
columns (card grids, forms in two columns, a page with a sidebar,
dashboards); flexbox for one line of things (a toolbar, a nav, a button
row, a card's own stack). No floats, no
inline-blockrows, noposition: absoluteto place content, no<br>or emptydivs for space, no margins on children to fake a gap.ui-layout-gridhas the recipes. - Space between items is the container's
gap, from the spacing scale: one gap per grid or row, 16 or 24px between cards, 8 to 12px between the parts inside one. Never a different margin on the first or last item. - Items in one group are one size. Cards in a grid share column width
(the grid's tracks, never a width on the card), padding, radius, border,
media aspect ratio (
aspect-ratioon the image box) and title size. The odd one out needs a reason (a featured item spans two columns, on purpose). - Items in one row are one height. Grid and flex rows stretch their
items (
align-items: stretch, the default); the card is a flex column with its action pushed to the bottom (margin-top: auto), so buttons and prices line up across the row. Heights are never set by hand to match. - Controls are one height too. An input, a select and a button side by
side share a height token (40px, or 36px dense; 44px on touch) and
align their centres (
align-items: centeron the row). - Dropdowns are custom, never the bare OS one. A native
selectlooks different on every OS and browser and cannot be styled open. Use the stack's component (shadcn/RadixSelect, Headless UIListbox, React AriaSelect, Bits UI, Melt) or the plain listbox inui-part-choicessection 7. The exception: a form meant mainly for phones may keep the native one, styled closed.
3. Spacing and sizing
- A spacing scale as tokens, on a 4px base (4, 8, 12, 16, 24, 32, 48, 64, 96), used everywhere. No one-off values.
- Heights come from content. No fixed heights on anything holding text, no
100vhsections; usemin-heightwithdvhwhen a section really should fill the screen.
4. Typography
- One or two families, chosen for the product's character, with the reason in your report. A default pick (Inter, Geist, Space Grotesk, IBM Plex) made out of habit is a tell, not a choice.
- Give the headline face character: a serif, a grotesk with a distinct shape, a condensed or a wide face, whatever the concept asks for; pair it with a plain face for text. Monospace is for code, commands and figures that align, not a costume for every label.
- Contrast in size carries the hierarchy: the largest headline at least two and a half times the body size, the small print clearly smaller. A page where headings, text and meta are all within a few pixels reads flat.
- A type scale with few steps, as tokens (for example 14, 16, 20, 25, 31, 39:
a 1.25 ratio), with
clamp()for display sizes so they scale with the window. - Body at 16px or more, line height about 1.5 for body and 1.1 to 1.25 for headings.
- Hierarchy through size and weight first, colour second. Avoid decorative uppercase labels with wide letter-spacing, and monospace headings used as a "tech" costume.
5. Colour
- Every colour is a token: background, surface, text, muted text, border, accent, and the status colours.
- A small palette: neutrals, two or three core colours and one accent. The accent marks the key moment (the primary action, the current item), not everything.
- Contrast is computed, not judged by eye: text 4.5:1, large text (24px, or 19px bold) 3:1, controls, borders that identify a control, and focus indicators 3:1 against what surrounds them.
- Dark by default only with a reason the concept gives (a media player, a photographer of night scenes). "It is for developers" is not a reason on its own. Otherwise light, or a toggle where both themes are checked.
- With two themes, every token has a value in each, and everything drawn
(icons, line drawings, logos, charts) is coloured from those tokens, so it
stays visible in both: a drawing left black disappears on the dark page.
Read
ui-themesbefore building the second theme or a drawing for it. - Gradients, glass, glow and large shadows are accents with a purpose, on one or two elements, never the page's texture.
Neutrals decide whether it looks designed
Most generated palettes fail in the neutrals, not the accent: a "dark"
page in charcoal grey (#1e1e1e, #27272a), a light page in dull grey
(#e5e5e5), text in the same grey family, everything a little muddy.
- Dark means dark. The page background at 3 to 8% lightness:
#0a0a0a,#0c0d0f,#111110. Not#1a1a1ato#2d2d2d, which reads as a grey panel, not a dark room. Raised surfaces step up by 2 to 4% each (#0c0d0fpage,#141518card,#1c1d21popover), so depth comes from small steps, not from a grey base. - Text on dark is off-white, not grey: body at 88 to 94% lightness
(
#ecebe8), muted text around 60 to 65% (#9a9893), never below 4.5:1. Pure#ffffffbody text on near-black glares; keep pure white for the one thing that must pop. - Light means light. The page at 93 to 100% lightness (
#ffffff,#fafaf7, a warm paper#f6f3ec), text near-black at 8 to 15% (#16150f), not mid-grey#555for body copy. - Tint the neutrals a few degrees toward the accent's hue or the
concept's temperature (warm ink
#12110f, cool night#0b0d12) instead of dead RGB greys; keep the tint subtle (saturation 3 to 10%). - Borders are quiet: 8 to 14% above the background on dark, 8 to 12% below it on light, and a border that marks a control reaches 3:1.
- The accent is saturated enough to be the accent against those neutrals, and used on under a tenth of the screen.
- The
previewtool reports a page background in the grey middle ground (between about 9% and 92% lightness).
6. Icons
- One icon set for the whole product. Use the project's (look in its dependencies and assets). With none, choose one whose style suits the product (stroke weight, outline or filled, corner shape) and name it in your report. For example: Phosphor (six weights, friendly), Tabler (even 2px stroke, technical, very large), Heroicons (compact, outline and solid), Material Symbols (variable weight and fill, suits app interfaces), Lucide (thin rounded strokes, so common it reads as a default: choose it for its look, not out of habit).
- Import icons one by one from the package, so only those used ship. A static
page without a bundler inlines the SVGs it uses, as
<symbol>elements referenced with<use>, fetched exactly with theicontool: never type an icon's path from memory. No icon fonts, and no runtime icon script from a CDN for a handful of icons. - Size icons on a scale tied to the text beside them (16, 20, 24), colour
them with
currentColor, keep one stroke width, centre them on the line. - An icon earns its place by making something faster to recognise. A word is often clearer; not every list item or card needs one. Never emoji as interface icons, and not the generic glyphs (sparkles, rocket, lightning, magic wand) standing in for features.
- Icon-only buttons get an accessible name (
aria-labelor visually hidden text); decorative icons getaria-hidden="true".
7. Components
- Each part of a page (header, navigation, sidebar, hero, sections, footer,
buttons, forms, tables, dialogs, menus, notifications, empty states,
steps, dates, uploads, a command palette, chat, media) has its own entry,
with what to build and what to avoid, in its own
ui-part-*skill (ui-part-header,ui-part-hero,ui-part-tables...), and each kind of page its skeleton in aui-page-*skill (landing, dashboard, list and detail, shop, blog, onboarding, error pages...). Read only the ones you build. - How it behaves is the
frontend-*family's (state, data, forms, accessibility, performance, errors), how it moves themotionfamily's. - Reuse first: search the project for the component (Button, Input, Dialog, Card, Tabs) and use or extend it.
- Prefer a component library to hand-built parts. A hand-rolled table,
select, dialog or date picker is where generated interfaces break: focus
that escapes, a menu that cannot be closed from the keyboard, a table with
ragged columns. Use the project's library when it has one. For a new
project, pick an established one for the stack, themed with the direction's
tokens rather than left at its default look:
- React or Next with Tailwind: shadcn/ui (Radix underneath); without Tailwind: Mantine, or Radix Themes
- Vue or Nuxt: Nuxt UI, or shadcn-vue; PrimeVue for data-heavy screens
- Svelte: shadcn-svelte (Bits UI underneath), or Skeleton
- Angular: Angular Material, or Spartan
- React Native: Tamagui, or React Native Paper; Flutter: Material 3
- Plain HTML: Web Awesome (Shoelace), or Pico CSS for a simple page Tables with sorting, filtering or many rows use TanStack Table (the library's data table is usually built on it); charts use the library's chart kit or Recharts, Chart.js, or ECharts, not hand-drawn bars.
- One icon library, imported as components, the one that ships with the
component library when it has one (Lucide with shadcn, Tabler with
Mantine, Heroicons with Tailwind UI, Material Symbols with Material).
Navigation items, actions and statuses get icons; decoration does not.
The
icontool is for a page with no package manager. - When the library is open and the project is new, pick the usual one for the stack (shadcn/ui with Lucide for React and Tailwind) and say so; ask only when the user is brainstorming, or the brief names a choice to make.
- A component for each named concept, and wherever the same markup repeats
with different content. Variants through props (
variant,size), never copies. Pass native attributes through, so a Button stays a button. - Design every interactive state: hover, focus-visible, active, disabled, loading, and for fields, invalid with a message.
- Radii from a small set (for example 4, 8, 12); shadows only to show that something sits above something else. A card only when the content is a card: a bordered box around every paragraph is noise, not structure.
8. States and behaviour
- Every view that shows data has an empty, a loading and an error state, and each says what is going on and what to do: "No invoices yet. Create one to see it here." A bare spinner or "No data" says nothing.
- Every control does something real: links go to pages or sections that exist, buttons act, forms submit and confirm. A control that cannot work yet is removed, or visibly labelled "Coming soon".
- A control that cannot be used now says why, and offers what can be done instead ("On loan until 3 Oct · Reserve"), never a greyed-out button with no reason.
- A placeholder reads as a placeholder ("[your email]"). The note on how to fill it in goes in the README, never on the page where visitors read it.
- Forms: a visible label for each field, the error beside the field in words, a submit button that says what it does and shows progress while it works.
- Long pages: the top bar sticks, so the navigation is always in reach
(
ui-part-header), and a page longer than about three screens on a phone has a back-to-top control that appears after the first screen (ui-part-back-to-top).
9. Responsive
- Design the narrow screen as a state of its own, not a leftover: write the CSS mobile-first, then widen.
- Put breakpoints where the content breaks, not at device widths.
- Grids with
repeat(auto-fit, minmax(…, 1fr))or a collapse to one column;min-width: 0on grid and flex children that hold text; images withmax-width: 100%and their width and height set. - No horizontal scroll at 360px. A wide table reflows or scrolls inside its own container.
- Touch targets at least 44px, with space between them; anything revealed on hover also opens on tap.
- Navigation collapses to a labelled menu, or a bottom bar that never covers the content.
10. Accessibility
- Semantic elements:
buttonfor actions,afor navigation, oneh1and headings in order,nav,main,footer, lists for lists,labelfor every input. - Keyboard: everything reachable in visual order and operable with Enter and
Space; dialogs close with Escape and give focus back. A visible
:focus-visiblestyle on every control; neveroutline: nonewithout a replacement. - Colour is never the only signal: status colours come with text or an icon.
- Respect
prefers-reduced-motion. Motion has a purpose (feedback, orientation, continuity), lasts 150 to 300ms for interface states, and nothing loops forever without one (motionfor entrances, reveals and anything more). - The patterns for each widget, focus management and testing with a screen
reader are in
frontend-accessibility. - Images have alt text that says what they show, or
alt=""when they are decoration.
11. Content
- Real content, or placeholders that say they are placeholders:
[Company logo],[Customer quote]. Never invented statistics, testimonials, customer logos, people or awards. - Facts about the business you were not given (its name, prices, hours, policies) stay visible placeholders on the page, not plausible guesses, and are listed in your report.
- Copy follows the
writingskill: specific, plain, and actions named for what they do.
12. Before you call it done
- Build it, and run the project's linter and tests.
- Search the CSS for colour, spacing and radius values written outside the token definitions, and move each into a token.
- Look at it with the
previewtool: it renders the page at 360, 768 and 1440px and measures overflow, contrast, dead links, unnamed controls and touch targets, with a screenshot of each width. Without a browser, read the CSS for those widths instead, and say so. - Walk the keyboard path and every state.
- A favicon, or
<link rel="icon" href="data:,">, so the browser's request for one does not end in a 404 in the console. - Report the direction, the icon set, and anything left as a placeholder.
04 同仓库更多 Skills
demo-skill
Project-scope demo skill for tests.
writing
Writing words people read: the specific thing instead of claims, words to drop, sentences, interface copy (buttons, labels, errors, empty states, confirmations), page copy, notifications and emails, alt text and link text, numbers and dates, words that translate well, documentation and voice. Read before writing a page's copy, an interface's text or a document.
ui-themes
Light and dark themes, and colour that holds in both: tokens with a value per theme, and what each kind of content needs to stay visible (icons, SVG drawings and line art, logos, photos, screenshots, charts, code, maps, borders, shadows, focus, form controls), switching without a flash, and checking both. Read before building a second theme or a theme toggle, and before any drawing, logo or chart on a page that has two themes.
ui-structure
Structure before styling: the blueprint written before any interface code (the screen's job, the regions its kind of page needs, their order and why, the layout skeleton in numbers, the components and their states), the anatomy and order of a homepage, a dashboard, a list, a detail page, settings, a form, sign-in, pricing, docs, an article and a checkout, and how to turn the blueprint into code (tokens, layout primitives, components, sections, page). Read first, before building or rebuilding any page or screen.
ui-stack-vue
Building interfaces in Vue 3 and Nuxt: project layout, script setup with typed defineProps, defineEmits and defineModel, attribute fallthrough, slots and scoped slots, template refs, ref, reactive and computed, watch versus watchEffect, composables and VueUse, provide and inject, Pinia, keyed v-for, transitions, Nuxt 4 (app directory, pages, layouts, useFetch and useAsyncData keys, $fetch in handlers, server routes, runtime config, useSeoMeta, NuxtImg, middleware), VeeValidate forms, Reka UI and Nuxt UI, testing, vue-tsc, and the traps. Read when the project uses Vue or Nuxt.
ui-stack-tailwind
Building with Tailwind CSS v4 (and v3) without the Tailwind-default look: setup per framework (Vite, Next.js, Astro, Laravel, monorepos), @theme tokens in OKLCH named by role, dark mode with @custom-variant, the layout system as tokens (one container, section spacing, a type scale, stretched rows) and how to fix each preview layout line with classes, state, aria, data, group, peer, has, motion and container-query variants, component recipes (button, field, card, navigation, table, dialog) with every state, motion with --animate-* and starting:, cn with tailwind-merge, cva, class order, @utility, arbitrary values, typography, v3 to v4 migration, and the generated look. Read when the project uses Tailwind.