antfu-design
antfu/skills
使用 UnoCSS 构建界面,利用语义化令牌、深色模式一致性及设计细节优化,打造开发者工具和落地页。
...展开全部在任意框架(React、Vue、Svelte、Solid 或纯 HTML)中使用 UnoCSS 构建界面时,请使用此内容,无论是密集的开发工具面板还是落地页。请先阅读 core-design-read 以确立方向,然后应用令牌系统以及打磨和防冗余规则。
核心规则
- 在标记中使用语义化快捷方式(
bg-base、border-base、color-active、btn-action),而非原始的工具链。 - 同时设计浅色和深色模式。核心令牌必须在两种主题中均能正常工作。
- 为 z-index 层级命名(
z-top-nav、z-panel-content、z-drawer-content)。不要在模板中使用原始的 z 值。 - 仅生成基于类的工具(
class="..."")。避免在生成的代码中使用 Attributify 语法。 - 保持图标/状态类字符串的字面量形式,以便 UnoCSS 能够静态提取它们(必要时使用
// @unocss-include)。 - 对于技术值(路径、SHA 哈希值、计数器、时间戳、百分比),使用
font-mono+tabular-nums。 - 对于长路径和 ID,视觉上截断但保留完整值于
title属性中。 - 阅读简报并在选择外观前设置三个旋钮(core-design-read)。
- 密集或结构性表面使用边框,提升层级的表面使用分层阴影(features-micro-interactions)。
- 任何面向用户的文本中不得包含任何 em-dash 和 en-dash 字符(best-practices-anti-slop)。
起始快捷方式
最小的语义核心。参见 core-starter-kit 以获取完整的 uno.config.ts 和基础样式。
shortcuts: [
{
'color-base': 'color-neutral-800 dark:color-neutral-200',
'bg-base': 'bg-white dark:bg-#111',
'bg-secondary': 'bg-#eee dark:bg-#222',
'border-base': 'border-#8882',
'bg-active': 'bg-#8881',
'color-active': 'color-primary-600 dark:color-primary-300',
'border-active': 'border-primary-600/25 dark:border-primary-400/25',
'btn-action': 'inline-flex items-center gap-2 rounded border border-base px2 py1 op75 hover:op100 hover:bg-active disabled:pointer-events-none disabled:op30!',
'op-fade': 'op65 dark:op55',
'op-mute': 'op30 dark:op25',
'z-top-nav': 'z-60',
'z-panel-content': 'z-70',
'z-drawer-content': 'z-100',
},
]
核心参考
| 主题 | 描述 | 参考 |
|---|---|---|
| 核心原则 | 语义令牌、深色模式对等、z-index 命名、基于类的输出 | core-principles |
| 起始套件 | 复制粘贴 UnoCSS 起始配置及基础浅色/深色样式 | core-starter-kit |
| 令牌与组合 | 令牌家族、可复用的类组合、移动端安全的壳层令牌 | core-tokens-and-combinations |
| 设计阅读与旋钮 | 阅读简报,声明设计阅读,设置方差/运动/密度旋钮 | core-design-read |
最佳实践
| 主题 | 描述 | 参考 |
|---|---|---|
| 严格规则与预检 | 做/不做清单及整合后的预检 | best-practices-strict-rules |
| 基于类优于 Attributify | 为何生成的代码使用基于类的工具,以及转换方法 | best-practices-class-utilities-over-attributify |
| 防冗余卫生规范 | 破折号禁令及 AI 痕迹禁止模式 | best-practices-anti-slop |
| 偏差修正 | 排版、颜色、布局和材质感的默认值以覆盖 | best-practices-bias-correction |
功能特性
| 主题 | 描述 | 参考 |
|---|---|---|
| 数据展示 | 路径、图标、时间、日期、数字、徽章、按钮 | features-data-presentation |
| 微交互 | 圆角、对齐、阴影、动画、数字、轮廓、点击区域 | features-micro-interactions |
| Floating Vue 覆盖 | 共享的 Floating Vue 设置及 popper 样式 | features-floating-vue-overrides |
高级功能
| 主题 | 描述 | 参考 |
|---|---|---|
| 模式词汇表 | 用于识别和调用的命名 UI 模式 | advanced-pattern-vocabulary |
| 重设计协议 | 检测模式,先审计,保留信息架构和 SEO | advanced-redesign-protocol |
---
name: antfu-design
description: Build interfaces with UnoCSS using semantic tokens, dark mode parity, and design polish for devtools and landing pages.
---
Use this when building interfaces with UnoCSS in any framework (React, Vue, Svelte, Solid, or plain HTML), from dense devtools panels to landing pages. Read core-design-read first to set the direction, then apply the token system plus the polish and anti-slop rules.
## Core Rules
- Use semantic shortcuts (`bg-base`, `border-base`, `color-active`, `btn-action`) instead of raw utility chains in markup.
- Design light and dark mode together. Core tokens must work in both themes.
- Name z-index layers (`z-top-nav`, `z-panel-content`, `z-drawer-content`). Do not use raw z values in templates.
- Generate class-based utilities only (`class="..."`). Avoid Attributify syntax in generated code.
- Keep icon/status class strings literal so UnoCSS can statically extract them (`// @unocss-include` when needed).
- Use `font-mono` + `tabular-nums` for technical values (paths, SHAs, counters, timestamps, percentages).
- For long paths and IDs, truncate visually but keep the full value in `title`.
- Read the brief and set the three dials before choosing a look (core-design-read).
- Borders for dense or structural surfaces, layered shadows for elevated ones (features-micro-interactions).
- Zero em-dash and en-dash characters in any user-facing text (best-practices-anti-slop).
## Starter shortcuts
A minimal semantic core. See core-starter-kit for the full `uno.config.ts` and base styles.
```ts
shortcuts: [
{
'color-base': 'color-neutral-800 dark:color-neutral-200',
'bg-base': 'bg-white dark:bg-#111',
'bg-secondary': 'bg-#eee dark:bg-#222',
'border-base': 'border-#8882',
'bg-active': 'bg-#8881',
'color-active': 'color-primary-600 dark:color-primary-300',
'border-active': 'border-primary-600/25 dark:border-primary-400/25',
'btn-action': 'inline-flex items-center gap-2 rounded border border-base px2 py1 op75 hover:op100 hover:bg-active disabled:pointer-events-none disabled:op30!',
'op-fade': 'op65 dark:op55',
'op-mute': 'op30 dark:op25',
'z-top-nav': 'z-60',
'z-panel-content': 'z-70',
'z-drawer-content': 'z-100',
},
]
```
## Core References
| Topic | Description | Reference |
|-------|-------------|-----------|
| Core Principles | Semantic tokens, dark mode parity, z-index naming, class-first output | [core-principles](references/core-principles.md) |
| Starter Kit | Copy-paste UnoCSS starter config and base light/dark styles | [core-starter-kit](references/core-starter-kit.md) |
| Tokens and Combos | Token families, reusable class combinations, mobile-safe shell tokens | [core-tokens-and-combinations](references/core-tokens-and-combinations.md) |
| Design Read and Dials | Read the brief, declare a design read, set variance/motion/density dials | [core-design-read](references/core-design-read.md) |
## Best Practices
| Topic | Description | Reference |
|-------|-------------|-----------|
| Strict Rules and Pre-Flight | Do/don't checklist and the consolidated pre-flight | [best-practices-strict-rules](references/best-practices-strict-rules.md) |
| Class over Attributify | Why generated code uses class utilities, with conversions | [best-practices-class-utilities-over-attributify](references/best-practices-class-utilities-over-attributify.md) |
| Anti-Slop Hygiene | The dash ban and the AI-tell forbidden patterns | [best-practices-anti-slop](references/best-practices-anti-slop.md) |
| Bias Correction | Typography, color, layout, and materiality defaults to override | [best-practices-bias-correction](references/best-practices-bias-correction.md) |
## Features
| Topic | Description | Reference |
|-------|-------------|-----------|
| Data Presentation | Paths, icons, time, date, numbers, badges, buttons | [features-data-presentation](references/features-data-presentation.md) |
| Micro-Interactions | Radius, alignment, shadows, animation, numbers, outlines, hit areas | [features-micro-interactions](references/features-micro-interactions.md) |
| Floating Vue Overrides | Shared Floating Vue setup and popper styling | [features-floating-vue-overrides](references/features-floating-vue-overrides.md) |
## Advanced
| Topic | Description | Reference |
|-------|-------------|-----------|
| Pattern Vocabulary | Named UI patterns to recognize and reach for | [advanced-pattern-vocabulary](references/advanced-pattern-vocabulary.md) |
| Redesign Protocol | Detect mode, audit first, preserve IA and SEO | [advanced-redesign-protocol](references/advanced-redesign-protocol.md) |
<!--
Source references:
- https://github.com/antfu/node-modules-inspector
- https://github.com/vitejs/devtools/tree/main/packages/rolldown
- https://github.com/eslint/config-inspector
- https://github.com/antfu/vite-plugin-inspect
- https://github.com/antfu/agent-container
- https://github.com/Leonxlnx/taste-skill
- https://github.com/jakubkrehel/make-interfaces-feel-better
-->
所有文件
0 个文件安装 antfu-design
下载并将技能文件解压至你的 .claude/skills/ 目录。
下载ZIP克隆仓库并复制技能文件到您的项目中。
git clone https://github.com/antfu/skills/tree/main/skills/antfu-design # Copy SKILL.md to your .claude/skills/ directory
复制





首页
