Designer
← Docs

Design System Rules

Naming conventions, component categories, Sketch mapping, and maintenance checklists. These rules ensure the Sketch MCP bridge can parse, match, and sync every token, component, and view automatically.

Naming Convention Matrix

LayerConventionExampleRule
Folder nameskebab-caseproperty-card/, filter-modal/Always lowercase, hyphens only
File nameskebab-case + suffixproperty-card.tsx, property-card.module.cssMatch folder name exactly
CSS classescamelCase.slideArea, .priceRow, .actionPillSingle word for primitives, camelCase for compound
CSS variables--{category}-{name}--color-brand, --space-mdAlways kebab-case, always start with category prefix
Token keys{category}-{name}color-brand, type-scale-baseMatches CSS variable without -- prefix
Material namesmaterial-{name}material-card, material-glassAlways prefixed with material-
React componentsPascalCasePropertyCard, FilterModalMatches folder name in PascalCase
React propscamelCasesupabaseUrl, propertyHrefStandard React convention
View slugskebab-caseproperty-detail, building-detailMatches folder name in views/
View meta exports{name}MetapropertyDetailMeta, homepageMetacamelCase + Meta suffix
Sketch symbols{Category} / {Name}Display / Thumbnail / PropertyTitle Case, forward-slash separated
Sketch color varsColors / {Label}Colors / Brand, Colors / Text MutedMatches token label from TOKEN_DEFINITIONS
Sketch text stylesTypography / {Label}Typography / HeadingMatches font token labels
Sketch layer stylesMaterials / {Label}Materials / Card, Materials / GlassMatches material label from MATERIALS

Component Categories

Every component belongs to exactly one category. This determines its Sketch symbol prefix and Designer gallery grouping.

CategorySketch PrefixComponents
PrimitivesPrimitives /Button, Input, Select, Badge, Toggle
LayoutLayout /Stack, Grid, Container, Divider
DisplayDisplay /Thumbnail, PropertyCard, EntityThumbnail, ThumbnailGrid, PropertyGallery, Skeleton
NavigationNavigation /Navbar, SearchTrigger, Tabs, Breadcrumb, Pagination
OverlayOverlay /Modal, SearchModal, FilterModal, PickerModal, BuildingFilterModal
MapMap /MapView, Marker, MapPropertyPanel, MapControls
EditorEditor /EditorLayout, EditorSection, EditorField, ImageSection, DataTable
BlocksBlocks /HeroCentered, HeroSplit, TextImage, StatsGrid, Testimonials

Component Naming Rules

Folder → File → Class → Sketch Mapping

Folder:   packages/ui/src/components/property-card/
Files:    property-card.tsx, property-card.module.css, index.ts
Export:   PropertyCard (PascalCase of folder)
CSS root: .root or .card (semantic, matches component purpose)
Sketch:   Display / Property Card

Variant Naming (CSS Module Classes)

/* Base class = component purpose */
.pill { }

/* Active/selected state = base + State */
.pillActive { }

/* Size variants = base + Size */
.pillSm { }
.pillLg { }

/* Context variants = descriptive camelCase */
.aspectProperty { aspect-ratio: 4/3; }
.aspectEntity { aspect-ratio: 3/4; }

Variant Naming (Sketch Symbols)

{Category} / {Component} / {Variant}

Display / Thumbnail / Property      <- default (4/3 aspect)
Display / Thumbnail / Entity        <- 3/4 aspect
Display / Thumbnail / Square        <- 1/1 aspect

Overlay / Modal / With Title
Overlay / Modal / Headerless
Overlay / Modal / Large

Navigation / Search Bar / Default
Navigation / Search Bar / With Filters
Navigation / Search Bar / With Toggle

The Sketch symbol path maps directly to code: Category → component category in Designer gallery, Component → folder name in components/, Variant → variant key in .variants.ts

View Naming Rules

Folder:   packages/ui/src/views/property-detail/
Files:    property-detail.view.tsx, property-detail.module.css, property-detail.meta.ts, index.ts
Export:   PropertyDetailView
Meta:     propertyDetailMeta
Slug:     "property-detail"
Sketch:   Pages / Property Detail / Full Page
          Pages / Property Detail / Full Page Mobile
          Pages / Property Detail / Side Panel

View Variant Naming in Sketch

Pages / {View Name} / {Variant Name}

Pages / Property Detail / Full Page
Pages / Property Detail / Full Page Mobile
Pages / Homepage / Desktop
Pages / Homepage / Mobile
Pages / Building Detail / Full Page

Token Naming Rules

Adding a New Token

  1. Key: {category}-{name} in kebab-case (e.g., color-brand-muted)
  2. CSS var: --{key} (e.g., --color-brand-muted)
  3. Label: Title Case for humans (e.g., "Brand Muted")
  4. Sketch name: Colors / {Label} (e.g., "Colors / Brand Muted")
  5. Add to packages/tokens/src/definitions.ts (TOKEN_DEFINITIONS array)
  6. Add default value to packages/tokens/src/defaults.ts
  7. Run pnpm design:generate to regenerate tokens.css

Adding a New Material

  1. Name: material-{name} in kebab-case
  2. Label: Title Case
  3. Sketch name: Materials / {Label}
  4. Add to packages/tokens/src/materials.ts (MATERIALS array)
  5. Run pnpm design:generate

Maintenance Checklists

When Adding a New Component

  1. Create folder: packages/ui/src/components/{name}/
  2. Create files: {name}.tsx, {name}.module.css, index.ts
  3. Export from packages/ui/src/index.ts
  4. Add to Designer app component list in apps/designer/src/app/components/page.tsx
  5. Create Designer preview page at apps/designer/src/app/components/{name}/page.tsx
  6. Create Sketch symbol: '{Category} / {Name}'
  7. Tag component with app: 'shared' | 'agentos' | 'website' in Designer

When Adding a New View

  1. Create folder: packages/ui/src/views/{name}/
  2. Create files: {name}.view.tsx, {name}.module.css, {name}.meta.ts, index.ts
  3. Add meta to VIEW_REGISTRY in packages/ui/src/views/index.ts
  4. Add fixture data in packages/ui/src/fixtures/ if needed
  5. Create Sketch artboards: 'Pages / {Name} / {Variant}'

When Modifying a Token

  1. Update value in packages/tokens/src/defaults.ts
  2. Run pnpm design:generate
  3. Push to Sketch: use the "Push tokens to Sketch" prompt
  4. Verify in Designer app at /tokens

When Adding a Tenant

  1. Create packages/tokens/src/tenants/{slug}.json with override values only
  2. Add tenant to apps/designer/src/components/designer-context.tsx TENANT_OVERRIDES
  3. Preview in Designer at /tenants
  4. Verify key views render correctly with tenant branding

When Renaming or Moving a Component

  1. Update folder and file names (kebab-case)
  2. Update the re-export shim at the old path
  3. Update Designer component list
  4. Rename Sketch symbol to match new path
  5. Run pnpm build to verify no broken imports