Frontend Ui Engineering logo

Frontend Ui Engineering

Community
vinvcn
frontend-ui-engineering

构建生产级、可访问、响应式的面向用户 UI。当构建或修改界面和页面、创建组件、实现布局、满足 WCAG 可访问性要求、管理状态,或输出需要看起来和感觉上都是生产级而不是 AI 生成时使用。

Overview

Publishervinvcn
Repositoryaddyosmani-agent-skills-zh
Skill namefrontend-ui-engineering
Stars
48
Forks
10
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by vinvcn on GitHub. Read the source before you install it.

Installation

Install the Frontend Ui Engineering AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/vinvcn/addyosmani-agent-skills-zh/tree/main/skills/frontend-ui-engineering
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vinvcn/addyosmani-agent-skills-zh.git /tmp/addyosmani-agent-skills-zh
mkdir -p .claude/skills
cp -r /tmp/addyosmani-agent-skills-zh/skills/frontend-ui-engineering .claude/skills/frontend-ui-engineering
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Frontend Ui Engineering in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Frontend Ui Engineering on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Frontend Ui Engineering is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

前端 UI 工程

概述

构建可访问、高性能、视觉打磨到位的生产级用户界面。目标是让 UI 看起来像由顶级公司里有设计意识的工程师构建的,而不是 AI 生成的。这意味着真正遵循设计系统、正确的可访问性、周到的交互模式,以及没有那种泛泛的 "AI aesthetic"。

何时使用

  • 构建新的 UI 组件或页面
  • 修改现有面向用户的界面
  • 实现响应式布局
  • 添加交互或状态管理
  • 修复视觉或 UX 问题

组件架构

文件结构

把所有与组件相关的东西放在一起(colocate):

src/components/
  TaskList/
    TaskList.tsx          # Component implementation
    TaskList.test.tsx     # Tests
    TaskList.stories.tsx  # Storybook stories (if using)
    use-task-list.ts      # Custom hook (if complex state)
    types.ts              # Component-specific types (if needed)

组件模式

优先组合而非配置:

tsx
// Good: Composable
<Card>
  <CardHeader>
    <CardTitle>Tasks</CardTitle>
  </CardHeader>
  <CardBody>
    <TaskList tasks={tasks} />
  </CardBody>
</Card>

// Avoid: Over-configured
<Card
  title="Tasks"
  headerVariant="large"
  bodyPadding="md"
  content={<TaskList tasks={tasks} />}
/>

保持组件职责聚焦:

tsx
// Good: Does one thing
export function TaskItem({ task, onToggle, onDelete }: TaskItemProps) {
  return (
    <li className="flex items-center gap-3 p-3">
      <Checkbox checked={task.done} onChange={() => onToggle(task.id)} />
      <span className={task.done ? 'line-through text-muted' : ''}>{task.title}</span>
      <Button variant="ghost" size="sm" onClick={() => onDelete(task.id)}>
        <TrashIcon />
      </Button>
    </li>
  );
}

数据获取与展示分离:

tsx
// Container: handles data
export function TaskListContainer() {
  const { tasks, isLoading, error, refetch } = useTasks();

  if (isLoading) return <TaskListSkeleton />;
  if (error) return <ErrorState message="Failed to load tasks" retry={refetch} />;
  if (tasks.length === 0) return <EmptyState message="No tasks yet" />;

  return <TaskList tasks={tasks} />;
}

// Presentation: handles rendering
export function TaskList({ tasks }: { tasks: Task[] }) {
  return (
    <ul role="list" className="divide-y">
      {tasks.map(task => <TaskItem key={task.id} task={task} />)}
    </ul>
  );
}

状态管理

选择能工作的最简单方案:

Local state (useState)           → Component-specific UI state
Lifted state                     → Shared between 2-3 sibling components
Context                          → Theme, auth, locale (read-heavy, write-rare)
URL state (searchParams)         → Filters, pagination, shareable UI state
Server state (React Query, SWR)  → Remote data with caching
Global store (Zustand, Redux)    → Complex client state shared app-wide

不要让 props 穿透超过 3 层。 如果你在不使用这些 props 的组件之间层层传递,就引入 context 或重构组件树。

遵循设计系统

参考驱动的 UI 质量

当产品需要一种独特的视觉方向时,先收集证据,再选定布局:

  1. 搜索一份可信的参考目录,或使用产品团队提供的参考。
  2. 研究两到三个相关界面。记录关于层级、密度、导航、控件、响应式行为和交互状态的决策。
  3. 在实现之前,把这些决策浓缩成一份简短的设计契约。写下这个界面的职责、主操作、必需状态、响应式规则,以及要拒绝的模式。
  4. 用产品自己的组件、token、内容和视觉语言,重建其中有用的结构。绝不照搬其他产品的品牌、专有文案、图像或精确布局。

把参考当作证据,而不是模板。如果拿不到参考,把你的假设记录下来,并对照产品既有的设计系统验证结果。

避开 AI 审美

AI 生成的 UI 有可辨识的套路。把它们全部避开:

AI 默认做法为什么是问题生产级水准
满屏紫色/靛蓝模型默认选用视觉上"安全"的配色,让每个 app 看起来都一样使用项目实际的调色板
滥用渐变渐变增加视觉噪音,且与多数设计系统冲突与设计系统匹配的扁平或克制的渐变
万物圆角(rounded-2xl)最大圆角传达"友好",但无视了真实设计中圆角半径的层级遵循设计系统中一致的 border-radius
千篇一律的 hero 区块模板驱动的布局,与实际内容和用户需求毫无关联内容优先的布局
Lorem ipsum 式文案占位文本掩盖了真实内容才会暴露的布局问题(长度、换行、溢出)贴近真实的占位内容
到处都是过大的 padding均等的宽松 padding 会摧毁视觉层级并浪费屏幕空间一致的间距刻度
库存式的卡片网格均质网格是布局上的捷径,无视信息优先级和扫描模式目标驱动的布局
重阴影设计层层阴影增加的深度会与内容争抢注意力,并拖慢低端设备渲染除非设计系统明确规定,否则用克制或无阴影

间距与布局

使用一致的间距刻度,不要凭空发明数值:

css
/* Use the scale: 0.25rem increments (or whatever the project uses) */
/* Good */  padding: 1rem;      /* 16px */
/* Good */  gap: 0.75rem;       /* 12px */
/* Bad */   padding: 13px;      /* Not on any scale */
/* Bad */   margin-top: 2.3rem; /* Not on any scale */

排版

尊重标题层级:

h1 → Page title (one per page)
h2 → Section title
h3 → Subsection title
body → Default text
small → Secondary/helper text

不要跳过标题层级。不要给非标题内容使用标题样式。

颜色

  • 使用语义化颜色 token:text-primary、bg-surface、border-default,而不是原始 hex 值
  • 确保足够对比度(正文 4.5:1,大字号文本 3:1)
  • 不要只靠颜色传达信息(同时使用图标、文本或图案)

可访问性(WCAG 2.1 AA)

每个组件都必须达到这些标准:

键盘导航

tsx
// Every interactive element must be keyboard accessible
<button onClick={handleClick}>Click me</button>        // ✓ Focusable by default
<div onClick={handleClick}>Click me</div>               // ✗ Not focusable
<div role="button" tabIndex={0} onClick={handleClick}    // ✓ But prefer <button>
     onKeyDown={e => {
       if (e.key === 'Enter') handleClick();
       if (e.key === ' ') e.preventDefault();
     }}
     onKeyUp={e => {
       if (e.key === ' ') handleClick();
     }}>
  Click me
</div>

ARIA 标签

tsx
// Label interactive elements that lack visible text
<button aria-label="Close dialog"><XIcon /></button>

// Label form inputs
<label htmlFor="email">Email</label>
<input id="email" type="email" />

// Or use aria-label when no visible label exists
<input aria-label="Search tasks" type="search" />

焦点管理

tsx
// Move focus when content changes
function Dialog({ isOpen, onClose }: DialogProps) {
  const closeRef = useRef<HTMLButtonElement>(null);

  useEffect(() => {
    if (isOpen) closeRef.current?.focus();
  }, [isOpen]);

  // Trap focus inside dialog when open
  return (
    <dialog open={isOpen}>
      <button ref={closeRef} onClick={onClose}>Close</button>
      {/* dialog content */}
    </dialog>
  );
}

有意义的空状态和错误状态

tsx
// Don't show blank screens
function TaskList({ tasks }: { tasks: Task[] }) {
  if (tasks.length === 0) {
    return (
      <div role="status" className="text-center py-12">
        <TasksEmptyIcon className="mx-auto h-12 w-12 text-muted" />
        <h3 className="mt-2 text-sm font-medium">No tasks</h3>
        <p className="mt-1 text-sm text-muted">Get started by creating a new task.</p>
        <Button className="mt-4" onClick={onCreateTask}>Create Task</Button>
      </div>
    );
  }

  return <ul role="list">...</ul>;
}

响应式设计

移动优先设计,再向大屏扩展:

tsx
// Tailwind: mobile-first responsive
<div className="
  grid grid-cols-1      /* Mobile: single column */
  sm:grid-cols-2        /* Small: 2 columns */
  lg:grid-cols-3        /* Large: 3 columns */
  gap-4
">

在这些断点测试:320px、768px、1024px、1440px。

加载与过渡

tsx
// Skeleton loading (not spinners for content)
function TaskListSkeleton() {
  return (
    <div className="space-y-3" aria-busy="true" aria-label="Loading tasks">
      {Array.from({ length: 3 }).map((_, i) => (
        <div key={i} className="h-12 bg-muted animate-pulse rounded" />
      ))}
    </div>
  );
}

// Optimistic updates for perceived speed
function useToggleTask() {
  const queryClient = useQueryClient();

  return useMutation({
    mutationFn: toggleTask,
    onMutate: async (taskId) => {
      await queryClient.cancelQueries({ queryKey: ['tasks'] });
      const previous = queryClient.getQueryData(['tasks']);

      queryClient.setQueryData(['tasks'], (old: Task[]) =>
        old.map(t => t.id === taskId ? { ...t, done: !t.done } : t)
      );

      return { previous };
    },
    onError: (_err, _taskId, context) => {
      queryClient.setQueryData(['tasks'], context?.previous);
    },
  });
}

另见

详细的可访问性要求和测试工具见 ../../references/accessibility-checklist.md。

常见合理化借口

借口现实
"可访问性是锦上添花"在许多司法辖区它是法律要求,也是工程质量标准。
"我们以后再做成响应式的"事后补响应式设计的难度是从一开始就做好的 3 倍。
"设计还没定稿,先跳过样式"使用设计系统的默认值。无样式的 UI 会给审阅者留下破碎的第一印象。
"这只是个原型"原型会变成生产代码。把地基打对。
"AI 审美暂时没问题"它传递的是低质量信号。从一开始就使用项目真正的设计系统。

危险信号

  • 超过 200 行的组件(拆分它们)
  • 内联样式或任意的像素值
  • 缺少错误状态、加载状态或空状态
  • 没有做键盘导航测试
  • 把颜色作为状态的唯一指示(红/绿,没有文本或图标)
  • 泛泛的 "AI look"(紫色渐变、过大的卡片、库存式布局)

验证

构建完 UI 后:

  • 组件渲染时 console 无报错
  • 所有可交互元素都支持键盘访问(用 Tab 键遍历页面)
  • 屏幕阅读器能传达页面的内容和结构
  • 响应式:在 320px、768px、1024px、1440px 均正常
  • 加载、空状态、错误、成功和权限状态在适用时全部处理
  • 遵循项目的设计系统(间距、颜色、排版)
  • 最终渲染结果通过一次 UI 专属的收尾审查(finish-gate review)
  • dev tools 或 axe-core 中没有可访问性告警

Frequently asked questions

What does the Frontend Ui Engineering AI skill do?

构建生产级、可访问、响应式的面向用户 UI。当构建或修改界面和页面、创建组件、实现布局、满足 WCAG 可访问性要求、管理状态,或输出需要看起来和感觉上都是生产级而不是 AI 生成时使用。

Why use Frontend Ui Engineering on TypingMind?

Because you install it once and use it with any model. Frontend Ui Engineering is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Frontend Ui Engineering in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/vinvcn/addyosmani-agent-skills-zh/tree/main/skills/frontend-ui-engineering. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Frontend Ui Engineering?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Frontend Ui Engineering?

As many as you like. As long as a model supports skills, you can use Frontend Ui Engineering with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Frontend Ui Engineering AI skill free?

Yes. It is published on GitHub by vinvcn under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇