dev-ui
UI development approach — component architecture, state management, accessibility, and user experience patterns.
- License 许可
- MIT
- 最近更新
- 2026-11-11
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- dev-ui
- description
- UI development approach — component architecture, state management, accessibility, and user experience patterns.
02 资源文件 2
- 参考文档evals/eval_queries.json891 B
- 参考文档evals/evals.json4.3 KB
03 SKILL.md 正文
UI Development
You apply these principles when building user interfaces, regardless of framework.
Component Architecture
Structure
- Components should do one thing well — if a component has multiple responsibilities, split it
- Separate presentation from logic: keep rendering pure and predictable, push side effects and data fetching to the edges
- Name components by what they are, not what they do:
UserProfilenotRenderUserData - Prefer composition over configuration — small composable components beat large ones with many props/flags
Props and data flow
- Data flows down, events flow up — parent passes data to children, children notify parent via callbacks or events
- Keep the prop surface small — a component that takes 15 props probably needs to be split
- Use sensible defaults for optional props — the component should be useful with minimal configuration
- Don't pass data through intermediate components that don't use it (prop drilling) — use context, state management, or composition instead
Component hierarchy
Page / Route
└── Layout (header, sidebar, content area)
└── Feature Container (data fetching, state)
└── Presentation Components (rendering, styling)
└── Shared UI Primitives (button, input, card)
- Pages own routing and data loading
- Containers handle state and side effects
- Presentation components are pure: same props = same output
- Primitives are the design system — reusable across features
State Management
Where state lives
- Local component state: UI state that only this component cares about (open/closed, hover, form field values before submit)
- Shared state: Data multiple components need (current user, theme, feature flags) — lift to nearest common ancestor or use a state store
- Server state: Data from APIs — use purpose-built tools (React Query, SWR, Apollo) that handle caching, revalidation, and loading states
- URL state: Filters, pagination, search terms — put in the URL so it's shareable and survives refresh
Principles
- Derive what you can — don't store
fullNameif you havefirstNameandlastName - Single source of truth — each piece of state lives in exactly one place
- Keep state as close to where it's used as possible — don't hoist prematurely
- Treat server data as a cache, not as state you own — it can change out from under you
Forms
- Validate on blur (field level) and on submit (form level)
- Show errors inline next to the relevant field, not in a banner at the top
- Preserve user input on validation failure — never clear a form the user just filled in
- Disable submit button while submitting, show a loading indicator
- Handle the full lifecycle: idle, validating, submitting, success, error
- For complex forms, use a form library — don't hand-roll state tracking for 20 fields
Loading and Error States
Every async operation has three states
- Loading — show a skeleton, spinner, or placeholder. Never show a blank screen.
- Success — render the data
- Error — show what went wrong and what the user can do about it
Patterns
- Use skeleton screens instead of spinners where possible — they feel faster
- Show stale data while revalidating in the background (stale-while-revalidate)
- For errors: show a message, a retry button, and (if applicable) a way to report the issue
- Empty states are not errors — design for them: "No results found. Try adjusting your search."
Accessibility
Fundamentals
- Use semantic HTML elements:
<button>not<div onClick>,<nav>not<div class="nav"> - All images need
alttext — decorative images getalt="" - All form inputs need associated
<label>elements - Ensure sufficient colour contrast (WCAG AA: 4.5:1 for normal text, 3:1 for large text)
- Don't rely on colour alone to convey meaning — add icons, text, or patterns
Keyboard navigation
- All interactive elements must be reachable via Tab
- Custom widgets need appropriate ARIA roles, states, and keyboard handlers
- Focus management: when a modal opens, focus moves to it; when it closes, focus returns to the trigger
- Visible focus indicators — never remove the outline without providing an alternative
Screen readers
- Use heading hierarchy:
h1→h2→h3, don't skip levels - Use
aria-liveregions for dynamic content updates (notifications, form errors) - Hide decorative elements from screen readers with
aria-hidden="true" - Test with a screen reader — VoiceOver on macOS, NVDA on Windows
Performance
Rendering
- Don't render what's off-screen — use virtualisation for long lists
- Memoize expensive computations and components that receive the same props
- Debounce rapid user input (search-as-you-type, window resize)
- Avoid layout thrashing — batch DOM reads and writes
Assets
- Lazy-load images and heavy components below the fold
- Optimise images: use modern formats (WebP, AVIF), serve appropriate sizes
- Code-split by route — don't ship the entire app in one bundle
- Set appropriate cache headers for static assets
Responsive Design
- Design mobile-first, then enhance for larger screens
- Use relative units (rem, %, vh/vw) over fixed pixels for layout
- Test at real breakpoints, not just "desktop and mobile" — tablets and small laptops matter
- Touch targets need minimum 44x44px for comfortable tapping
- Consider content priority: what matters most on a small screen? Show that first.
04 同仓库更多 Skills
doctor
暂无简介
add-seat
Add a named seat to a Wheelhouse - a crew member, a standing role (such as a dispatcher) or a worker - as a ynh harness with its charter, standing orders and only the tools its job needs, named from the Wheelhouse's roster. Use when asked to add, create or set up a seat, role, worker or agent in a Wheelhouse (a release manager, a PR watcher, a dispatcher, a designer, more workers), or to give a role a name, or to start on a Wheelhouse's team (its starter team), one role at a time. Also use to trial, make official or drop a seat.
voice
How voices work - what a voice skill contains, how to write a new one, and how several voices compose into one reply. Use whenever drafting a reply in a named voice, or when asked to create or change a voice.
voice-warm
A friendly voice that acknowledges the person and their effort. Compose with direct for friendly but brief.
voice-formal
A careful, complete voice for people outside the team - customers, partners, senior stakeholders.
voice-direct
A plain, brief voice that leads with the answer. The default when no voice is named.