# The design system

> Tokens, aliases, modes, components, brand guidelines, assets and organization libraries.

Every project has one design system: the single source of truth agents design with and developers implement from.

## Tokens

Tokens are named design decisions: `color.brand`, `space.4`, `radius.md`, `font.body`. They become CSS variables (`--color-brand`) in every screen.

- **Aliases.** A token can point at another with W3C DTCG syntax: `color.action = {color.violet.500}`. Change the primitive and everything that aliases it follows. Screens should use semantic tokens; the analysis lists primitives used directly.
- **Modes.** Collections such as `theme: light, dark` or `density: comfortable, compact` give tokens a value per mode. Switch modes in any preview.
- **Export.** Download tokens as CSS, SCSS, Tailwind, JSON (DTCG), SwiftUI, Jetpack Compose or Android XML — or let your agent call `export_tokens`.

## Components

A component has a key (`button`), CSS and named variants (`primary`, `secondary`, `danger`), each with its HTML. Screens use them with `<ds-use component="button" variant="primary">Pay</ds-use>`, so a change to the component updates every screen that uses it. Each update is a new component version.

## Brand guidelines

A Markdown brandbook — voice, logo usage, visual direction, do and don't — that agents read before designing.

## Assets

Images, icons, fonts and videos referenced as `asset:<name>`.

## Organization libraries (Business)

Share one design system across projects. A library project publishes semver releases with a generated changelog. Other projects use a pinned release, see what an update changes (screen by screen, before and after) and either update — getting new screen versions to review — or defer. Approved screens never change by surprise.

## Importing what you have

- **Figma:** variables become tokens, components become components, frames become screens.
- **An existing codebase:** run the `import_from_codebase` prompt in your repository; your agent extracts tokens and components, and they wait for review under Design system → Imported.

## Publish to the gallery

Project owners can show a design system on the public [gallery](/gallery): **Project settings → Gallery → Publish to gallery**. The public page shows the title and summary you write, your tokens, component names and **approved** screens as images. Drafts, comments, code, the brand book, members and your organization stay private. Anyone can then choose **Use this template** to copy the tokens, components and approved screens into a new project of their own. Unpublish at any time; turning off public sharing for the organization hides every entry.
