AgentSkillsCN

design-system-conventions

使用语义化设计系统类进行 UI 样式设计的指南。切勿使用 gray-* 颜色或任意 Tailwind 工具类。

SKILL.md
--- frontmatter
name: design-system-conventions
description: Guide for UI styling with semantic design system classes. Never use gray-* colors or arbitrary Tailwind utilities.

Design System Conventions Skill

Purpose

Enforce consistent styling using semantic design system classes. Prevent arbitrary Tailwind utilities and ensure visual consistency.

⚠️ CRITICAL: Never Use Generic Grays

FORBIDDEN: text-gray-*, bg-gray-*, border-gray-*

USE INSTEAD: Semantic tokens from the design system.

Color Token Reference

PurposeTokenExample
Primary texttext-foregroundMain content
Strong texttext-foreground-strongHeadings
Muted texttext-foreground/80Secondary
Backgroundbg-backgroundPage background
Muted backgroundbg-mutedCards, sections
Borderborder-borderAll borders
Primary button texttext-primary-foregroundButton labels

Opacity Variants

Use /80, /70, /60 suffixes for opacity:

tsx
// ✅ CORRECT
<p className="text-foreground/80">Secondary text</p>

// ❌ WRONG
<p className="text-gray-600">Secondary text</p>

Typography Classes

ALWAYS use semantic classes, NEVER arbitrary text-* utilities for typography.

ClassUsage
.heading-1Page titles (h1)
.heading-2Section titles (h2)
.heading-3Subsection titles (h3)
.heading-4Minor headings (h4)
.body-largeLarge body text
.body-normalDefault body text
.body-smallSmall body text
.labelForm labels, captions

Examples

tsx
// ✅ CORRECT
<h1 className="heading-1">Page Title</h1>
<p className="body-normal">Content here</p>

// ❌ WRONG
<h1 className="text-3xl md:text-4xl font-bold">Page Title</h1>
<p className="text-base">Content here</p>

Button Classes

Use semantic button classes (component coming in Week 4):

ClassUsage
.btn-primaryPrimary actions
.btn-neutralSecondary actions
.btn-outlineTertiary actions
.btn-mutedLow-emphasis actions
tsx
// ✅ CORRECT
<button className="btn-primary">Submit</button>

// ❌ WRONG
<button className="bg-primary text-whiteCorp px-6 py-3 rounded-xl hover:bg-primarydark">
  Submit
</button>

Card Classes

ClassUsage
.card-borderedBorder + subtle shadow
.card-elevatedStronger shadow, no border
.card-bodyInner padding
.card-headerHeader section
.card-footerFooter section
tsx
// ✅ CORRECT
<div className="card-bordered">
  <div className="card-body">
    <h3 className="heading-3">Card Title</h3>
    <p className="body-normal">Content</p>
  </div>
</div>

Badge Classes

ClassUsage
.badge-primaryRed background (emphasis)
.badge-defaultGray background (neutral)

Layout Utilities

Replace repetitive flex patterns:

Semantic ClassReplaces
.flex-centerflex justify-center items-center
.flex-betweenflex justify-between items-center
.flex-startflex justify-start items-center
.stackflex flex-col gap-element-gap
tsx
// ✅ CORRECT
<div className="flex-center gap-element-gap">
  <Icon />
  <span>Text</span>
</div>

// ❌ WRONG
<div className="flex justify-center items-center gap-4">
  <Icon />
  <span>Text</span>
</div>

Spacing Tokens

TokenUsage
py-section-y, px-section-xSection spacing
p-card-paddingCard inner padding
gap-element-gapDefault gaps

Tailwind Spacing Exception

Allowed: One-off micro-spacing inside leaf components (gap-1, gap-2, p-1, p-2)

Not allowed:

  • Section/page/layout spacing
  • Card/button/input paddings
  • Shared components

Rule: If repeated → create/extend a semantic token instead.

Border Radius Tokens

TokenUsageValue
rounded-buttonButtons8px
rounded-cardCards12px
rounded-inputForm inputs8px
rounded-badgePills/badgesfull

Deprecated Aliases - DO NOT USE

primarydark, primarySoft, whiteCorp, darkCorp, blackCorp, fullBlackCorp, bColor

Use semantic tokens instead.

Migration Context

Current Phase: Week 0 - Foundation

When modifying existing components:

  1. Prefer semantic classes over inline utilities
  2. Keep changes incremental
  3. Consult /docs/reference-data.md for priority
  4. Use new semantic color tokens

Checklist Before Styling

  • Using semantic typography classes? (not text-xl font-bold)
  • Using semantic color tokens? (not gray-*)
  • Using button classes? (not inline utilities)
  • Using card classes? (not custom shadows/borders)
  • Using layout utilities? (flex-center vs manual flex)
  • Using spacing tokens? (for consistent spacing)

Files to Reference