frontend-design
React-oriented UI/UX design principles for frontend development. Covers React patterns, component architecture, hooks, layout, typography, color, accessibility, and responsive design. Use when building React UI, reviewing frontend code, designing components, or making visual/interaction decisions. Assumes React with a meta-framework (TanStack Start, Next.js, Remix, etc.).
- License 许可
- MIT
- 所属仓库
- roerohan/skills
- 最近更新
- 2026-09-04
- Stars
- ★ 29
- Forks
- 1
01 前言 Front Matter
- name
- frontend-design
- description
- React-oriented UI/UX design principles for frontend development. Covers React patterns, component architecture, hooks, layout, typography, color, accessibility, and responsive design. Use when building React UI, reviewing frontend code, designing components, or making visual/interaction decisions. Assumes React with a meta-framework (TanStack Start, Next.js, Remix, etc.).
02 资源文件 7
- 参考文档references/accessibility.md6.9 KB
- 参考文档references/color.md4.5 KB
- 参考文档references/components.md7.3 KB
- 参考文档references/layout.md5.3 KB
- 参考文档references/react.md6.5 KB
- 参考文档references/responsive.md5.2 KB
- 参考文档references/typography.md3.7 KB
03 SKILL.md 正文
Frontend Design
UI/UX principles for building well-designed, accessible, maintainable React interfaces.
Context: This skill assumes React as the UI layer, typically with a meta-framework (TanStack Start, Next.js, Remix, etc.) and a styling approach (Tailwind, CSS Modules, etc.). Raw HTML/CSS guidance is provided only where it underpins React patterns.
Core Principles
- Clarity over cleverness — Users should understand the interface immediately
- Consistency over novelty — Reuse established patterns; deviate only with reason
- Accessibility is not optional — Design for all users from the start
- Content drives layout — Structure follows information hierarchy, not decoration
- Composition over configuration — Prefer
childrenand compound components over prop sprawl - Server-first data, client-first interaction — Load data on the server; keep interactivity on the client
Decision Tree
What are you working on?
├─ React component design / hooks / state → See react.md
├─ Reusable UI component patterns → See components.md
├─ Page layout / spacing → See layout.md
├─ Text styling / hierarchy → See typography.md
├─ Colors / theming / contrast → See color.md
├─ Keyboard / screen reader / a11y → See accessibility.md
├─ Multi-device / breakpoints → See responsive.md
└─ Multiple concerns → Start with react.md, layer in others
Quick Reference
Visual Hierarchy Checklist
| Level | Purpose | Techniques |
|---|---|---|
| Primary | Single main action/content | Size, weight, color, position |
| Secondary | Supporting actions/content | Reduced size/weight, muted color |
| Tertiary | Contextual/metadata | Smallest size, lightest weight |
Spacing System
Use a consistent base unit (4px or 8px). Apply multiples:
| Token | Value (8px base) | Use |
|---|---|---|
xs |
4px | Inline elements, icon gaps |
sm |
8px | Tight grouping |
md |
16px | Default element spacing |
lg |
24px | Section padding |
xl |
32px | Major section separation |
2xl |
48px | Page-level separation |
The 60-30-10 Rule
| Proportion | Role | Example |
|---|---|---|
| 60% | Dominant / background | Page background, card surfaces |
| 30% | Secondary / supporting | Section backgrounds, borders |
| 10% | Accent / emphasis | CTAs, active states, highlights |
Design Review Checklist
When reviewing frontend code or designs:
- [ ] Hierarchy: Is the most important content/action visually dominant?
- [ ] Consistency: Do similar elements look and behave the same?
- [ ] Spacing: Is spacing systematic (not arbitrary pixel values)?
- [ ] Color contrast: Do text/background combos meet WCAG AA (4.5:1)?
- [ ] Interactive states: Do clickable elements have hover, focus, active, disabled states?
- [ ] Responsive: Does the layout work at mobile, tablet, and desktop widths?
- [ ] Keyboard: Can all interactive elements be reached and operated via keyboard?
- [ ] Loading states: Are empty/loading/error states designed, not just happy path?
- [ ] Touch targets: Are tap targets at least 44x44px on mobile?
- [ ] Content overflow: Does the layout handle long text, missing images, edge cases?
Common Anti-Patterns
| Anti-Pattern | Problem | Fix |
|---|---|---|
| Magic numbers | margin: 13px breaks system |
Use spacing tokens |
| Color hardcoding | #3b82f6 everywhere |
Use semantic color tokens |
| Hover-only affordance | Hidden from keyboard/touch users | Always show affordance; enhance on hover |
| Fixed dimensions | Breaks on different content/screens | Use min/max + fluid sizing |
| Z-index wars | Escalating z-index: 9999 |
Use a layering system (base, dropdown, modal, toast) |
| Truncation without access | text-overflow: ellipsis hides content |
Add tooltip or expand mechanism |
Interaction Principles
- Feedback is immediate — Every user action gets a visible response within 100ms
- State is visible — Users can always tell what state the system is in
- Actions are reversible — Destructive actions require confirmation; prefer undo over "are you sure?"
- Errors are recoverable — Show what went wrong and how to fix it
- Transitions are meaningful — Animation communicates change, not decoration
React Review Checklist (Addendum)
On top of the design review checklist above, verify for React code:
- [ ] Component boundaries: Is each component focused on one concern?
- [ ] Props: Are props minimal and well-typed? No boolean prop sprawl?
- [ ] Composition: Using
children/render props instead of mega-config objects? - [ ] Effects: Are effects necessary, or can derived state / event handlers replace them?
- [ ] Keys: Are list keys stable and meaningful (not array index)?
- [ ] Memoization: Is
useMemo/useCallbackused only where measured necessary? - [ ] Server vs client: Is data fetching on the server? Is client JS minimal?
- [ ] Error boundaries: Do async/fallible sections have error boundaries?
- [ ] Suspense: Are loading states handled with Suspense where appropriate?
Reading Order
| Task | Files to Read |
|---|---|
| React component architecture | react.md |
| Building a page layout | layout.md |
| Designing a reusable UI component | react.md + components.md |
| Styling text content | typography.md |
| Choosing / applying colors | color.md |
| Making UI accessible | accessibility.md |
| Supporting multiple screen sizes | responsive.md |
| Full design review | This file + all references |
In This Reference
| File | Purpose |
|---|---|
| react.md | React patterns, hooks, composition, state, meta-frameworks |
| components.md | Common UI component design patterns |
| layout.md | Spatial organization, grid, flexbox, spacing |
| typography.md | Type scale, font selection, readability |
| color.md | Color systems, contrast, theming, dark mode |
| accessibility.md | WCAG compliance, keyboard, screen readers |
| responsive.md | Breakpoints, mobile-first, fluid design |
04 同仓库更多 Skills
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.
using-git-worktrees
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
unslop
Cut AI tells from any writing. Must always apply.
tmux
Manage long-running commands in the user's current tmux session. Use when starting dev servers, watchers, background logs, or reading/interacting with named tmux panes.
timesharing
Multiplexes one agent's attention across independent long-running external processes while preserving one reasoning context. Use for concurrent tests, builds, servers, watchers, REPLs, benchmarks, downloads, and other latency-bearing shell work; never use it to spawn or substitute subagents.
teach
Teach the user a new skill or concept, within this workspace.