Design Contract
The design contract is automatically activated for any project with a web platform.
It specifies the design system, typography, color architecture, component library,
spacing rules, and animation standards. The Discovery Agent writes
artifacts/discovery/design-contract.md. The Verifier measures conformance in Phase 7.
The Discovery Agent produces design-contract.md automatically for any project with a Next.js or web platform. The Builder loads it at the start of every UI task. The Verifier scores conformance in Phase 7.
Default Design System
Unless the project brief specifies otherwise, web projects use this default stack:
| Element | Default |
|---|---|
| Primary font | Inter (variable, 400â800 weight) |
| Mono font | JetBrains Mono |
| CSS framework | Tailwind CSS v4 |
| Component library | shadcn/ui (Radix UI primitives) |
| Animation | Framer Motion ^11 |
| Icons | Lucide React |
| Color system | CSS custom properties with HSL values |
Color Architecture
All colors are defined as CSS custom properties. The Builder never hardcodes hex values in components â always uses semantic tokens:
/* globals.css */
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--primary: 221.2 83.2% 53.3%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--border: 214.3 31.8% 91.4%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
/* ... dark mode tokens */
}
Typography Scale
| Role | Size | Weight | Usage |
|---|---|---|---|
| Display | 3rem / 48px | 800 | Hero headings only |
| H1 | 2.25rem / 36px | 700 | Page titles |
| H2 | 1.875rem / 30px | 600 | Section headings |
| H3 | 1.5rem / 24px | 600 | Subsection headings |
| Body | 1rem / 16px | 400 | Body text, line-height 1.75 |
| Small | 0.875rem / 14px | 400 | Captions, labels |
| Mono | 0.875rem / 14px | 400â500 | Code, technical values |
Spacing System
All spacing uses the Tailwind 4-unit (16px base) scale. The Builder never uses arbitrary pixel values in layout components:
- Section padding:
py-16 px-6(mobile) âpy-24 px-8(desktop) - Card padding:
p-4(compact) |p-6(standard) |p-8(spacious) - Stack gap:
gap-2(tight) |gap-4(standard) |gap-8(loose) - Max content width:
max-w-6xl mx-auto
shadcn/ui Component Usage Rules
The Builder uses shadcn/ui primitives before building custom components. New custom components must not duplicate shadcn functionality.
| Need | Use |
|---|---|
| Modal / dialog | <Dialog> |
| Dropdown | <DropdownMenu> |
| Select input | <Select> |
| Date picker | <Calendar> + <Popover> |
| Toast / notification | <Sonner> (via sonner library) |
| Form | <Form> (React Hook Form + Zod) |
| Table | <Table> (or @tanstack/react-table for complex grids) |
| Navigation tabs | <Tabs> |
| Contextual menu | <ContextMenu> |
Animation Rules
- Micro-interactions: 150â200ms, ease-out. Used for hover states, focus rings, button presses.
- Page transitions: 300â400ms, spring physics. Used for route changes and modal opens.
- Content reveals: 500â600ms, staggered when multiple elements. Used for list items, cards appearing on scroll.
- Loading states: Skeleton placeholders (not spinners) for content loading >300ms.
- Reduced motion: All animations must respect
prefers-reduced-motion. Use Framer Motion'suseReducedMotion()hook.
Responsive Breakpoints
| Breakpoint | Width | Target devices |
|---|---|---|
sm: | 640px+ | Large phones, small tablets |
md: | 768px+ | Tablets |
lg: | 1024px+ | Laptops |
xl: | 1280px+ | Desktops |
2xl: | 1536px+ | Wide desktops |
Visual regression baselines are captured at: 390px (mobile), 768px (tablet), 1024px (laptop), 1440px (desktop).
Verifier Design Contract Score
Phase 7 of the Verifier measures design contract conformance. Score is 0â100. Below 80 is a CONDITIONAL flag; below 60 is a RESTYLE recommendation to the Critic.
| Check | Weight |
|---|---|
| Font stack correct (Inter primary, JetBrains Mono) | 10% |
| Color tokens used (no hardcoded hex in components) | 20% |
| shadcn/ui components used for standard UI patterns | 20% |
| Spacing follows 4-unit scale (no arbitrary px values) | 15% |
| All interactive elements have focus-visible states | 15% |
| Dark mode tokens implemented and functional | 10% |
| Reduced motion respected | 10% |