fullstack-starter / rules
Cursor rule223 starsChanged 28 days agoMITView on GitHub
when working with design tokens, colors, or theming.
We split this design-tokens-guide.mdc into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 182
Add/update colors in tokens.color.light and tokens.color.dark
- Distinctive: line 186
Run the build command to generate platform-specific outputs:
- Distinctive: line 273
Run tests to verify color conversion accuracy:
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: "when working with design tokens, colors, or theming."
globs:
alwaysApply: false
---
<!-- Generated by oh-my-agent. Source: .agents/rules/design-tokens-guide.md -->
# Design Tokens Workflow
## Source of Truth
The single source of truth for all design tokens is located in `packages/design-tokens/src/tokens.ts`.
- **Do NOT** edit `apps/web/src/app/[locale]/tokens.css` directly - it's auto-generated.
- **Do NOT** edit `apps/mobile/lib/core/theme/generated_theme.dart` directly - it's auto-generated.
- **ALWAYS** make changes in `packages/design-tokens/src/tokens.ts`.
## Color Space
- **SSOT Format**: OKLCH (Lightness, Chroma, Hue)
- **Web Output**: CSS OKLCH variables (P3 wide-gamut support)
- **Mobile Output**: Flutter `Color.from(colorSpace: ColorSpace.displayP3)` for P3 colors
## Token Structure
```typescript
// packages/design-tokens/src/tokens.ts
export interface OklchColor {
l: number; // Lightness: 0 (black) to 1 (white)
c: number; // Chroma: 0 (gray) to 0.4+ (vivid)
h: number; // Hue: 0-360 degrees on color wheel
a?: number; // Alpha: 0-1, defaults to 1
}
const oklch = (l: number, c: number, h: number, a?: number): OklchColor => ({
l, c, h, ...(a !== undefined && { a }),
});
export const tokens = {
color: {
light: {
// Accent colors
accent: oklch(0.97, 0, 0),
accentForeground: oklch(0.205, 0, 0),
// Background & Foreground
background: oklch(1, 0, 0),
foreground: oklch(0.145, 0, 0),
// Border & Input
border: oklch(0.922, 0, 0),
input: oklch(0.922, 0, 0),
// Card
card: oklch(1, 0, 0),
cardForeground: oklch(0.145, 0, 0),
// Chart colors
chart1: oklch(0.646, 0.222, 41.116),
chart2: oklch(0.6, 0.118, 184.704),
chart3: oklch(0.398, 0.07, 227.392),
chart4: oklch(0.828, 0.189, 84.429),
chart5: oklch(0.769, 0.188, 70.08),
// Destructive (danger/error)
destructive: oklch(0.577, 0.245, 27.325),
destructiveForeground: oklch(1, 0, 0),
// Muted (subtle)
muted: oklch(0.97, 0, 0),
mutedForeground: oklch(0.556, 0, 0),
// Popover (dropdown/tooltip)
popover: oklch(1, 0, 0),
popoverForeground: oklch(0.145, 0, 0),
// Primary (Lime Green)
primary: oklch(0.85, 0.2, 130),
primaryForeground: oklch(0.205, 0, 0),
ring: oklch(0.708, 0, 0),
// Secondary
secondary: oklch(0.97, 0, 0),
secondaryForeground: oklch(0.205, 0, 0),
// Sidebar
sidebar: oklch(0.985, 0, 0),
sidebarAccent: oklch(0.97, 0, 0),
sidebarAccentForeground: oklch(0.205, 0, 0),
sidebarBorder: oklch(0.922, 0, 0),
sidebarForeground: oklch(0.145, 0, 0),
sidebarPrimary: oklch(0.205, 0, 0),
sidebarPrimaryForeground: oklch(0.985, 0, 0),
sidebarRing: oklch(0.708, 0, 0),
},
dark: { /* similar structure with dark mode values */ },
},
// Radius (pixels)
radius: {
base: 10,
sm: 6,
md: 8,
lg: 10,
xl: 14,
},
// Spacing (pixels)
spacing: {
xs: 4,
sm: 8,
md: 12,
base: 16,
lg: 20,
xl: 24,
"2xl": 32,
"3xl": 48,
},
// Typography
typography: {
fontFamily: {
sans: "Noto Sans KR",
mono: "Noto Sans Mono",
},
fontSize: {
xs: 12,
sm: 14,
base: 16,
lg: 18,
xl: 20,
xl2: 24,
xl3: 30,
xl4: 36,
xl5: 48,
xl6: 60,
xl7: 72,
xl8: 96,
},
fontWeight: {
regular: 400,
medium: 500,
bold: 700,
black: 900,
},
lineHeight: {
xs: 1.0,
sm: 1.25,
base: 1.5,
lg: 1.75,
xl: 1.75,
xl2: 2.0,
xl3: 2.25,
xl4: 2.5,
},
letterSpacing: {
tight: -0.5,
normal: 0,
wide: 0.8,
},
},
// Style
style: {
borderWidth: 1,
disabledOpacity: 0.5,
hoverDarken: 0.05,
hoverLighten: 0.075,
},
// Semantic colors (convenience layer)
semantic: {
info: oklch(0.6, 0.2, 260),
success: oklch(0.65, 0.2, 145),
warning: oklch(0.75, 0.18, 85),
},
};
```
## Workflow
### 1. Modify Tokens
Edit `packages/design-tokens/src/tokens.ts`:
- Add/update colors in `tokens.color.light` and `tokens.color.dark`
- Modify radius, spacing, typography, or style values
### 2. Build & Distribute
Run the build command to generate platform-specific outputs:
```bash
mise //packages/design-tokens:build
```
This generates:
- **Web**: `apps/web/src/app/[locale]/tokens.css` (OKLCH CSS variables)
- **Mobile**: `apps/mobile/lib/core/theme/generated_theme.dart` (ForUI FThemeData)
### 3. Watch Mode (Development)
For automatic rebuilds during development:
```bash
mise //packages/design-tokens:dev
```
## Adding New Colors
### Available Color Categories
The token system provides these color categories:
- **Base Colors**: `primary`, `secondary`, `accent`, `foreground`, `background`
- **Component Colors**: `card`, `popover`, `sidebar`, `input`, `border`
- **Feedback Colors**: `destructive`, `muted`, `ring`
- **Chart Colors**: `chart1` through `chart5` (for data visualization)
- **Semantic Colors**: `info`, `success`, `warning` (convenience layer)
### Step 1: Add to tokens.ts
```typescript
color: {
light: {
// Use oklch() helper for new colors
newColor: oklch(0.65, 0.2, 145),
newColorForeground: oklch(0.205, 0, 0),
},
dark: {
// Add same colors with dark mode values
newColor: oklch(0.65, 0.2, 145),
newColorForeground: oklch(0.985, 0, 0),
},
}
```
### Step 2: Build
```bash
mise //packages/design-tokens:build
```
### Step 3: Use in Code
**Web (CSS variable):**
```css
background-color: oklch(var(--color-newColor) / var(--alpha));
```
**Mobile (Flutter theme):**
```dart
Color.from(
colorSpace: ColorSpace.displayP3,
l: tokens.newColor.l,
c: tokens.newColor.c,
h: tokens.newColor.h,
)
```
## OKLCH Color Guide
| Component | Range | Description |
|-----------|-------|-------------|
| L (Lightness) | 0-1 | 0 = black, 1 = white |
| C (Chroma) | 0-0.4+ | 0 = gray, higher = more vivid |
| H (Hue) | 0-360 | Color wheel angle |
| A (Alpha) | 0-1 | Optional, defaults to 1 |
### Common Hue Values
- 0: Red
- 30: Orange
- 60: Yellow
- 130: Lime Green (primary)
- 180: Cyan
- 240: Blue
- 300: Magenta
## Testing
Run tests to verify color conversion accuracy:
```bash
mise //packages/design-tokens:test
```
Tests cover:
- OKLCH to P3 conversion accuracy
- CSS generation correctness
- Flutter theme generation
- Edge cases and boundary conditions
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository131 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/backend.mdcCursor rule
- .cursor/rules/branching-strategy.mdcCursor rule
- .cursor/rules/build-guide.mdcCursor rule
- .cursor/rules/commit.mdcCursor rule
- .cursor/rules/database.mdcCursor rule
- .cursor/rules/debug.mdcCursor rule
- .cursor/rules/design.mdcCursor rule
- .cursor/rules/dev-workflow.mdcCursor rule
- .cursor/rules/frontend.mdcCursor rule
- .cursor/rules/i18n-arb.mdcCursor rule
- .cursor/rules/i18n-guide.mdcCursor rule
- .cursor/rules/infrastructure.mdcCursor rule
- .cursor/rules/lint-format-guide.mdcCursor rule
- .cursor/rules/market.mdcCursor rule
- .cursor/rules/mobile.mdcCursor rule
- .cursor/rules/preferred-editing-tools.mdcCursor rule
- .cursor/rules/quality.mdcCursor rule
- .cursor/rules/test-guide.mdcCursor rule
- oma-academic-writingSkill
- oma-architectureSkill
- oma-backendSkill
- oma-brainstormSkill
- oma-coordinationSkill
- oma-dbSkill
- oma-debugSkill
- oma-deepsecSkill
- oma-designSkill
- oma-dev-workflowSkill
- oma-docsSkill
- oma-explanationSkill
- oma-frontendSkill
- oma-hwpSkill
- oma-imageSkill
- oma-marketSkill
- oma-mobileSkill
- oma-observabilitySkill
- oma-orchestrationSkill
- oma-pdfSkill
- oma-pmSkill
- oma-qaSkill
- oma-recapSkill
- oma-refactorSkill
- oma-scholarSkill
- oma-scmSkill
- oma-searchSkill
- oma-skill-creationSkill
- oma-slideSkill
- oma-tf-infraSkill
- oma-translationSkill
- oma-videoSkill
- oma-voiceSkill
- architectureSkill
- brainstormSkill
- commitSkill
- convertSkill
- coordinate-proSkill
- coordinateSkill
- debugSkill
- deepinitSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

