Help
How it works
onsystem reads the design system from source into one model, then checks UI code against it in three places: the Claude Code hook after every edit, check_ui when an agent asks, and onsystem check in CI. Everything is static analysis: no model calls, no API key, and no network requests of its own: installed in the project, it runs offline, and through npx only npm contacts the registry (when).
Your design system
Components
- components/ui/*.tsx
Tokens
- globals.css
- *.tokens.json (DTCG)
Docs
- docs/*.md, *.mdx
Config (optional)
- onsystem.config
Extract
TypeScript checker
- props, defaults, JSDoc
cva() / tv() parser
- variants and classes
Token parsers
- DTCG · CSS vars · @theme
Docs parser
- guidelines, examples
Model
Design-system model
- components, tokens, docs; cached on disk, rebuilt on change
BM25 index
intent search
Token index
nearest color, OKLCH
Lint rules
8 rules, with fixes
Interfaces
MCP server · stdio
- list_components
- get_component
- search_components
- get_tokens
- check_ui
- ds://tokens
- ds://components/{name}
Hook · CLI · CI
- Claude Code hook
- onsystem check
- --format github
Clients: Claude Code · Cursor · VS Code · any MCP client, and CI (GitHub annotations, exit codes)
Components. One TypeScript program over the component files, with the project's
tsconfig(so path aliases and dependency types resolve). For each exported PascalCase function,forwardRef,memoor class component, and each alias of a library component (const Dialog = DialogPrimitive.Root), the checker gives the props type. Props declared in the project, or by packages such as Radix, are listed with types, required flags, defaults (from destructuring,@defaultordefaultVariants) and JSDoc. React's DOM attributes are summarised as "…plus 290 props fromReact.ComponentProps<"button">" but kept in full for linting. When dependency types are missing, extraction falls back to what resolves and marks the props as open, so the linter does not guess.Variants.
cva()andtv()calls are read from the AST: values in declaration order, defaults, per-value classes and compound variants. They are linked to a component throughVariantProps<typeof x>or a call in the className of the element it returns; a definition used further in (a spinner'sloaderVariants) only adds the variants the component's own lack and that it takes as props. Without either, a call anywhere in its body links it. Boolean keys named like a render state (isDisabled,isPending, as React Aria's starter passesrenderPropstotv()) style a state rather than offer a variant, so they are not listed as variants, and a key declared by two linked definitions is listed once.Composition. Flat parts (
CardHeadernext toCardincard.tsx, but not a lone container such asCheckboxGroupnext toCheckbox), static members (Card.Header = CardHeader) andObject.assign(Root, { List })(members exported or not, shorthand included) become parent/part relationships. The wrapped native element comes fromComponentProps<"button">,ButtonHTMLAttributes<HTMLButtonElement>, theforwardRefelement type, or the rendered JSX (includingconst Comp = asChild ? Slot : "button").Published libraries. An app built on a component library installed from npm (MUI for now) has its design system in
node_modules. The same checker reads the library's type declarations, the files the app's own imports resolve to, together with the app's module augmentations: each exported component with the props of each of its signatures, string-literal values as variants, and the element it renders. Tokens come from the theme the app creates, where its values are written out. The project's own components win a shared name (details). A design-system package installed with compiled code and.d.tsfiles, whose component sources the app does not read (dist/alone, orsrc/besideexportsintodist/), is read the same way: one that declares its config (design-system packages); without one, one named like a design system in the app's own npm scope (@acme/uifor@acme/web); or, in any app, the dependency its config names asimportPath("importPath": "@dub/ui"). Its declarations give the components and their props,cvavariants as tsc and tsup emit them, parts and the elements they render; a package with no entry of its own is read from each subpath it exports (@acme/ui/button). Tokens come from its config or the stylesheets the app imports from it.Model. Components, tokens and docs form one JSON model, cached in
node_modules/.cache/onsystemand keyed on the sizes and mtimes of the component, token and docs files, the project files the components import and the tsconfig chain, plus the lockfile, the config and the package version. The server answersserver/discoverand theinitializehandshake immediately and loads in the background; requests wait for the load. List results carry 2026-07-28 cache hints: the tools, prompts and resource templates for an hour, the component resources not at all, both private to the client. File changes trigger a rebuild that reuses the previous TypeScript program, an edited config file is read again, and clients are notified that resources changed.Lint.
check_uiparses the snippet on its own (no type-checking), resolves each JSX tag through its imports (named, default, namespace, relative, and barrels such as@/components/uior../components/ui) to a design-system component, and runs the rules against the model. Fixes are text edits with offsets, so an agent or a tool can apply them mechanically.
On real codebases
Link to the section On real codebasesRun as is, with no config, on public apps: the counts the corpus snapshot records, rechecked on every pull request that changes the rules. These counts are not a judgement of the teams: hardcoded values and unlabeled icon buttons slip through review everywhere, and agents copy what they see.
vercel/ai-chatbot
c2f8235- Found with zero config
components.json→ 23 components, 52 tokenscheckfindings- 73 in
app/andcomponents/: 41 raw colors, 19 native elements the design system wraps, 12 icon-only buttons without an accessible name, 1 arbitrary radius
midday
5158731,apps/dashboard- Found with zero config
- workspace package
@midday/ui→ 79 components checkfindings- 1,340 in
src/, including 98 icon-only buttons without an accessible name. Adopted with a baseline
shadcn/ui website
0132174- Found with zero config
- custom
uialias → 68 components checkfindings- 124 in
app/andcomponents/, mostly raw colors (105)
| Project | Found with zero config | check findings |
|---|---|---|
vercel/ai-chatbot c2f8235 | components.json → 23 components, 52 tokens | 73 in app/ and components/: 41 raw colors, 19 native elements the design system wraps, 12 icon-only buttons without an accessible name, 1 arbitrary radius |
midday 5158731, apps/dashboard | workspace package @midday/ui → 79 components | 1,340 in src/, including 98 icon-only buttons without an accessible name. Adopted with a baseline |
shadcn/ui website 0132174 | custom ui alias → 68 components | 124 in app/ and components/, mostly raw colors (105) |
Performance and footprint
Link to the section Performance and footprintReading the design system is the slow part: one TypeScript program over the component files. check and the server cache what they read and read it again only when those files change, so checking a file after that is syntax work. The hook runs one check per edit to a UI file. Without onsystem installed in the project, it runs check through npx on the first edit in a project, which starts npm first; later edits there run the CLI npx installed with Node.js directly (how). A dev dependency (pin the version) takes npm out of the first edit too.
Measured with onsystem 0.11.0 on Apple M1 Max (10 cores, 32 GB), macOS 27.0.1, Node.js 24.18.0, on 2026-10-29, with node scripts/perf.mjs: each time is the median of 5 runs. The corpus checkouts have no node_modules, so the types of the libraries their components wrap are not read: in a project with its dependencies installed, reading the design system takes longer. The demo, where the hook is measured, has its dependencies installed.
checkon vercel/chatbotc2f8235(appandcomponents: 61 files)- Result
- 0.51 s, or 0.80 s with
--no-cache. One file: 347 ms, then 2.6 ms for each other file
checkon midday-ai/midday5158731(apps/dashboard/src: 569 files)- Result
- 1.35 s, or 1.68 s with
--no-cache. One file: 465 ms, then 1.6 ms for each other file
The Claude Code hook on one edit (the demo's
app/settings/danger-zone.tsx), with onsystem installed in the project- Result
- 364 ms
The same edit through npx, as the plugin runs it in a project without an install (
onsystem@0.11.0in npm's cache)- Result
- 1.14 s
The MCP server on midday-ai/midday
5158731(apps/dashboard, 79 components):initializeanswered- Result
- 422 ms after it starts
Its first tool call, which waits for the design system to be read (
--no-cache)- Result
- 0.80 s after it starts
check_uion the app's largest file (1,349 lines)- Result
- 13 ms
search_components,get_component(Button)- Result
- 0.5 ms, 0.4 ms
The package (
onsystem@0.11.0on npm)- Result
- 0.9 MB unpacked, 16 files, 8 dependencies
Installed with npm into an empty project
- Result
- 15 packages, 42.2 MB on disk (24.3 MB of it TypeScript, which reads the components)
Provenance
- Result
- Signed npm provenance (slsa.dev/provenance/v1): npm shows the workflow run and commit each release was built from
| Measured | Result |
|---|---|
check on vercel/chatbot c2f8235 (app and components: 61 files) | 0.51 s, or 0.80 s with --no-cache. One file: 347 ms, then 2.6 ms for each other file |
check on midday-ai/midday 5158731 (apps/dashboard/src: 569 files) | 1.35 s, or 1.68 s with --no-cache. One file: 465 ms, then 1.6 ms for each other file |
The Claude Code hook on one edit (the demo's app/settings/danger-zone.tsx), with onsystem installed in the project | 364 ms |
The same edit through npx, as the plugin runs it in a project without an install (onsystem@0.11.0 in npm's cache) | 1.14 s |
The MCP server on midday-ai/midday 5158731 (apps/dashboard, 79 components): initialize answered | 422 ms after it starts |
Its first tool call, which waits for the design system to be read (--no-cache) | 0.80 s after it starts |
check_ui on the app's largest file (1,349 lines) | 13 ms |
search_components, get_component (Button) | 0.5 ms, 0.4 ms |
The package (onsystem@0.11.0 on npm) | 0.9 MB unpacked, 16 files, 8 dependencies |
| Installed with npm into an empty project | 15 packages, 42.2 MB on disk (24.3 MB of it TypeScript, which reads the components) |
| Provenance | Signed npm provenance (slsa.dev/provenance/v1): npm shows the workflow run and commit each release was built from |
How it compares
Link to the section How it comparesThese tools work at different layers, and several combine well:
onsystem
- What it knows
- Your components' props,
cvavariants, parts, tokens and docs, read from source - Checks what the agent wrote
- Hardcoded colors, spacing and radius; native elements the design system wraps; components, props and variants it lacks; icon buttons without a name
- Needs
- Nothing to run or write: zero config for shadcn-style projects (Tailwind v3 or v4) and design-system packages
- What it knows
- Your components, variants and theme, found through
components.jsonin shadcn/ui projects, plus per-component contracts you can write - Checks what the agent wrote
- Tailwind classes: restyling a component, raw colors, arbitrary values, inline styles, unknown and dynamic classes
- Needs
- ESLint 9.30+ or Oxlint, Tailwind v4; React, Svelte or Vue
- What it knows
- Stories and a component manifest
- Checks what the agent wrote
- Runs component tests, including accessibility checks if set up
- Needs
- A running Storybook (10.6, preview)
- What it knows
- Registries: what you can install
- Checks what the agent wrote
- —
- Needs
- —
- What it knows
- The design: frames, variables, Code Connect
- Checks what the agent wrote
- —
- Needs
- Figma
| Tool | What it knows | Checks what the agent wrote | Needs |
|---|---|---|---|
| onsystem | Your components' props, cva variants, parts, tokens and docs, read from source | Hardcoded colors, spacing and radius; native elements the design system wraps; components, props and variants it lacks; icon buttons without a name | Nothing to run or write: zero config for shadcn-style projects (Tailwind v3 or v4) and design-system packages |
| @shadcn/lint | Your components, variants and theme, found through components.json in shadcn/ui projects, plus per-component contracts you can write | Tailwind classes: restyling a component, raw colors, arbitrary values, inline styles, unknown and dynamic classes | ESLint 9.30+ or Oxlint, Tailwind v4; React, Svelte or Vue |
| Storybook MCP | Stories and a component manifest | Runs component tests, including accessibility checks if set up | A running Storybook (10.6, preview) |
| shadcn MCP | Registries: what you can install | — | — |
| Figma MCP | The design: frames, variables, Code Connect | — | Figma |
@shadcn/lint is a linter: it polices the classes written against a component and the theme, in React, Svelte and Vue, on Tailwind v4. onsystem gives the agent the components, props, variants and tokens before it writes, and catches what does not exist (components, props, variant values) along with native elements and missing accessible names, on Tailwind v3 or v4, without Storybook or a design file. Running both in CI is a sensible setup.
Design decisions
Link to the section Design decisionsStatic analysis, not another model. The agent is already the LLM; what it lacks is ground truth. Everything here is deterministic, checks a file in milliseconds once the design system is read (measured), makes no network requests, needs no API key, and can be unit-tested rule by rule. The cost: it cannot judge intent, such as whether a Dialog was the right call. That stays with the agent and the reviewer.
The TypeScript checker over react-docgen-typescript. react-docgen-typescript wraps the same API but hides the AST, and cva() parsing, composition and element inference all need it. One program serves all four. The runtime dependency is TypeScript 6, the last release with the JavaScript compiler API; TypeScript 7 (the Go port) does not expose a stable one yet.
Syntactic linting. Agents check fragments they have not saved, often without imports. Type-checking those would need the whole program and would fail on the fragment's missing context. check_ui complements tsc: it catches what types cannot express (tokens, native elements, accessible names) and says what to write instead.
BM25, not embeddings. A design system is tens to a few hundred documents whose vocabulary already lives in names, docs and variant values. Field-weighted BM25 with Porter stemming and a small synonym map ("modal" → Dialog, "delete" → destructive) ranks them well, deterministically, with no model download or API key. It does not understand paraphrases the synonym map does not cover.
OKLCH for nearest colors. Distance in OKLCH (ΔE in OKLab) tracks perceived difference, so the suggested token is the one that looks closest, not the one with the closest hex digits. It also matches how Tailwind v4 and shadcn/ui define colors.
Markdown for the model, JSON for programs. Tool results put compact Markdown in content, which costs fewer tokens than JSON and reads well to a model, and the full JSON in structuredContent for clients and scripts.
React only (
.tsxand.jsx): no Vue, Svelte or Angular yet.Styling is checked in Tailwind classes,
styleobjects (including style functions and each branch of a conditional value) and color attributes. CSS-in-JS (styled-components, Emotion), CSS Modules and plain stylesheets are not.Fix suggestions are Tailwind classes when a Tailwind theme maps the token (
@theme, or a v3tailwind.config), otherwisevar(--token)(hsl(var(--token))orrgb(var(--token))for v3 channels). A v3 config is read without running it, so colors computed in code are not seen.Colors are compared in the base theme and, for
dark:classes, the dark mode. Other modes ([data-theme="brand"]) are listed byget_tokensbut not used to match.Linting is per file and syntactic. Class names built at runtime (
`bg-${color}-500`) are not checked, and spread props are trusted. Class strings are read inclassName,classand the arguments ofcn,clsx,cvaand the like, and followed to aconst, aconstobject map (className={statusStyles[status]}) or a function of the same file; one from another file, a parameter or aletis not followed, nor are classes in other props (tw).no-unknown-propis skipped for components whose props type does not fully resolve (dependencies not installed, whichcheck,check_uiandinspectthen say).Composition is inferred from naming and static members; other patterns need explicit exports.
A UI package imported by path is read from what the app already imports (in its first 5,000 source files), so components nobody imports yet are not offered.
While the server runs, it rebuilds on changes in the component, token and docs folders, the config file, the tsconfig and the tsconfigs it extends. An edit to another file the components import (a shared
lib/types.ts), or to an MUI theme or module augmentation, is picked up on the next start.At a monorepo root, the server reads the list of projects when it starts; a package that gains a design system while it runs is listed from the next start, though its files are checked by it right away.
A design-system package published without its component sources is read from its type declarations only when it declares its config, is named like a design system in the app's own scope, or is the app's
importPath: a kit from another scope named like one (@sanity/ui,@react-email/components) is not taken for the app's design system unless the app's config says so, andinspect --explainsays what would make such a dependency read. Declarations carry no classes, so its components' classes and CSS variables are not known. A package whose.tsxsources the app reads (through its config'scomponents, orexportsthat point at them) is read from those sources alone. A bundle's oneindex.d.tsdeclares every component in one file, so parts go by name only in families of two or more (CardHeaderandCardContentnext toCard, notButtonTooltipnext toButton), and icons have none. A package with an entry of its own is read from that entry alone, not its other subpaths.Published libraries: MUI (
@mui/material) only so far; Chakra UI, Mantine, HeroUI, Radix Themes and Ant Design are not read yet (inspectlists them on itslibraryline, andchecksays so in a project without components of its own), nor are MUI's other packages (@mui/lab,@mui/x-*). MUI'ssxandstyled()styles are not checked for hardcoded values. Its theme is read where its values are written out; a palette computed in code or from Sass variables is not, sono-hardcoded-colordoes not run on such an app.--require-design-system(and the GitHub Action, where it is on by default) still passes it, since MUI's components are its design system, and says that the rule did not run. In a JavaScript app, values a computed theme adds beyond palette groups andvariantswritten out are not known and can be reported.No typography or shadow rules yet, and stdio is the only transport.
Last updated