---
name: auditing-design-system-conformance
description: Audits generated or edited UI against a design system and reports what drifted — components invented rather than imported, literal values where tokens exist, deprecated APIs, and unmet accessibility preconditions. Use after generating UI, before opening a pull request, when reviewing a diff that touches components or styles, or when the user asks whether code follows the design system. Applies as the verification step for any UI generation task.
license: CC0-1.0
---

# Auditing design system conformance

None of the teams doing this well trust generation. They check it mechanically
and make the agent fix what fails. This skill is that check.

Run it on your own output before you claim a task is done.

## Fill this in first

- Package: `{{@scope/design-system}}`
- Allow-list source: `{{npm run components:list}}`
- Token source: `{{tokens/tokens.json}}`
- Deterministic gates: `{{pnpm typecheck && pnpm lint}}`

## The six checks

Work through all six. Report each as pass or fail with the specific line,
not as a summary judgement. The first five audit a diff; the sixth audits
the system the diff is written against.

### 1. Invented components

Every component rendered in the diff must appear in the allow-list.

```
rg "<[A-Z][A-Za-z0-9]*" -o --no-filename {{changed files}} | sort -u
```

Compare against the allow-list. Anything not on it is invented. Flag it with
the file and line — do not quietly substitute something else.

### 2. Literal values where tokens exist

```
rg "#[0-9a-fA-F]{3,8}\b|\b\d+px\b|rgba?\(" {{changed files}}
```

Every hit is a finding unless it is inside a token definition file itself.

### 3. Deprecated APIs

Cross-check every imported symbol against the deprecation table. Report the
replacement, not just the violation.

### 4. Accessibility preconditions

Run the linter, then read for the things it cannot see. Load the
semantic-accessibility skill for that pass — a green axe run on generated UI
is close to meaningless on its own.

### 5. Duplicate components

For each new component in the diff, search the existing library for something
that does the same job. "Does something like this already exist?" is the
question no shipped tool answers, and it is where the drift comes from.

### 6. System-level signals

A diff can conform perfectly to a design system that an agent still cannot
find. Once per audit, score the system itself against the five Agent-Ready
signals — llms.txt, a CLI-installable registry, DTCG tokens, an MCP server,
Figma Code Connect — from its docs origin and its repository:

```
curl -s -X POST https://www.designsystems.one/api/agent-ready-check \
  -H "Content-Type: application/json" \
  -d '{"url":"{{https://docs.example.com}}","repo":"{{owner/repo}}"}' \
  | jq '{score, checks}'
```

Read the evidence, not the score. Two signals are settled either way from
the repository tree, because they are files: a `no` on Code Connect or DTCG
carries the number of tracked files it was proven against. The other three
are what the site serves and are only ever proved present. Report every
`no` as a finding with its evidence string; report `unknown` as unknown,
never as a pass.

## Report shape

One table. Findings first, most severe first. No prose preamble.

| Check | File:line | Found | Expected |
|---|---|---|---|
| Invented component | `Card.tsx:42` | `Stack` | not in the system — use `{{layout primitive}}` |
| Literal value | `Card.tsx:58` | `#2563EB` | `var(--color-action-primary)` |
| System signal | `{{owner/repo}}` | Code Connect: no, 4,180 files | mapping files beside the components |

If everything passes, say so in one line and stop. Do not pad a clean audit.

## Keep the LLM out of the enforcement path

This skill is advisory. The merge-blocking check must stay deterministic —
typecheck, lint, the token rule. Meta draws this line explicitly in Astryx and
it is the right one: an agent that both writes and approves the code has no
independent signal in it.
