agentleFS
krivooxkrivoox/agent-stack-template/.cursor/rules/ui-design-system.mdc

agent-stack-template / rules

Cursor rule31 starsChanged 3 months agoMITView on GitHub

UI, design tokens and mobile-first rules

The file

We split this ui-design-system.mdc into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are 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.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No business rules in React.

    line 16
  2. Distinctive:

    If a style combination appears three times, it becomes a CVA variant or a component.

    line 41
  3. Very specific:

    Every interactive element needs hover, focus-visible, disabled and loading.

    line 46
  4. Very specific:

    Every list needs an empty state and an error state.

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
ui-design-system.mdc
---
description: UI, design tokens and mobile-first rules
globs: src/components/**/*.tsx,src/features/**/components/**/*.tsx,src/app/**/*.tsx,src/app/globals.css
alwaysApply: false
---

# UI

Source of truth: `DESIGN.md`. Theme tokens: `src/app/globals.css`.

## Before writing UI

1. Reuse `src/components/ui/*`. Extend with a CVA `variant` / `size` rather
   than a one-off `className`.
2. Reuse the shell: `ContentPanel`, `SurfaceSection`, `FormSheet`, `FormField`.
3. No business rules in React.

## Mobile-first

Base styles target a phone (< 640px); enrich upward with `sm:` / `md:` / `lg:`.
Designing for desktop and patching with `max-md:` is the wrong direction.

- Tables: only identity + the primary value in the base layout; everything else
  `hidden sm:table-cell`.
- Forms: one column at base; grids from `sm:`.
- Primary controls at least ~40px tall on touch.

## Colour

Semantic classes only: `bg-background`, `bg-card`, `text-foreground`,
`text-muted-foreground`, `bg-primary`, `border-border`, `ring-ring`,
`sidebar-*`, and the accent tokens (`info`, `success`, `warning`,
`destructive`).

Forbidden in product UI: hex, raw `rgb()`, and Tailwind colour scales
(`bg-zinc-50`, `text-blue-600`). A new colour is a token in `:root` / `.dark`
plus an entry in `@theme inline` — never an inline value.

## Repetition

If a style combination appears three times, it becomes a CVA variant or a
component. Two is a coincidence; three is a pattern.

## States and motion

Every interactive element needs hover, focus-visible, disabled and loading.
Every list needs an empty state and an error state. Animate only `transform`
and `opacity`, under 300ms, and respect `prefers-reduced-motion`.

## Navigation

A new destination goes in `src/components/app-shell/nav-config.ts`. A link
added directly in a component never gets prefetched and never gets a title.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.