What you’ll learn
Welcome back. In Getting started you ran ds-bridge once and saw a list of findings. This time we’ll slow down and read that list properly — what each finding means, which ones are safe to fix automatically, and how ds-bridge quietly watches your edits so off-system values never sneak in unnoticed.
A quick word for designers and managers reading along: an off-system value is just a color, size, or shadow typed in by hand instead of pulled from the design system. ds-bridge’s job is to spot those and point at the design token that should have been used. Nothing here requires you to write code.
- How to read the three finding kinds — exact, near, and off-system
- Why
--fixonly ever touches exact matches, and why that’s the safe choice - How the editor nudge and the slash command help you triage near-misses
Setup
You’ll need the ds-bridge plugin installed and a project with a design-token file. If that isn’t done yet, Getting started covers install and setup — start there and come back.
# Lint a folder, pointing at your token source explicitly.
ds-bridge lint src --tokens tokens.json
Steps
-
Run the lint and read the summary first. Every run leads with a count and ends with a table grouped by kind. Here is a real run against the sample project that ships with ds-bridge:
7 findings src/Banner.tsx src/Banner.tsx:9:24 exact color: "#3b82f6" — use token color.brand.primary src/Banner.tsx:9:44 near padding: 17 — near token(s): space.md src/Hero.tsx src/Hero.tsx:4:9 off-system color: #ff00aa — no matching token (off-system) src/button.css src/button.css:2:9 exact color: #3b82f6 — use token color.brand.primary src/button.css:3:14 near background: #3a81f5 — near token(s): color.brand.primary, color.base.blue-500 src/button.css:4:11 near padding: 17px — near token(s): space.md src/card.module.css src/card.module.css:6:24 exact box-shadow: #11182733 — use token shadow.card ┌────────────┬───────┐ │ kind │ count │ ├────────────┼───────┤ │ exact │ 3 │ │ near │ 3 │ │ off-system │ 1 │ └────────────┴───────┘ -
Tell the three kinds apart. This is the heart of ds-lint:
- exact — the value is a token, byte for byte.
#3b82f6equalscolor.brand.primary. There is no judgement to make: it should be the token. Safe to rewrite automatically. - near — the value resembles a token but isn’t identical.
#3a81f5is a hair offcolor.brand.primary;17pxis close to the16pxspace.md. A near-miss might be a deliberate one-off, or it might be a typo that should snap to the token — only a human can say. - off-system — nothing in the design system is close.
#ff00aahas no token at all. It’s either a true exception or a sign the system is missing a token.
- exact — the value is a token, byte for byte.
-
Apply only the safe fixes. Re-run with
--fix. ds-bridge rewrites exact matches to avar(--…)reference and leaves everything else exactly as it was:Changed 2 files.Read that carefully — only two files changed, even though there were three exact findings. The third,
box-shadow: #11182733, is a composite token (a shadow with offset and blur), which--fixcan’t safely express as a singlevar(), so it stays put and keeps showing up until you adjust it by hand. After the fix, a re-run confirms the near-misses and off-system value are untouched:src/button.css:3:14 near background: #3a81f5 — near token(s): color.brand.primary, color.base.blue-500 src/button.css:4:11 near padding: 17px — near token(s): space.md src/Hero.tsx:4:9 off-system color: #ff00aa — no matching token (off-system) src/card.module.css:6:24 exact box-shadow: #11182733 — use token shadow.card
Result
You can now read any ds-lint run at a glance: the summary table tells you the
shape of the problem, and each finding’s kind tells you what to do. Exact
matches are mechanical — let --fix handle them. Near-misses and off-system
values are conversations, not corrections.
Two things make this effortless day to day:
- The editor nudge. ds-bridge installs a
PostToolUsehook, so every time Claude Code writes or edits a.css,.scss,.tsx, or.jsxfile, the hook lints just that file in the background. If it finds something, it adds a gentle note to the conversation — for example,ds-bridge: 1 hardcoded design value in button.css: 2:9 #3b82f6 -> color.brand.primary. It never blocks your edit; it just points. - Near-miss triage with the slash command. Run
/ds-bridge:ds-lintand, when near-misses exist, it offers to walk them one at a time: adopt the suggested token, or keep the value as a deliberate exception. You stay in charge of every judgement call.
Next, see how the same token source can drift away from your built CSS in Catching token drift.
Troubleshooting
- No findings at all? Make sure ds-bridge found your token file. Pass it
explicitly with
--tokens path/to/tokens.json, or settoken_sourcein the plugin preferences so every run picks it up automatically. --fixchanged fewer files than I expected? That’s by design — composite tokens like shadows and typography are reported as exact but left for you to apply, because a singlevar()can’t capture all their parts safely.- A value I meant to keep keeps getting flagged? It’s almost certainly a
near or off-system finding, which
--fixnever touches. Leave it; it’s a suggestion, not a requirement.