DESIGN.md vs Tailwind Config
DESIGN.md is the framework-agnostic source of truth for your visual design system; Tailwind Config (@theme in Tailwind v4 or tailwind.config.* in v3) is the CSS utility compiler configuration generated from it. Tailwind turns tokens into utility classes at build time, while DESIGN.md documents the tokens, component recipes, and visual judgment that tell both humans and AI agents which classes to use.
Side-by-side comparison
| Dimension | DESIGN.md | Tailwind Config (@theme / tailwind.config.*) |
|---|---|---|
| Role | Authoritative design specification (tokens + rationale + anti-patterns) | Build-time configuration that generates Tailwind utility classes (bg-primary, rounded-md) |
| Framework lock-in | Framework-agnostic (exports to Tailwind, plain CSS, shadcn/ui, or native docs) | Specific to Tailwind CSS |
| Composite tokens | Native composite typography, motion, and components objects | Flat CSS variables in @theme (v4) or JS theme maps (v3); component recipes live in JSX/CSS |
| Design judgment & Do’s/Don’ts | Built in (## Layout, ## Elevation & Depth, ## Do's and Don'ts) | None — Tailwind only knows that a utility exists, not when or where to apply it |
| Accessibility validation | npx designmdpro lint checks WCAG AA contrast across foreground/background pairs | No built-in contrast validation |
| Token aliases | Static {colors.primary} references with missing-key and cycle detection | CSS var() references at runtime (typos fail silently) |
| AI agent context | Compact, self-contained spec designed for LLM context windows | Often mixed with Tailwind defaults, plugins, and custom utilities without usage hierarchy |
What Tailwind Config owns
Whether you use CSS-first @theme blocks in Tailwind CSS v4 or theme.extend in a legacy tailwind.config.ts, Tailwind owns utility class generation and build-time CSS bundling:
- Zero-runtime utility emission: declaring
--color-primary: #5645d4;inside@themegeneratesbg-primary,text-primary,border-primary, and opacity modifiers (bg-primary/10) on demand. - Responsive and state variants:
hover:,focus-visible:,dark:, and breakpoint prefixes work uniformly across every configured token. - Mechanical enforcement in the browser: once compiled, CSS custom properties guarantee exact pixel and hex values without consuming prompt tokens.
What DESIGN.md owns
Tailwind tells the compiler what utilities exist, but it does not tell an engineer or AI coding agent how to compose an interface:
- Hierarchy and restraint: which neutral surface goes on cards vs sidebars, when a border replaces a shadow, and which elements are allowed to use the brand accent.
- Cross-tool portability: you can feed
DESIGN.mdinto v0, Google Stitch, Claude Code, or Cursor, and compile the same tokens to plain CSS variables or shadcn/ui themes. - Pre-build quality gates:
npx designmdpro lintvalidates schema, references, and contrast ratios before stylesheets are regenerated.
How they work together
Author or pull your tokens in DESIGN.md, then compile them into Tailwind v4 @theme blocks using the Tailwind v4 Theme Generator or npx designmdpro export tailwind:
# DESIGN.md (source of truth)
---
version: alpha
name: Product UI
colors:
primary: "#5645d4"
background: "#ffffff"
surface: "#f6f5f4"
text: "#18181b"
dark:
primary: "#a78bfa"
background: "#0f172a"
text: "#f8fafc"
rounded:
md: 8px
spacing:
md: 16px
---Compiled into globals.css for Tailwind CSS v4:
@theme {
--color-primary: #5645d4;
--color-background: #ffffff;
--color-surface: #f6f5f4;
--color-text: #18181b;
--radius-md: 8px;
--spacing-md: 16px;
}
.dark {
--color-primary: #a78bfa;
--color-background: #0f172a;
--color-text: #f8fafc;
}In your repo, Tailwind enforces the exact CSS values at render time while DESIGN.md guides AI agents to pick bg-surface border border-border rounded-md instead of inventing arbitrary Tailwind values like bg-[#f2f1ef] shadow-xl rounded-2xl.
When to use which
- Use Tailwind Config alone for quick single-developer prototypes where you are not using AI agents for UI generation and do not need cross-tool exports or contrast linting.
- Use
DESIGN.mdcompiled to Tailwind@themefor production apps, multi-developer teams, and AI-assisted workflows where you want consistent visual decisions and deterministic utility classes.
Common mistakes
- Treating
globals.css@themeas sufficient AI context: an agent reading@themestill has to guess whether buttons should be pill-shaped orrounded-md, whether cards use shadows or borders, and where the primary accent is permitted. - Letting AI emit arbitrary values (
bg-[#5645d4],rounded-[10px]): explicitly forbid arbitrary values inDESIGN.md’s## Do's and Don'tsand require theme tokens defined in@theme. - Editing
@themeby hand without updatingDESIGN.md: regenerate the@themeblock fromDESIGN.md(or update both in the same PR) so agents and browsers never disagree.
Frequently Asked Questions
Does DESIGN.md replace Tailwind CSS or tailwind.config.js?
No. Tailwind CSS is a utility-first CSS framework that compiles utility classes for the browser, whereas DESIGN.md is a design-system specification. You compile DESIGN.md tokens into Tailwind v4 @theme (or v3 tailwind.config.*) and keep DESIGN.md for AI agents and documentation.
Does DesignMD Pro support Tailwind CSS v4 @theme?
Yes. Both the browser Tailwind v4 Theme Generator and the CLI (npx designmdpro export) emit Tailwind CSS v4 @theme blocks along with .dark overrides directly from DESIGN.md YAML frontmatter.
Why do AI agents still generate inconsistent UI when I already have a Tailwind config?
A Tailwind config lists available palette and spacing values, but it does not document surface hierarchy, typographic pairing rules, component recipes, or anti-patterns. DESIGN.md supplies those visual constraints alongside the exact tokens so agents apply the right utility classes consistently.
Can I use DESIGN.md with shadcn/ui on top of Tailwind?
Yes. DesignMD Pro’s shadcn Theme Generator maps semantic DESIGN.md color keys (background, surface, primary, on-primary, muted, border, destructive) and rounded.md directly onto shadcn/ui CSS variables.
Should I commit both DESIGN.md and the generated Tailwind @theme CSS?
Yes. Commit DESIGN.md at the repository root as the editable source of truth and commit the generated @theme block in your stylesheet (for example globals.css) so builds stay self-contained with zero runtime dependencies.
Next steps
- Tailwind CSS & shadcn/ui Integration — full token-to-CSS mapping tables for Tailwind v4 and shadcn/ui.
- Tailwind v4 Theme Generator — paste any
DESIGN.mdto generate a ready-to-use@themeblock. - Design Tokens vs CSS Variables — understand the token-to-CSS custom property pipeline.
- DESIGN.md vs Style Dictionary — compare lightweight CSS export with multi-platform build pipelines.