AgentSkillsCN

design-engineering

设计工程原则与模式,用于打造精致、易用的 Web 界面。当您构建 UI 组件、审查前端代码、实现表单、处理触控交互、优化性能,或创建营销页面时,可使用此技能。触发条件包括:设计工程、UI 美化、输入字段、表单验证、按钮状态、触控设备、移动端用户体验、无障碍访问、a11y、键盘导航、ARIA 标签、字体渲染、排版、布局偏移、Z 轴堆叠顺序、动画、过渡效果、缓动函数、悬停效果、点击目标、iOS Safari、偏好减少运动、营销页面、着陆页、深色模式、主题切换、滚动条、渐变、阴影、虚拟化、预加载等场景。

SKILL.md
--- frontmatter
name: design-engineering
description: Design engineering principles and patterns for building polished, accessible web interfaces. Use this skill when building UI components, reviewing frontend code, implementing forms, handling touch interactions, optimizing performance, or creating marketing pages. Triggers on: design engineering, UI polish, input fields, form validation, button states, touch devices, mobile UX, accessibility, a11y, keyboard navigation, aria labels, font rendering, typography, layout shift, z-index, animations, transitions, easing, hover effects, tap targets, iOS Safari, prefers-reduced-motion, marketing pages, landing pages, dark mode, theme switching, scrollbars, gradients, shadows, virtualization, preloading.

Design Engineering Principles

A comprehensive guide for building polished, accessible web interfaces based on Emil Kowalski's design engineering practices and ibelick's ui-skills.

Quick Reference

CategoryWhen to Use
Stack ConstraintsTooling, libraries, Tailwind conventions
AnimationsEnter/exit transitions, easing, springs, performance
UI PolishTypography, visual design, layout, colors
Forms & ControlsInputs, buttons, form submission
Touch & AccessibilityMobile, touch devices, keyboard nav, a11y
Component DesignCompound components, composition, props API
MarketingLanding pages, blogs, docs sites
PerformanceVirtualization, preloading, optimization

Core Principles

1. No Layout Shift

Dynamic elements should cause no layout shift. Use hardcoded dimensions, font-variant-numeric: tabular-nums for changing numbers, and avoid font weight changes on hover/selected states.

2. Touch-First, Hover-Enhanced

Design for touch first, then add hover enhancements. Disable hover effects on touch devices. Ensure 44px minimum tap targets. Never rely on hover for core functionality.

3. Keyboard Navigation

Tabbing should work consistently. Only allow tabbing through visible elements. Ensure keyboard navigation scrolls elements into view with scrollIntoView().

4. Accessibility by Default

Every animation needs prefers-reduced-motion support. Every icon button needs an aria label. Every interactive element needs proper focus states.

5. Speed Over Delight

Product UI should be fast and purposeful. Skip animations for frequently-used interactions. Marketing pages can be more elaborate.

Decision Flowcharts

Should I Animate This?

code
Will users see this 100+ times daily?
├── Yes → Don't animate
└── No
    ├── Is this user-initiated?
    │   └── Yes → Animate with ease-out (150-250ms)
    └── Is this a page transition?
        └── Yes → Animate (300-400ms max)

What Easing Should I Use?

code
Is the element entering or exiting?
├── Yes → ease-out
└── No
    ├── Is it moving on screen?
    │   └── Yes → ease-in-out
    └── Is it a hover/color change?
        ├── Yes → ease
        └── Default → ease-out

Common Mistakes

MistakeFix
transition: allSpecify exact properties
Hover effects on touchUse @media (hover: hover)
Font weight change on hoverUse consistent weights
Animating height/widthUse transform and opacity only
No reduced motion supportAdd prefers-reduced-motion query
z-index: 9999Use fixed scale or isolation: isolate
Custom page scrollbarsOnly customize scrollbars in small elements

Review Checklist

When reviewing UI code, check:

  • No layout shift on dynamic content
  • Animations have reduced motion support
  • Touch targets are 44px minimum
  • Hover effects disabled on touch devices
  • Keyboard navigation works properly
  • Icon buttons have aria labels
  • Forms submit with Enter/Cmd+Enter
  • Inputs are 16px+ to prevent iOS zoom
  • No transition: all
  • z-index uses fixed scale

Reference Files

For detailed guidance on specific topics: