A declarative, machine-readable specification for defining design systems as code, built for AI-native development.
DSS exists to solve two problems in AI-assisted development:
When an AI agent (Claude, Copilot, etc.) generates UI code, it should automatically follow the design system—using correct colors, spacing, component variants, and patterns.
How DSS helps: The dss generate --llm command produces a structured context document containing:
- Design principles and constraints
- Token values with semantic meanings
- Component specs with
allowedContextsandantiPatterns - Accessibility requirements
Include this in your AI context, and generated code follows the design system.
After code is written (by humans or AI), an agent should be able to review it and report design system violations.
How DSS helps: The dss validate command checks implementations against the spec:
- Hardcoded colors → should use CSS variables
- Invalid variant values → must match component spec
- Missing accessibility attributes → required by spec
- Anti-pattern violations → flagged in component spec
JSON output (--json) enables programmatic integration with CI or agent workflows.
| Goal | Effectiveness | Notes |
|---|---|---|
| AI builds compliant UI | High | LLM context with intent, examples, and anti-patterns significantly improves AI output quality |
| AI reviews for compliance | Medium-High | Catches token violations and accessibility issues; cannot verify visual correctness or behavioral logic |
- Hardcoded colors, spacing values
- Invalid component variants
- Missing
alt,aria-labelattributes - Anti-patterns (multiple primary buttons, nested cards)
- Non-standard token values
- Visual correctness (does it look right?)
- Interaction behavior (does hover/focus work?)
- Semantic appropriateness (is this the right component for the use case?)
- Layout and responsive issues
For visual validation, combine DSS with visual regression testing (Chromatic, Percy).
# CLI
go install github.com/plexusone/design-system-spec/cmd/dss@latest
# Go SDK
go get github.com/plexusone/design-system-specmy-design-system/
├── meta.json
├── foundations/
│ └── colors.json
└── components/
└── button.json
meta.json:
{
"name": "My Design System",
"version": "1.0.0"
}components/button.json:
{
"id": "Button",
"name": "Button",
"variants": [
{ "id": "default", "isDefault": true },
{ "id": "secondary" },
{ "id": "destructive" }
],
"llm": {
"intent": "Trigger user actions",
"allowedContexts": ["forms", "dialogs", "toolbars"],
"antiPatterns": ["Multiple primary buttons per view"]
}
}dss generate --llm ./DESIGN_CONTEXT.mdAdd DESIGN_CONTEXT.md to your AI assistant's context (Claude Projects, Copilot instructions, etc.).
# Human-readable
dss validate ./src/components
# JSON for CI/agents
dss validate --json ./src/components| Command | Description |
|---|---|
dss info |
Display design system metadata |
dss generate |
Generate CSS, TypeScript types, LLM prompt |
dss validate <dir> |
Validate component implementations |
dss lint-spec |
Lint spec for completeness and agent-readiness |
dss bind |
Generate theme bindings CSS/TypeScript/SCSS |
dss contract show |
Display component theming contract |
dss contract validate |
Validate all theming contracts |
The dss-mcp command exposes your design system as an MCP (Model Context Protocol) server, enabling AI assistants like Claude to directly query and validate against your spec.
go install github.com/plexusone/design-system-spec/cmd/dss-mcp@latestAdd to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"design-system": {
"command": "dss-mcp",
"args": ["--spec", "/path/to/your/design-system"]
}
}
}| Category | Tools | Purpose |
|---|---|---|
| Spec Reading | get_component, list_components, get_token, list_tokens, get_pattern, list_patterns, get_meta |
Query the design system |
| Guidance | generate_prompt, get_variants, get_props, get_anti_patterns |
Implementation guidance |
| Validation | validate_file, validate_directory, check_colors, check_spacing |
Code compliance checking |
| Fix | fix_file, suggest_fixes, fix_colors, fix_spacing, fix_accessibility, fix_directory |
Auto-fix violations |
| Lint | lint_spec, list_lint_rules, check_agent_readiness |
Spec completeness checking |
| Validators | list_validators, get_validator, get_validation_requirements, get_validator_invocation |
External validator delegation |
| Compliance | generate_compliance_report, check_release_gate, run_fix_loop, fix_and_verify, get_compliance_certificate |
Release workflow |
| Accessibility | get_accessibility_requirements, get_a11y_anti_patterns, suggest_contrast_token, get_component_fix_context |
Accessibility integration for agent-a11y |
Component Implementation:
User: "Implement a button component following the design system"
Claude: [calls get_component with id="button"]
[calls get_variants with component_id="button"]
[implements component]
[calls validate_file to check compliance]
Release Workflow:
User: "Prepare the codebase for release"
Claude: [calls lint_spec to check spec completeness]
[calls run_fix_loop to auto-fix violations]
[calls check_release_gate for go/no-go decision]
"Release approved with score 92/100. Certificate: a3f2c8b1"
See MCP Server Documentation for full details.
dss generate --llm ./DESIGN_CONTEXT.md # LLM context (primary use case)
dss generate --css ./src/index.css # Tailwind v4 @theme block
dss generate --types ./src/lib/types.ts # TypeScript interfaces
dss generate --package ./dist # NPM package with framework presetsGenerate publishable NPM packages with framework-specific outputs:
# Generate package with all targets
dss generate --package ./dist --targets all
# Generate with specific targets
dss generate --package ./dist --targets css,tailwind,shadcn
# Custom scope and name
dss generate --package ./dist --scope @myorg --name tokensAvailable Targets:
| Target | Output | Use Case |
|---|---|---|
css |
CSS custom properties | Vanilla CSS/HTML projects |
tailwind |
Tailwind v4 preset and theme | Tailwind CSS v4+ projects |
shadcn |
ShadCN/UI theme variables | ShadCN/UI component library |
mkdocs-material |
MkDocs Material theme | Documentation sites |
scss |
SCSS variables | Sass/SCSS projects |
json |
Raw JSON tokens | Build tool pipelines |
w3c |
W3C Design Tokens format | Standards-compliant token exchange |
Using Generated Packages:
Tailwind v4:
import tokens from '@myorg/design-tokens/tailwind';
export default {
presets: [tokens],
content: ['./src/**/*.{js,jsx,ts,tsx}'],
};ShadCN:
@import '@myorg/design-tokens/shadcn';MkDocs Material:
extra_css:
- https://unpkg.com/@myorg/design-tokens/mkdocs/theme.css# Generate CSS bindings from themeBindings configuration
dss bind --output ./theme.css
# Generate TypeScript constants
dss bind --format typescript --output ./theme.ts
# Use semantic auto-mapping strategy
dss bind --strategy semantic --output ./theme.css# Show a component's theming contract
dss contract show button
# Validate all theming contracts
dss contract validate✓ Passed:
Button: validated against spec
⚠ Warnings (2):
[no-hardcoded-colors] ./src/components/Card.tsx:45
Hardcoded color '#333' - use CSS variable from design system
[button-accessible-name] ./src/components/IconButton.tsx:12
Icon-only button should have aria-label
Summary: 3 checks (1 passed, 2 warnings, 0 errors)
The generated DESIGN_CONTEXT.md includes:
# My Design System
## Design Principles
- Clarity Over Complexity: ...
## Design Tokens
| Token | Value | Usage |
|-------|-------|-------|
| `primary` | `hsl(222 47% 11%)` | Primary actions and CTAs |
## Components
### Button
**Intent:** Trigger user actions
**Use in:** forms, dialogs, toolbars
**Don't use in:** inline-text, navigation
**Anti-patterns:**
- Multiple primary buttons per view
- Using button for navigation (use Link)
**Examples:**
<Button>Save</Button>
<Button variant="destructive">Delete</Button>This structure is optimized for LLM comprehension and consistent code generation.
DSS supports formal theming contracts between component libraries and consuming applications:
Component Side (themingContract):
{
"themingContract": {
"prefix": "--btn",
"tokens": [
{
"id": "background",
"cssProperty": "--btn-background",
"semantic": "primary",
"defaultLight": "#0066CC",
"defaultDark": "#3399FF"
}
]
}
}Application Side (themeBindings):
{
"themeBindings": [
{
"component": "button",
"mappings": [
{ "from": "brand-primary", "to": "background" }
]
}
]
}Generate CSS:
dss bind --output ./theme.cssSee Theming Specification for details.
Note: Figma integration is for teams transitioning from traditional design workflows. For AI-native development, DSS specs are authored directly—Figma is not required.
For teams that still use Figma:
- Tokens Studio can sync Figma variables ↔ JSON tokens
- Future:
dss import figma/dss export figmacommands
If your workflow is AI-first (specs authored in JSON, UI generated by AI), skip Figma entirely.
DSS defines 9 layers (most projects only need 3):
| Layer | Required | Purpose |
|---|---|---|
| Meta | Yes | Name, version |
| Foundations | Yes | Tokens (colors, typography, spacing) |
| Components | Yes | UI elements with LLM context |
| Principles | No | Design philosophy |
| Patterns | No | Multi-component solutions |
| Templates | No | Page layouts |
| Content | No | Voice & tone |
| Accessibility | No | WCAG requirements |
| Governance | No | Versioning policies |
import dss "github.com/plexusone/design-system-spec/sdk/go"
ds, _ := dss.LoadDesignSystem("./my-design-system/")
ds.Validate()
// Generate for AI context
prompt, _ := ds.GenerateLLMPrompt(dss.DefaultLLMPromptOptions())
// Generate for build
css, _ := ds.GenerateCSS(dss.DefaultCSSOptions())
types, _ := ds.GenerateReactTypes(dss.DefaultReactOptions())Bundle design system specs into binaries using Go's embed package:
import (
"embed"
"io/fs"
dss "github.com/plexusone/design-system-spec/sdk/go"
)
//go:embed spec/*
var specFS embed.FS
func main() {
sub, _ := fs.Sub(specFS, "spec")
ds, _ := dss.LoadDesignSystemFromFS(sub)
// Use ds...
}This enables single-binary distribution for MCP servers and CLI tools.
design-system-spec/
├── cmd/
│ ├── dss/ # CLI tool
│ │ └── cmd/
│ │ ├── generate.go # Generate CSS, TypeScript, LLM
│ │ ├── validate.go # Validate implementations
│ │ ├── lint_spec.go # Spec completeness linting
│ │ ├── bind.go # Theme bindings generation
│ │ ├── contract.go # Theming contract commands
│ │ └── info.go
│ └── dss-mcp/ # MCP server
│ └── main.go # MCP server entry point
├── sdk/go/ # Go SDK
│ ├── loader.go # Load design systems
│ ├── service.go # Service layer for CLI/MCP
│ ├── validate_file.go # File validation logic
│ ├── fix_file.go # Auto-fix violations
│ ├── lint_spec.go # Spec completeness linting
│ ├── compliance.go # Compliance reporting
│ ├── fix_loop.go # Fix-validate loop
│ ├── validators.go # External validator types
│ ├── theming.go # Theming contract types
│ ├── gen_css.go # CSS generator
│ ├── gen_react.go # TypeScript generator
│ ├── gen_llm.go # LLM context generator
│ └── ... # Other generators
├── skills/designsystem/ # MCP skill definition (37 tools)
│ ├── skill.go # Skill interface
│ ├── tools_spec.go # Spec reading tools
│ ├── tools_guidance.go # Guidance tools
│ ├── tools_validate.go # Validation tools
│ ├── tools_fix.go # Fix tools
│ ├── tools_lint.go # Lint tools
│ ├── tools_validators.go # Validator delegation tools
│ ├── tools_compliance.go # Compliance & release tools
│ └── tools_a11y.go # Accessibility integration tools
├── schema/ # JSON Schemas (generated)
├── ui/ # Web component viewer (Lit)
└── docs/ # MkDocs documentation
- Core SDK (9 canonical layers)
- CLI (
generate,validate,info) - Code generators (CSS, TypeScript, LLM)
- Documentation (MkDocs)
- Theming contracts and bindings
- Diagram generators (Mermaid, D2)
- W3C Design Tokens export
- Web component viewer (ui/)
- MCP server for AI assistants (37 tools)
-
dss lint-specfor spec completeness - External validator delegation (WCAG, API style)
- Compliance reporting and release gates
- Fix-validate loop with convergence detection
- Visual regression testing with w3pilot integration
- Evaluation system with rubric-based scoring
- HTML documentation generator with Material Web demos
-
dss initscaffolding - CI/CD GitHub Actions integration
- Color contrast validation
- Figma tokens import/export (for transitioning teams)
MIT