Style guide builder
Goal
Document the design system that actually shipped, not the one people think they have. The result is a guide of observed tokens and patterns, plus a list of inconsistencies to resolve.
When to use
- The user has a codebase with no design documentation.
- A redesign or new contributor needs the current values written down.
- To create a new palette or font set from scratch, use
use_skillwithcolor-palette-builderortypography-pairing. - For brand voice and logo rules aimed at non-developers, use
use_skillwithbrand-guidelines-outline.
Steps
- Locate the style sources with
lsandrg: theme files, CSS variables, Tailwind config, token JSON, component libraries and global stylesheets. Useexplorefor a large project and ask for the area that matters. - Extract colors. Search for hex, rgb, hsl and named values. Count how often each appears with
run_command, and separate tokens (defined once, referenced) from raw literals in components. - Extract type: font families, sizes, weights, line heights. Extract spacing values, border radii, shadows, z-index layers, breakpoints and motion durations the same way.
- Group near duplicates (for example
#333and#343434, or 15px and 16px) and propose the one to keep. Do not merge them in code unless asked. - Read three to five core components (button, input, card, modal, nav) with
read_fileand note variants, states and the tokens they use. - Write the guide with
create_fileasSTYLE-GUIDE.md: tokens as tables with name, value and usage count, component rules, and a final "Inconsistencies" section with file and line references. - Offer next steps rather than doing them: consolidate tokens, add a lint rule, or generate a CSS variables file.
- Verify two or three numbers in the guide by hand: pick a token, run
rgfor it, and confirm the count and usage match what you wrote. - If a design file such as a Figma export or a style sheet exists, compare it with the code and list where the two disagree.
Gotchas
- Counting raw values includes vendored libraries and build output. Exclude
node_modules,distand generated files. - A value used once is not a token. List it under one-offs.
- Dark mode and themes may redefine the same names. Capture each theme.
- Inline styles and CSS-in-JS can hide values from simple searches. Search component files too.
- Do not invent names for tokens that have none. Mark them as unnamed and suggest names separately.
- Computed values (calc, color-mix, clamp) do not appear as literals. Record the formula, not a guessed result.
- Generated files get regenerated. Point the guide at the source of truth, not at the output.
Output
- A line on how counts were verified.
STYLE-GUIDE.mdwith token tables, component notes and an inconsistency list.- The three highest-value cleanups, one line each.
- Which folders were scanned and which were skipped.
