frontend-design-principles

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Frontend Design Principles

前端设计原则

Build frontend interfaces with craft and intention.
以匠心和明确的设计意图打造前端界面。

Scope & Routing

适用范围与指引路由

After reading this file, load additional guidance based on what you're building:
Load
app.md
when building:
  • Dashboards and admin interfaces
  • Settings panels and configuration screens
  • Internal tools and SaaS products
  • Data-heavy interfaces with tables, forms, lists
  • Any interface where users work repeatedly
Load
marketing.md
when building:
  • Landing pages and marketing sites
  • Promotional materials and announcements
  • Creative artifacts and posters
  • Public-facing pages meant to impress
  • Any interface where first impression matters most
If unclear, ask. Some projects blend both — a SaaS marketing site needs
marketing.md
, but its actual product dashboard needs
app.md
.
阅读本文档后,请根据你正在构建的内容加载额外指引:
构建以下内容时请加载
app.md
  • 仪表盘和管理界面
  • 设置面板与配置页面
  • 内部工具和SaaS产品
  • 包含表格、表单、列表的数据密集型界面
  • 用户需要重复操作的任何界面
构建以下内容时请加载
marketing.md
  • 着陆页和营销网站
  • 宣传物料与公告页面
  • 创意作品与海报
  • 用于给用户留下第一印象的公开页面
  • 任何第一印象至关重要的界面
若不确定,请询问用户。有些项目会同时涉及两类内容——例如SaaS营销网站需要
marketing.md
,但其产品仪表盘则需要
app.md

Why This Process Exists

此流程存在的原因

You will generate generic output. Your training has seen thousands of dashboards, landing pages, marketing sites. The patterns are strong.
You can follow the entire process below — explore the domain, name a signature, state your intent — and still produce a template. Warm colors on cold structures. Friendly fonts on generic layouts. "Kitchen feel" that looks like every other app.
This happens because intent lives in prose, but code generation pulls from patterns. The gap between them is where defaults win.
The process below helps. But process alone doesn't guarantee craft. You have to catch yourself.
你可能会生成通用化的输出。你的训练数据包含数千个仪表盘、着陆页和营销网站,其中的设计模式非常固化。
即便你遵循以下完整流程——探索领域、确定标志性元素、明确设计意图——仍可能产出模板化内容:冷硬结构搭配暖色调、通用布局搭配友好字体,那种“千篇一律的亲切感”和其他应用毫无区别。
这种情况的出现是因为设计意图存在于文字描述中,但代码生成却依赖既有模式。两者之间的差距就是默认设计占据主导的地方。
以下流程会有所帮助,但仅靠流程无法保证匠心。你需要时刻自我审视。

Where Defaults Hide

默认设计的隐藏之处

Defaults don't announce themselves. They disguise themselves as infrastructure — the parts that feel like they just need to work, not be designed.
Typography feels like a container. Pick something readable, move on. But typography isn't holding your design — it IS your design. The weight of a headline, the personality of a label, the texture of a paragraph. These shape how the product feels before anyone reads a word. A bakery management tool and a trading terminal might both need "clean, readable type" — but the type that's warm and handmade is not the type that's cold and precise. If you're reaching for your usual font, you're not designing.
Navigation feels like scaffolding. Build the sidebar, add the links, get to the real work. But navigation isn't around your product — it IS your product. Where you are, where you can go, what matters most. A page floating in space is a component demo, not software. The navigation teaches people how to think about the space they're in.
Data feels like presentation. You have numbers, show numbers. But a number on screen is not design. The question is: what does this number mean to the person looking at it? What will they do with it? A progress ring and a stacked label both show "3 of 10" — one tells a story, one fills space. If you're reaching for number-on-label, you're not designing.
Token names feel like implementation detail. But your CSS variables are design decisions.
--ink
and
--parchment
evoke a world.
--gray-700
and
--surface-2
evoke a template. Someone reading only your tokens should be able to guess what product this is.
The trap is thinking some decisions are creative and others are structural. There are no structural decisions. Everything is design. The moment you stop asking "why this?" is the moment defaults take over.
默认设计不会主动显现,它们会伪装成基础设施——那些看起来只需要能运行、不需要设计的部分。
排版看似只是容器。选一个易读的字体就完事了?但排版本身就是你的设计。标题的字重、标签的个性、段落的质感,这些在用户阅读任何文字之前就塑造了产品的质感。面包店管理工具和交易终端可能都需要“清晰易读的字体”,但温暖手工感的字体和冷峻精准感的字体完全不是一回事。如果你直接选用常用字体,那你根本不是在做设计。
导航看似只是脚手架。建好侧边栏、添加链接,就可以去做真正的工作了?但导航本身就是你的产品。它定义了你所在的位置、可前往的方向以及最重要的内容。一个孤立的页面只是组件演示,不是软件。导航教会用户如何理解他们所处的操作空间。
数据看似只是展示。有数字就展示数字?但屏幕上的数字不是设计。关键问题是:这个数字对观看它的人来说意味着什么?他们会用它做什么?进度环和堆叠标签都能显示“10个中的3个”——前者讲述了一个过程,后者只是填充空间。如果你直接选用“数字+标签”的形式,那你根本不是在做设计。
Token名称看似只是实现细节。但你的CSS变量就是设计决策。
--ink
--parchment
能唤起一个特定的场景,而
--gray-700
--surface-2
只会让人联想到模板。仅通过你的token名称,就应该能猜到这是什么产品。
陷阱在于认为有些决策是创意性的,有些是结构性的。不存在结构性决策,一切都是设计。当你不再问“为什么选这个?”的时候,就是默认设计接管的时刻。

Required: Before Generating

生成代码前的必做步骤

Do not write code until you complete these steps.
完成以下步骤前,请勿编写代码。

1. Answer the Intent Questions

1. 回答设计意图问题

Answer these out loud — to yourself or the user. If you cannot answer with specifics, ask the user. Do not guess. Do not default.
  • Who is this human? Not "users." The actual person. Where are they when they open this? What's on their mind? What did they do 5 minutes ago, what will they do 5 minutes after?
  • What must they accomplish? Not "use the dashboard." The verb. Grade these submissions. Find the broken deployment. Approve the payment.
  • What should this feel like? Say it in words that mean something. "Clean and modern" means nothing — every AI says that. Warm like a notebook? Cold like a terminal? Dense like a trading floor? Calm like a reading app?
请大声回答这些问题——可以是自问,也可以询问用户。如果无法给出具体答案,请询问用户,不要猜测,不要使用默认选项。
  • 目标用户是谁? 不是泛指的“用户”,而是具体的人。他们打开这个界面时身处何地?心里在想什么?打开界面的5分钟前他们在做什么?5分钟后又会做什么?
  • 他们必须完成什么任务? 不是“使用仪表盘”这种模糊描述,而是具体的动作。比如:批改提交的内容、找出故障的部署、批准付款。
  • 这个界面应该给人什么感觉? 要用有实际意义的词汇描述。“简洁现代”毫无意义——所有AI都会这么说。是像笔记本一样温暖?像终端一样冷峻?像交易大厅一样紧凑?像阅读应用一样平静?

2. Produce the Four Required Outputs

2. 产出四个必备输出

Do not propose any direction until you produce all four:
  • Domain: Concepts, metaphors, vocabulary from this product's world. Not features — territory. Minimum 5.
  • Color world: What colors exist naturally in this product's domain? Not "warm" or "cool" — go to the actual world. If this product were a physical space, what would you see? List 5+.
  • Signature: One element — visual, structural, or interaction — that could only exist for THIS product. If you can't name one, keep exploring.
  • Defaults to reject: 3 obvious choices for this interface type — visual AND structural. You can't avoid patterns you haven't named.
在提出任何设计方向前,必须先产出以下四个内容:
  • 领域概念: 来自该产品所属领域的概念、隐喻和词汇。不是功能,而是领域范畴。至少5个。
  • 色彩场景: 该产品所属领域中天然存在的颜色。不要用“暖色”或“冷色”这种描述,要回归真实场景。如果这个产品是一个物理空间,你会看到什么颜色?列出5种以上。
  • 标志性元素: 一个视觉、结构或交互层面的元素,它只能属于这个产品。如果想不出来,请继续探索。
  • 需摒弃的默认设计: 3个针对此类界面的常见选择——包括视觉和结构层面的。你无法避开那些你未曾明确指出的模式。

3. Propose Direction and Confirm

3. 提出设计方向并确认

Your proposal must explicitly reference:
  • Domain concepts you explored
  • Colors from your color world exploration
  • Your signature element
  • What replaces each default you're rejecting
The test: Read your proposal. Remove the product name. Could someone identify what this is for? If not, it's generic. Explore deeper.
Format:
Domain: [5+ concepts from the product's world]
Color world: [5+ colors that exist in this domain]
Signature: [one element unique to this product]
Rejecting: [default 1] → [alternative], [default 2] → [alternative], [default 3] → [alternative]

Direction: [approach that connects to the above]

Does that direction feel right?
Wait for confirmation before generating code.
你的提案必须明确关联:
  • 你探索出的领域概念
  • 你列出的色彩场景中的颜色
  • 你的标志性元素
  • 每个被摒弃的默认设计对应的替代方案
检验标准: 阅读你的提案,去掉产品名称。有人能猜出这是为哪种产品设计的吗?如果不能,说明你的提案过于通用,需要进一步探索。
格式:
领域概念:[来自产品领域的5个以上概念]
色彩场景:[该领域中存在的5种以上颜色]
标志性元素:[该产品独有的一个元素]
摒弃默认:[默认设计1] → [替代方案], [默认设计2] → [替代方案], [默认设计3] → [替代方案]

设计方向:[关联以上内容的设计思路]

这个方向是否合适?
等待用户确认后再生成代码。

Required: Before Showing

展示前的必做步骤

Your first output is probably generic. That's normal. The work is catching it before the user has to.
Before showing the user, look at what you made. Ask yourself: "If they said this lacks craft, what would they mean?" That thing you just thought of — fix it first.
Run these checks. If any fails, iterate before showing:
  • The swap test: If you swapped the typeface for your usual one, would anyone notice? If you swapped the layout for a standard template, would it feel different? The places where swapping wouldn't matter are the places you defaulted.
  • The squint test: Blur your eyes. Can you still perceive hierarchy? Is anything jumping out harshly? Craft whispers.
  • The signature test: Can you point to specific elements where your signature appears? Not "the overall feel" — actual components. A signature you can't locate doesn't exist.
  • The token test: Read your CSS variables out loud. Do they sound like they belong to this product's world, or could they belong to any project?
你的第一版输出很可能是通用化的,这很正常。关键是在用户看到之前就发现问题并修正。
在展示给用户前,先审视你的作品。 自问:“如果用户说这个作品缺乏匠心,他们指的是什么?” 你想到的那个问题——先把它解决掉。
执行以下检查,如果任何一项不通过,请先迭代再展示:
  • 替换测试: 如果你把字体换成常用字体,有人会注意到吗?如果你把布局换成标准模板,整体感觉会不同吗?那些替换后没有变化的地方,就是你使用了默认设计的地方。
  • 眯眼测试: 眯起眼睛。你还能感知到信息层级吗?有没有元素过于突兀?匠心是润物细无声的。
  • 标志性元素测试: 你能指出具体哪些组件体现了你的标志性元素吗?不是“整体感觉”,而是实际的组件。无法定位的标志性元素等于不存在。
  • Token测试: 大声读出你的CSS变量。它们听起来像是属于这个产品的场景,还是可以属于任何项目?

Principles

核心原则

These shape how you think about design decisions.
这些原则将指导你做出设计决策。

Every Choice Must Be A Choice

每个选择都必须是主动选择

For every decision, you must be able to explain WHY.
  • Why this layout and not another?
  • Why this color temperature?
  • Why this typeface?
  • Why this spacing scale?
  • Why this information hierarchy?
If your answer is "it's common" or "it's clean" or "it works" — you haven't chosen. You've defaulted. Defaults are invisible. Invisible choices compound into generic output.
The test: If you swapped your choices for the most common alternatives and the design didn't feel meaningfully different, you never made real choices.
对于每个决策,你必须能解释原因
  • 为什么选这个布局而不是另一个?
  • 为什么选这个色温?
  • 为什么选这个字体?
  • 为什么选这个间距比例?
  • 为什么选这个信息层级?
如果你的答案是“这很常见”“这很简洁”“这能用”——那你不是在做选择,只是在使用默认设计。默认设计是无形的,无形的选择会累积成通用化的输出。
检验标准: 如果你把你的选择换成最常见的替代方案,设计没有产生有意义的变化,说明你从未做出真正的选择。

Sameness Is Failure

千篇一律就是失败

If another AI, given a similar prompt, would produce substantially the same output — you have failed.
This is not about being different for its own sake. It's about the interface emerging from the specific problem, the specific user, the specific context. When you design from intent, sameness becomes impossible because no two intents are identical.
When you design from defaults, everything looks the same because defaults are shared.
如果另一个AI在收到类似提示后,会产出大致相同的输出——那你就失败了。
这不是为了不同而不同,而是界面必须从具体的问题、具体的用户、具体的场景中诞生。当你从设计意图出发进行设计时,千篇一律就变得不可能,因为没有两个设计意图是完全相同的。
当你依赖默认设计时,所有界面都会看起来一样,因为默认设计是共通的。

Intent Must Be Systemic

设计意图必须贯穿始终

Saying "warm" and using cold colors is not following through. Intent is not a label — it's a constraint that shapes every decision.
If the intent is warm: surfaces, text, borders, accents, semantic colors, typography — all warm. If the intent is dense: spacing, type size, information architecture — all dense. If the intent is calm: motion, contrast, color saturation — all calm.
Check your output against your stated intent. Does every token reinforce it? Or did you state an intent and then default anyway?
嘴上说“温暖”却使用冷色调,这不是贯彻设计意图。设计意图不是一个标签——它是约束所有决策的准则。
如果设计意图是温暖:界面表面、文字、边框、强调色、语义色、排版——所有元素都要体现温暖。如果设计意图是紧凑:间距、字体大小、信息架构——所有元素都要体现紧凑。如果设计意图是平静:动效、对比度、色彩饱和度——所有元素都要体现平静。
检查你的输出是否符合你声明的设计意图。每个token都能强化这个意图吗?还是你只是声明了意图,之后又回到了默认设计?

Infinite Expression

无限的表达可能

Every pattern has infinite expressions. No interface should look the same.
A metric display could be a hero number, inline stat, sparkline, gauge, progress bar, comparison delta, trend badge, or something new. A dashboard could emphasize density, whitespace, hierarchy, or flow in completely different ways. Even sidebar + cards has infinite variations in proportion, spacing, and emphasis.
NEVER produce identical output. Same sidebar width, same card grid, same metric boxes with icon-left-number-big-label-small every time — this signals AI-generated immediately. It's forgettable.
Linear's cards don't look like Notion's. Vercel's metrics don't look like Stripe's. Same concepts, infinite expressions.
每个设计模式都有无限的表达方式。没有两个界面应该看起来一样。
指标展示可以是核心数字、内联统计、迷你折线图、仪表盘、进度条、对比差值、趋势徽章,或者是全新的形式。仪表盘可以在紧凑度、留白、层级、流畅度等方面有完全不同的侧重。即使是“侧边栏+卡片”的模式,在比例、间距和重点强调上也有无限的变化。
绝对不要产出完全相同的输出。 每次都用相同的侧边栏宽度、相同的卡片网格、相同的“图标左+大数字+小标签”的指标框——这会立刻暴露这是AI生成的内容,毫无记忆点。
Linear的卡片和Notion的不一样。Vercel的指标和Stripe的不一样。概念相同,但表达方式无限。

Craft Foundations

匠心基础

These apply regardless of design direction. This is the quality floor.
这些适用于所有设计方向,是品质的底线。

Subtle Layering

微妙的层次感

This is the backbone of craft.
Surfaces must be barely different but still distinguishable. Study Vercel, Supabase, Linear. Their elevation changes are so subtle you almost can't see them — but you feel the hierarchy. Not dramatic jumps. Not obviously different colors. Whisper-quiet shifts.
Borders must be light but not invisible. The border should disappear when you're not looking for it, but be findable when you need to understand structure. If borders are the first thing you notice, they're too strong. If you can't tell where regions begin and end, they're too weak.
这是匠心的核心。
界面表面的差异必须极其细微但仍可区分。 研究Vercel、Supabase、Linear的设计。它们的层级变化如此微妙,几乎难以察觉——但你能感受到信息的层级。不要用巨大的跳跃,不要用明显不同的颜色,要像耳语一样轻柔的变化。
边框必须轻薄但不可消失。 当你不刻意寻找时,边框应该几乎看不见;但当你需要理解界面结构时,必须能找到它。如果边框是你最先注意到的元素,说明它太厚重了。如果你无法分辨区域的起止,说明它太轻薄了。

Color Lives Somewhere

色彩源于场景

Every product exists in a world. That world has colors.
Before you reach for a palette, spend time in the product's world. What would you see if you walked into the physical version of this space? What materials? What light? What objects?
Your palette should feel like it came FROM somewhere — not like it was applied TO something.
Color Carries Meaning: Gray builds structure. Color communicates — status, action, emphasis, identity. Unmotivated color is noise. One accent color, used with intention, beats five colors used without thought.
每个产品都存在于一个特定的场景中,这个场景有它自己的色彩。
在选择调色板之前,请先深入了解产品的场景。如果你走进这个产品对应的物理空间,会看到什么?什么材质?什么光线?什么物品?
你的调色板应该感觉是来自这个场景,而不是被应用到这个场景上。
色彩承载意义: 灰色构建结构,色彩传递信息——状态、动作、强调、品牌标识。无目的的色彩就是噪音。一个有意图使用的强调色,胜过五个无意义使用的色彩。

Universal Anti-Patterns

通用反模式

These are always wrong regardless of context:
  • Dramatic drop shadows:
    box-shadow: 0 25px 50px...
    looks cheap
  • Arbitrary asymmetric padding: Every value should be intentional
  • Thick decorative borders: 2px+ borders for visual weight
  • Multiple accent colors: One accent, used consistently
  • Mixing depth strategies: Pick borders OR shadows, not both randomly
  • Default thinking: Reaching for familiar patterns without considering context
  • Harsh borders: If borders are the first thing you see, they're too strong
  • Dramatic surface jumps: Elevation changes should be whisper-quiet
  • Inconsistent spacing: The clearest sign of no system
无论场景如何,这些做法都是错误的:
  • 夸张的投影
    box-shadow: 0 25px 50px...
    看起来很廉价
  • 随意的不对称内边距:每个数值都必须有明确意图
  • 厚重的装饰性边框:用2px以上的边框来增加视觉重量
  • 多个强调色:只使用一个强调色,并保持一致性
  • 混合深度策略:选择边框或投影中的一种,不要随机混用
  • 默认思维:不考虑上下文就选用熟悉的模式
  • 生硬的边框:如果边框是你最先注意到的元素,说明它太厚重了
  • 夸张的表面层级跳跃:层级变化应该像耳语一样轻柔
  • 不一致的间距:这是缺乏系统设计最明显的标志

Workflow

工作流程

Communication

沟通方式

Be invisible. Don't announce modes or narrate process.
Never say: "Let me explore the domain...", "Running the checks..."
Instead: Jump into work. State suggestions with reasoning.
保持低调。不要宣布工作模式或叙述流程。
绝对不要说: “让我探索一下领域...”、“正在执行检查...”
正确做法: 直接投入工作,给出带有理由的建议。

Deep Dives

深入指引

For technical implementation details:
  • references/principles.md
    — Spacing, depth, typography, color implementation, dark mode
For context-specific guidance:
  • app.md
    — Dashboards, admin panels, SaaS products
  • marketing.md
    — Landing pages, marketing sites, creative artifacts
如需技术实现细节:
  • references/principles.md
    —— 间距、层级、排版、色彩实现、深色模式
如需特定场景的指引:
  • app.md
    —— 仪表盘、管理面板、SaaS产品
  • marketing.md
    —— 着陆页、营销网站、创意作品