For coding agents

Docs

This page is written for a coding agent working in a user's app, and for the person who runs it. The short version: DS source supports React apps only for now. The design system goes into an app through the UI kit, which one command writes. Do not copy colours, CSS variables, token values or component source from this site, an export or a tool answer into the app by hand.

How to use it

In the React app's folder, run:

npx designsource add --yes

It writes the theme and the UI kit components, installs their libraries and names the folder to import them from. Then restyle the app's screens with those components, and run npx designsource check to see what still bypasses the kit: hardcoded colours, hand-built controls, your own copies of kit components. It needs no token and writes nothing.

add also keeps the kit's rules for coding agents in the app's AGENTS.md (and CLAUDE.md), between designsource:rules markers. Follow them, and write your own notes outside the markers.

If it prints this line, stop:

No design system is connected to this folder. Ask the user to run npx designsource in a terminal in this folder, then run this command again. Do not paste a project token into a command.

Ask the user to run npx designsource in a terminal in that folder, then run add again. Never ask for the project token, and never put one in a command.

With the MCP server, the order is the same:

  1. If the folder has no design system yet, call create_design_system, or use_design_system to pick one the user already has.
  2. Call add_ui_kit. It writes the same files add does.
  3. Restyle the app with the components it added.
  4. Call check_design_system, fix what it lists, and call it again.

Call get_integration_guide for the full steps.

React only for now

DS source supports React apps only for now. Vue, Svelte, Angular and plain CSS are not supported yet. Check package.json first. If the app is not a React app, stop and tell the user it is not supported yet. Do not port the components, and do not apply the tokens by hand: a hand-built copy does not update when the design system changes.

The kit also needs React 19 and TypeScript; add says so in one line when an app has neither.

--yes and --force

  • --yes asks nothing: every component, the theme and the /design-system section, your edits kept. It never reads a token from the keyboard, so it cannot hang waiting for one. Agents pass it.
  • --force replaces files designsource did not write, and components the user edited. If add says a file would be replaced, ask the user before running it again with --force.

How it works

The kit is the 62 components the workbench preview renders, as source files in the app, painted by the design system's theme. Each file carries a stamp, so a later add refreshes the theme and every component the user did not edit. Values copied by hand have no stamp: they drift the first time the design system changes, and nothing tells them apart from the app's own code.

add needs the project token, and it finds one with no prompt in two safe ways:

  1. The user ran npx designsource or npx designsource connect in a terminal in this folder once. That saves the token, or an account link, for the folder. Every later add in the folder finds it, the agent's included.
  2. DS_SYNC_TOKEN is set in the environment the agent runs in, from the shell profile or a CI secret store. The user sets it there; it is never typed into a command.

Typing --token <value> or DS_SYNC_TOKEN=<value> npx … puts the token in the agent's transcript, so an agent never does either. npx designsource itself signs the user in, so it runs only in a terminal: an agent cannot run it for them.

The MCP server states the same order when a client connects. Its readers (get_tokens, get_css_variables, get_shadcn_theme, get_component_source) still answer, and add one line when the folder is not ready for the values: a React app without the kit is told to call add_ui_kit, and an app that is not React is told it is not supported yet.

What can go wrong

  • The keychain cannot be read from a sandboxed shell. On macOS the token lives in the login keychain, and on Linux in the Secret Service. A sandboxed agent shell may be denied them, so add says the token is in the keychain and cannot be read here. Ask the user to run npx designsource --store file in a terminal in the folder once: it moves the token into a private file only they can read, which the agent's shell can read.
  • Exports need Pro: the project owner's account is on Free.
  • add stops on a file it did not write: ask the user, then run again with --force only if they agree.