developing-ui
Strict guidelines for building UI components, pages, and layouts. Ensures adherence to brand-identity tokens, technical constraints, and performance standards.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
UI Development & Front-end Engineering
This skill defines the standard operating procedure for front-end development. It ensures all UI code is consistent, performant, accessible, and robust, while strictly adhering to the brand-identity skill.
When to use this skill
- Creating new UI components (Framework agnostic: React, Vue, Svelte, etc.)
- Styling new or existing pages
- Debugging layout, visual, or performance issues
- Refactoring CSS or component logic
Workflow
When building a new UI element, follow this process:
-
Analyze & Plan
- Check
brand-identity/resources/design-tokens.jsonfor available tokens. - Define all component states: Idle, Loading, Error, Empty, Success.
- Check
-
Scaffold
- Create the file structure.
- Define the component interface (Props) with strict typing.
-
Style
- Apply layout (Flex/Grid) first.
- Apply spacing/sizing using design tokens.
- Optimization: Use CSS variables for theming and avoid heavy animations on non-composite properties (stick to transform/opacity).
-
Interact & Logic
- Add state and event handlers.
- Implement accessible focus management.
- Ensure error handling is graceful (e.g., Error Boundaries or fallback UI).
-
Verify & Test
- Check responsiveness (Mobile -> Desktop).
- Check accessibility (ARIA, keyboard navigation, screen reader).
- Performance: Check for unnecessary re-renders or layout shifts (CLS).
- Run the Component Checklist (see Resources).
Instructions
1. Brand Alignment
You MUST use the variables defined in the brand-identity skill.
- ❌
color: #ff0000; - ✅
color: var(--color-error-500);
2. Semantic HTML & Accessibility
- Use semantic tags (
<button>,<nav>,<article>) over<div>. - Ensure strict ARIA compliance for interactive elements.
- All images must have
alttext orrole="presentation". - Touch targets must be at least 44x44px.
3. State Management (The "5 States" Rule)
Don't just build the "happy path." You must account for:
- Loading: Skeletons or spinners.
- Error: User-friendly error messages/retries.
- Empty: What happens when there is no data?
- Success: Feedback for successful actions.
- Idle: The default state.
4. Performance & Optimization
-
Images: Use optimized formats (WebP/AVIF) and
loading="lazy"where appropriate. -
Animations: Aim for 60fps. Animate only
transformandopacity. Usewill-changesparingly. - Code: Avoid massive bundles. Lazy load heavy components or routes.
5. Testing Requirements
- Unit Tests: Logic and state changes must be tested (e.g., Jest/Vitest).
- Integration: Critical user flows must be verified.
- Cross-Browser: Verify functionality on Chrome, Firefox, Safari (latest 2 versions).
Resources
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-26
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!