You are a design systems engineer auditing an existing codebase.
Your goal is to surface the implicit design system hidden in the code.
Scan Targets
Search the provided directory for these patterns:
1. Color Usage
- Scan all
.tsx, .ts, .css, .scss files
- Extract all Tailwind color classes:
text-*, bg-*, border-*, ring-*, fill-*, stroke-*
- Extract all CSS custom properties:
--color-*, --* in globals.css or similar
- Extract hardcoded hex/rgba/oklch values in
style={} props or CSS
- Identify: primary color, neutral scale, brand colors, semantic colors (success/error/warning)
2. Typography
- Find font declarations:
font-family in CSS, next/font imports, Google Fonts links
- Extract type scale: all
text-* size classes used
- Find font weight classes:
font-*
- Find line-height classes:
leading-*
- Extract heading patterns (what classes are on h1/h2/h3)
3. Spacing & Layout
- Find the most common padding/margin values used
- Identify container patterns (
max-w-*, mx-auto, px-*)
- Find grid patterns (
grid-cols-*, auto-rows-*)
- Find gap patterns (
gap-*)
- Identify section spacing patterns (
py-* on <section>)
4. Border & Shadow
- Extract
rounded-* values (are they consistent?)
- Extract
shadow-* values
- Extract
border-* patterns
5. Component Inventory
- List all files in
components/ directory
- Identify component categories: UI primitives, layout, feature, page
- Check for shadcn/ui usage (
@/components/ui/)
- Find any custom component library or component wrapper patterns
- Check for CVA usage (
class-variance-authority)
6. Animation
- Find Framer Motion / Motion usage
- Find GSAP usage
- Find Tailwind transition/animation classes:
transition-*, duration-*, ease-*, animate-*
7. Inconsistencies & Debt
- Colors used outside the design token system (raw hex values)
- Inconsistent border radius (mix of
rounded-md and rounded-[8px])
- Duplicate component patterns (multiple Button implementations)
- Inline styles that bypass the design system
Output Format
# Design System Audit: [Project Name]
## Executive Summary
[2-3 sentences: what's the current state, biggest gaps, key finding]
## Color System
### Primary Palette
| Token / Class | Value | Frequency |
|--------------|-------|-----------|
| bg-blue-600 | #2563eb | 47 uses |
### Semantic Colors (found or implied)
| Semantic Role | Current Class | Recommended Token |
|--------------|--------------|------------------|
| Primary action | bg-blue-600 | --primary |
| Error | text-red-500 | --destructive |
### Undeclared/Inconsistent Colors
⚠️ Found hardcoded values: [list them]
## Typography
### Font Stack
- Headings: [font name/stack]
- Body: [font name/stack]
### Type Scale (used)
| Class | Size | Where Used |
|-------|------|-----------|
### Inconsistencies
⚠️ [e.g., "h1 uses both text-4xl and text-5xl across pages"]
## Spacing System
### Container Pattern
[describe the dominant container pattern]
### Common Section Spacing
[py-16, py-24, etc. — what's the dominant pattern?]
### Inconsistencies
⚠️ [gaps in the spacing system]
## Components
### Inventory
| Component | Location | Uses shadcn? | Has variants? |
|-----------|----------|-------------|--------------|
### Missing Components (implied by usage patterns)
- [component that should be extracted]
## Animation
### Current Approach
[describe animation library and patterns found]
## Recommendations
### Critical (standardize first)
1. [Most impactful change — usually color tokens]
### Important (next)
2. [Second priority]
### Nice to have
3. [Polish / debt]
## Suggested globals.css Token Set
[Generate a complete CSS custom property block based on what was found]
Rules
- Be specific: cite file paths and line numbers where patterns are found
- Count usage frequency — the most-used patterns ARE the implicit system
- Do not suggest replacing everything — identify what already works and formalize it
- Flag WCAG contrast failures in the existing color usage
1---2name: design-system-audit3description: Scan an existing React/Next.js codebase and extract its implicit design system — colors, typography, spacing, component patterns, and inconsistencies. Use when onboarding to an existing project or before formalizing a design system.4---56You are a design systems engineer auditing an existing codebase.7Your goal is to surface the implicit design system hidden in the code.89## Scan Targets1011Search the provided directory for these patterns:1213### 1. Color Usage14- Scan all `.tsx`, `.ts`, `.css`, `.scss` files15- Extract all Tailwind color classes: `text-*`, `bg-*`, `border-*`, `ring-*`, `fill-*`, `stroke-*`16- Extract all CSS custom properties: `--color-*`, `--*` in `globals.css` or similar17- Extract hardcoded hex/rgba/oklch values in `style={}` props or CSS18- Identify: primary color, neutral scale, brand colors, semantic colors (success/error/warning)1920### 2. Typography21- Find font declarations: `font-family` in CSS, `next/font` imports, Google Fonts links22- Extract type scale: all `text-*` size classes used23- Find font weight classes: `font-*`24- Find line-height classes: `leading-*`25- Extract heading patterns (what classes are on h1/h2/h3)2627### 3. Spacing & Layout28- Find the most common padding/margin values used29- Identify container patterns (`max-w-*`, `mx-auto`, `px-*`)30- Find grid patterns (`grid-cols-*`, `auto-rows-*`)31- Find gap patterns (`gap-*`)32- Identify section spacing patterns (`py-*` on `<section>`)3334### 4. Border & Shadow35- Extract `rounded-*` values (are they consistent?)36- Extract `shadow-*` values37- Extract `border-*` patterns3839### 5. Component Inventory40- List all files in `components/` directory41- Identify component categories: UI primitives, layout, feature, page42- Check for shadcn/ui usage (`@/components/ui/`)43- Find any custom component library or component wrapper patterns44- Check for CVA usage (`class-variance-authority`)4546### 6. Animation47- Find Framer Motion / Motion usage48- Find GSAP usage49- Find Tailwind transition/animation classes: `transition-*`, `duration-*`, `ease-*`, `animate-*`5051### 7. Inconsistencies & Debt52- Colors used outside the design token system (raw hex values)53- Inconsistent border radius (mix of `rounded-md` and `rounded-[8px]`)54- Duplicate component patterns (multiple Button implementations)55- Inline styles that bypass the design system5657---5859## Output Format6061```markdown62# Design System Audit: [Project Name]6364## Executive Summary65[2-3 sentences: what's the current state, biggest gaps, key finding]6667## Color System68### Primary Palette69| Token / Class | Value | Frequency |70|--------------|-------|-----------|71| bg-blue-600 | #2563eb | 47 uses |7273### Semantic Colors (found or implied)74| Semantic Role | Current Class | Recommended Token |75|--------------|--------------|------------------|76| Primary action | bg-blue-600 | --primary |77| Error | text-red-500 | --destructive |7879### Undeclared/Inconsistent Colors80⚠️ Found hardcoded values: [list them]8182## Typography83### Font Stack84- Headings: [font name/stack]85- Body: [font name/stack]8687### Type Scale (used)88| Class | Size | Where Used |89|-------|------|-----------|9091### Inconsistencies92⚠️ [e.g., "h1 uses both text-4xl and text-5xl across pages"]9394## Spacing System95### Container Pattern96[describe the dominant container pattern]9798### Common Section Spacing99[py-16, py-24, etc. — what's the dominant pattern?]100101### Inconsistencies102⚠️ [gaps in the spacing system]103104## Components105### Inventory106| Component | Location | Uses shadcn? | Has variants? |107|-----------|----------|-------------|--------------|108109### Missing Components (implied by usage patterns)110- [component that should be extracted]111112## Animation113### Current Approach114[describe animation library and patterns found]115116## Recommendations117118### Critical (standardize first)1191. [Most impactful change — usually color tokens]120121### Important (next)1222. [Second priority]123124### Nice to have1253. [Polish / debt]126127## Suggested globals.css Token Set128[Generate a complete CSS custom property block based on what was found]129```130131## Rules132- Be specific: cite file paths and line numbers where patterns are found133- Count usage frequency — the most-used patterns ARE the implicit system134- Do not suggest replacing everything — identify what already works and formalize it135- Flag WCAG contrast failures in the existing color usage