npx skills add https://github.com/s-hiraoku/synapse-a2a --skill frontend-design创建具有明确美学意图和专业执行力的界面。避免千篇一律的“模板”式外观。
在编写代码之前,请回答以下问题:
确定一个方向并坚持下去。胆怯的设计比有缺陷但大胆的设计更糟糕。
避免使用过度泛滥的默认字体。选择能强化界面个性的字体。
/* 不好:通用,随处可见 */
font-family: 'Inter', 'Roboto', 'Arial', sans-serif;
/* 好:独特且有意识地进行搭配 */
--font-display: 'Instrument Serif', serif; /* 标题 */
--font-body: 'Satoshi', sans-serif; /* 正文 */
--font-mono: 'Berkeley Mono', monospace; /* 代码 */
/* 表格数字用于对齐列 */
.data-cell { font-variant-numeric: tabular-nums; }
/* 平衡标题,防止出现孤行词 */
h1, h2, h3 { text-wrap: balance; }
/* 正确的省略号字符 */
.truncate::after { content: '\2026'; } /* … 而不是 ... */
有意识地处理文本溢出:
/* 单行截断 */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 多行截断 */
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* 弹性子元素需要 min-w-0 才能使截断生效 */
.flex-child { min-width: 0; }
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
基于 CSS 自定义属性构建,并采用清晰的语义化命名。
:root {
/* 基础色 */
--gray-50: oklch(0.98 0.005 240);
--gray-900: oklch(0.15 0.01 240);
--accent: oklch(0.65 0.25 30);
/* 语义化令牌 */
--color-bg: var(--gray-50);
--color-text: var(--gray-900);
--color-text-muted: oklch(0.55 0.01 240);
--color-border: oklch(0.88 0.005 240);
--color-accent: var(--accent);
--color-accent-hover: oklch(0.58 0.28 30);
}
@media (prefers-color-scheme: dark) {
:root {
--color-bg: var(--gray-900);
--color-text: var(--gray-50);
--color-text-muted: oklch(0.65 0.01 240);
--color-border: oklch(0.28 0.005 240);
}
}
prefers-reduced-motiontransform 和 opacity 应用动画:这些属性由 GPU 合成,其他属性会触发布局/绘制transition: all:列出具体的属性/* 好:指定具体属性,尊重用户偏好 */
.card {
transition: transform 200ms ease-out, opacity 150ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
.card { transition: none; }
}
将动画预算集中在:
避免:每个元素的随机悬停效果、滚动劫持、装饰性背景动画。
/* 流式排版 */
h1 { font-size: clamp(2rem, 5vw, 4rem); }
/* 容器查询,用于组件级响应式设计 */
.card-container { container-type: inline-size; }
@container (min-width: 400px) {
.card { grid-template-columns: 200px 1fr; }
}
通过分层处理构建视觉深度:
/* 噪点纹理叠加 */
.surface::after {
content: '';
position: absolute;
inset: 0;
background: url('/noise.svg');
opacity: 0.03;
pointer-events: none;
}
/* 渐变网格 */
.hero {
background:
radial-gradient(ellipse at 20% 50%, oklch(0.7 0.15 250 / 0.3), transparent 50%),
radial-gradient(ellipse at 80% 20%, oklch(0.7 0.2 30 / 0.2), transparent 50%),
var(--color-bg);
}
// 显式指定尺寸,防止布局偏移
<Image src={src} width={800} height={600} alt="描述" />
// 首屏以下:懒加载
<Image src={src} loading="lazy" alt="..." />
// 首屏:优先加载
<Image src={src} priority alt="..." />
// 装饰性:空 alt
<Image src={pattern} alt="" aria-hidden="true" />
每个交互元素都需要 4 种状态:
| 状态 | 处理方式 |
|---|---|
| 默认 | 基础外观 |
| 悬停 | 增加对比度或轻微变化 |
| 焦点 | 通过 :focus-visible 显示可见的轮廓环 |
| 激活/按下 | 轻微缩放或颜色变化 |
| 禁用 | 降低不透明度 + cursor: not-allowed |
.button {
background: var(--color-accent);
transition: background 150ms ease-out, transform 100ms ease-out;
}
.button:hover { background: var(--color-accent-hover); }
.button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.button:active { transform: scale(0.98); }
| 避免 | 替代方案 |
|---|---|
| 到处使用 Inter/Roboto/Arial | 选择独特的、适合项目的字体 |
| 白色背景上的紫色渐变 | 坚持使用特定、协调的调色板 |
| 统一的卡片网格 | 变化尺寸,添加特色/主推卡片 |
| 所有元素都加阴影 | 有目的地使用阴影来构建层级关系 |
所有元素都使用 border-radius: 9999px | 根据内容类型和上下文匹配圆角 |
| 相同的悬停效果 | 根据元素功能定制交互反馈 |
每周安装量
71
代码仓库
GitHub 星标数
1
首次出现
2026年2月11日
安全审计
安装于
codex69
kimi-cli68
amp68
github-copilot68
opencode68
gemini-cli68
Create interfaces with intentional aesthetics and professional execution. Avoid generic "template" looks.
Before writing code, answer these questions:
Commit to a direction. Timid design is worse than bold design with flaws.
Avoid overused defaults. Choose typefaces that reinforce the interface's personality.
/* BAD: Generic, seen everywhere */
font-family: 'Inter', 'Roboto', 'Arial', sans-serif;
/* GOOD: Distinctive and paired intentionally */
--font-display: 'Instrument Serif', serif; /* headings */
--font-body: 'Satoshi', sans-serif; /* body text */
--font-mono: 'Berkeley Mono', monospace; /* code */
/* Tabular numbers for aligned columns */
.data-cell { font-variant-numeric: tabular-nums; }
/* Balanced headings prevent widow words */
h1, h2, h3 { text-wrap: balance; }
/* Proper ellipsis character */
.truncate::after { content: '\2026'; } /* … not ... */
Handle text overflow deliberately:
/* Single line truncation */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Multi-line clamping */
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* Flex children need min-w-0 for truncation to work */
.flex-child { min-width: 0; }
Build on CSS custom properties with clear semantic naming.
:root {
/* Primitives */
--gray-50: oklch(0.98 0.005 240);
--gray-900: oklch(0.15 0.01 240);
--accent: oklch(0.65 0.25 30);
/* Semantic tokens */
--color-bg: var(--gray-50);
--color-text: var(--gray-900);
--color-text-muted: oklch(0.55 0.01 240);
--color-border: oklch(0.88 0.005 240);
--color-accent: var(--accent);
--color-accent-hover: oklch(0.58 0.28 30);
}
@media (prefers-color-scheme: dark) {
:root {
--color-bg: var(--gray-900);
--color-text: var(--gray-50);
--color-text-muted: oklch(0.65 0.01 240);
--color-border: oklch(0.28 0.005 240);
}
}
prefers-reduced-motiontransform and opacity: These are GPU-composited, everything else triggers layout/painttransition: all: List specific properties/* GOOD: Specific properties, respects user preference */
.card {
transition: transform 200ms ease-out, opacity 150ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
.card { transition: none; }
}
Focus animation budget on:
Skip: random hover effects on every element, scroll-jacking, decorative background animations.
/* Fluid typography */
h1 { font-size: clamp(2rem, 5vw, 4rem); }
/* Container queries for component-level responsiveness */
.card-container { container-type: inline-size; }
@container (min-width: 400px) {
.card { grid-template-columns: 200px 1fr; }
}
Build visual depth through layered treatments:
/* Noise texture overlay */
.surface::after {
content: '';
position: absolute;
inset: 0;
background: url('/noise.svg');
opacity: 0.03;
pointer-events: none;
}
/* Gradient mesh */
.hero {
background:
radial-gradient(ellipse at 20% 50%, oklch(0.7 0.15 250 / 0.3), transparent 50%),
radial-gradient(ellipse at 80% 20%, oklch(0.7 0.2 30 / 0.2), transparent 50%),
var(--color-bg);
}
// Explicit dimensions prevent layout shift
<Image src={src} width={800} height={600} alt="Description" />
// Below-fold: lazy load
<Image src={src} loading="lazy" alt="..." />
// Above-fold: prioritize
<Image src={src} priority alt="..." />
// Decorative: empty alt
<Image src={pattern} alt="" aria-hidden="true" />
Every interactive element needs 4 states:
| State | Treatment |
|---|---|
| Default | Base appearance |
| Hover | Increased contrast or subtle shift |
| Focus | Visible ring via :focus-visible |
| Active/Pressed | Slight scale or color change |
| Disabled | Reduced opacity + cursor: not-allowed |
.button {
background: var(--color-accent);
transition: background 150ms ease-out, transform 100ms ease-out;
}
.button:hover { background: var(--color-accent-hover); }
.button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.button:active { transform: scale(0.98); }
| Avoid | Instead |
|---|---|
| Inter/Roboto/Arial everywhere | Choose distinctive, project-appropriate typefaces |
| Purple gradient on white | Commit to a specific, cohesive palette |
| Uniform card grids | Vary sizes, add featured/hero cards |
| Shadows on everything | Use shadow purposefully for elevation hierarchy |
border-radius: 9999px on all elements | Match radius to content type and context |
| Identical hover effects | Tailor interaction feedback to element function |
Weekly Installs
71
Repository
GitHub Stars
1
First Seen
Feb 11, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex69
kimi-cli68
amp68
github-copilot68
opencode68
gemini-cli68
React视图过渡API使用指南:实现原生浏览器动画与状态管理
5,700 周安装