design-system-extractor
Extract and document a frontend repo's foundation design system (fonts, colors, transitions, layout, spacing, component styles) into a readable DESIGN-SYSTEM.md reference. Use when the user says "extract the design system", "document our design tokens", "what fonts/colors does this app use", "build a design system reference", or "audit our styling".
What this skill does
# Design System Extractor
Scan a frontend repository, discover where design tokens are defined, extract the
actual values in use, and synthesize them into a single human-readable
`DESIGN-SYSTEM.md` reference covering typography, color, spacing/layout,
transitions, elevation, and component styles.
This skill works on any frontend stack. It auto-detects token sources rather than
assuming a framework: Tailwind config, CSS custom properties, SCSS/LESS variables,
CSS-in-JS themes (styled-components, emotion, vanilla-extract, stitches), design-token
JSON, and global stylesheets / font declarations.
## Thinking Process
When activated, follow this structured thinking approach.
### Step 1: Locate the Repo Root and Frontend Surface
**Goal:** Establish the boundary of what you are documenting before scanning.
**Key Questions to Ask:**
- Is the design system in this repo, or a `packages/*` workspace inside a monorepo?
- Is there a dedicated `ui`, `design-system`, or `tokens` package?
- Which directories are source vs. generated (`dist`, `build`, `.next`)?
**Actions:**
1. Confirm the repo root with the user (default: current working directory).
2. If a monorepo, ask whether to scan the whole tree or a specific package.
**Decision Point:** You can state: "I will scan `<root>`, excluding build/vendor output."
### Step 2: Discover Token Sources (Where)
**Goal:** Find every place design decisions are encoded, without assuming a stack.
**Actions:**
1. Run `scan-tokens.sh` against the root.
2. Read the JSON: which source categories are populated
(`tailwind_config`, `css_variables`, `preprocessor_variables`, `css_in_js`,
`token_json`, `global_stylesheets`, `font_definitions`)?
**Thinking Framework:**
- "A populated category tells me the *authoritative* source for that token type."
- "Tailwind config present → colors/spacing/fonts likely live in `theme.extend`."
- "Many `css_variables` files → the system is CSS-custom-property driven."
- "`token_json` present → there may be a single source of truth to read first."
**Decision Point:** You can name the primary token source(s) for this repo.
### Step 3: Extract Raw Values (What)
**Goal:** Quantify which concrete values are actually used, and how often.
**Actions:**
1. Run `extract-values.sh` against the root.
2. Read the frequency-ranked maps for `colors`, `font_families`, `font_sizes`,
`spacing`, `radius`, `transitions`, `shadows`, `z_index`.
**Thinking Framework:**
- "High-frequency values are the real tokens; one-off values are likely drift."
- "Compare extracted values against the declared source from Step 2 — gaps mean
hardcoded values that bypass the token system."
- "A cluster of near-identical colors (#3b82f6, #3a82f5) signals an inconsistency
worth flagging, not documenting as separate tokens."
**Decision Point:** You can distinguish *canonical tokens* from *drift/noise*.
### Step 4: Read the Authoritative Sources Directly
**Goal:** Turn raw frequencies into named, semantic tokens.
**Actions:**
1. Open the top files from Step 2 (e.g. `tailwind.config.js`, `tokens.json`,
`theme.ts`, `:root` blocks) and read the *named* token definitions.
2. Map names → values (e.g. `--color-primary: #3b82f6`, `colors.brand.500`).
**Thinking Framework:**
- "Prefer the author's names over inventing my own."
- "If a value has no name, propose a clear semantic name and mark it as inferred."
**Decision Point:** You have a name→value table per category.
### Step 5: Capture Component Styles
**Goal:** Document recurring component patterns, not just primitives.
**Actions:**
1. Identify component-level style rules (`.btn`, `.card`, styled `Button`, etc.).
2. For each, record the tokens it composes (padding, radius, color, transition).
**Thinking Framework:**
- "A component entry should read as a recipe of foundation tokens."
- "Document the *default* variant; note variants briefly rather than exhaustively."
**Decision Point:** You can list the core components and the tokens they consume.
### Step 6: Synthesize DESIGN-SYSTEM.md
**Goal:** Produce one readable reference, organized by foundation category.
**Sections to emit (in order):**
1. **Overview** — stack detected, primary token source(s).
2. **Typography** — font families, sizes, weights, line-heights.
3. **Color** — named palette with hex swatches in a table.
4. **Spacing & Layout** — spacing scale, container/breakpoint values.
5. **Radius & Elevation** — border-radius scale, shadow tokens.
6. **Motion** — transition durations/easings.
7. **Components** — recipes referencing the tokens above.
8. **Drift & Inconsistencies** — hardcoded/near-duplicate values worth reconciling.
**Thinking Framework:**
- "Every value should trace back to a source file path."
- "Tables over prose for token lists; prose only for guidance."
**Decision Point:** The doc lets a new developer style a feature without grep.
### Step 7: Review with the User
**Goal:** Confirm fidelity before treating the doc as canonical.
**Actions:**
1. Present a summary: # of token sources, # of tokens per category, drift count.
2. Ask whether to write `DESIGN-SYSTEM.md` to the repo root or a chosen path.
**Decision Point:** User confirms the output location and accuracy.
## Usage
```bash
# Step 1: discover WHERE tokens are defined
bash /mnt/skills/user/design-system-extractor/scripts/scan-tokens.sh [repo_root]
# Step 2: extract WHAT values are used, ranked by frequency
bash /mnt/skills/user/design-system-extractor/scripts/extract-values.sh [repo_root]
```
**Arguments:**
- `repo_root` - Path to the frontend repo to scan (defaults to `.`)
**Examples:**
```bash
# Scan the current repo
bash /mnt/skills/user/design-system-extractor/scripts/scan-tokens.sh
# Scan a specific package in a monorepo
bash /mnt/skills/user/design-system-extractor/scripts/scan-tokens.sh ./packages/ui
bash /mnt/skills/user/design-system-extractor/scripts/extract-values.sh ./packages/ui
```
## Output
`scan-tokens.sh` emits JSON listing source files per category:
```json
{
"root": ".",
"tailwind_config": ["tailwind.config.js"],
"css_variables": ["src/styles/globals.css"],
"preprocessor_variables": [],
"css_in_js": ["src/theme.ts"],
"token_json": [],
"global_stylesheets": ["src/styles/globals.css"],
"font_definitions": ["src/styles/globals.css"]
}
```
`extract-values.sh` emits frequency-ranked value maps:
```json
{
"root": ".",
"colors": { "#3b82f6": 5, "#ffffff": 3 },
"font_families": { "Inter, sans-serif": 4 },
"spacing": { "1rem": 7, "0.5rem": 4 },
"transitions": { "all 0.2s ease": 3 }
}
```
## Present Results to User
After running both scripts and reading the authoritative sources, present:
```
Design System Audit — <repo>
Sources detected:
- Tailwind config: tailwind.config.js
- CSS variables: src/styles/globals.css (12 vars)
- CSS-in-JS theme: src/theme.ts
Tokens extracted:
- Typography: 2 families, 6 sizes
- Color: 9 named tokens (+3 near-duplicates flagged)
- Spacing: 8-step scale
- Motion: 3 transitions
Next: write DESIGN-SYSTEM.md to <path>? (y/n)
```
Then generate `DESIGN-SYSTEM.md` following the Step 6 section order.
## Troubleshooting
- **Empty results everywhere** — likely scanning a build output or wrong root.
Re-run pointing at the source package (e.g. `./packages/ui`).
- **Permission denied running the script** — run via `bash <script>` rather than
executing directly, or `chmod +x` the script first.
- **`find` is slow on large monorepos** — the script already prunes
`node_modules`/`.git`/build dirs; narrow the scope by passing a subdirectory.
- **Values look duplicated (#3b82f6 vs #3a82f5)** — this is drift, not an error;
document the canonical one and list the rest under Drift & Inconsistencies.
```
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.