DesignersDevelopmentMedium60 min

MCP use case: Auditing every pull request against your design system

Every pull request gets an AI review against your zeroheight guidelines, with each finding linked to the page that backs it

What it is

How do you know whether the code going into production actually follows the design system? Most teams find out after the fact, in a QA pass, an audit a few months later, or when someone spots two primary buttons sitting next to each other on a live page.

This use case moves that check to the moment the code is written. A CI job runs on every pull request, takes the lines that changed, and hands them to a model along with read-only tools for your styleguide: pages from the zeroheight MCP, and tokens from the zeroheight API. The model reads the relevant component pages (the For Agents rules, usage guidance, content guidelines, accessibility notes), matches any hardcoded values against your token set, and returns a report. The script makes every zeroheight call itself, so your zeroheight credentials never leave the CI runner, and it checks every token reference the change adds before the model even starts. It then posts the report on the pull request: one summary comment that updates on every push, and an inline comment per finding, with a one-click suggestion where the fix is a straight swap.

Every finding has to cite a zeroheight page or it gets thrown away. The review is based on your own documentation applied to the code in front of it (which also means it’s only as good as what your docs actually say…).

Benefits

  • Feedback while it’s still cheap to fix. The author sees “Button MUST NOT navigate, use Link” while the branch is open, not in a design QA ticket two sprints later.
  • Reviews grounded in your docs. Every comment links to the page it comes from, so a reviewer can check the source in one click and the conversation stays about your rules.
  • Token drift gets caught as it happens. Hardcoded colors, spacing and radii with an exact token match get flagged with the token name. So do token references that don’t exist, which otherwise just fall back to nothing.
  • Your docs get a feedback loop. When the audit misses something or gets it wrong, it’s usually because a page is vague. In our testing it also flagged real gaps, like a component with no way to pass an accessible name.
  • It fits the stack you have. Same audit on GitHub, GitLab or Bitbucket, with whichever model provider your organization already pays for.

Pitfalls

  • Vague docs give vague reviews. If a rule only exists in someone’s head, or in a paragraph of prose, the audit will miss it. Component pages with a For Agents section listing hard rules as MUST / MUST NOT bullets make the biggest difference.
  • It’s a reviewer, not a gate (at first). Start with comments only. Once the team trusts the findings, you can set failOn to must and make the check required. Turning blocking on from day one tends to get the whole thing switched off.
  • Keep the API token narrow. Give the zeroheight API token only the page:read and token_set:read scopes, and keep it in CI secrets, never in the repo. With just those scopes it can read your docs but can’t change anything. It also acts as the person who created it, so use someone who can see the styleguide and token set.
  • Forks don’t get secrets. On all three platforms, pull requests from forks can’t read the zeroheight token or the model key, so open-source repos need a maintainer to run it.
  • It won’t say exactly the same thing twice. The rules it enforces stay put, but run it on the same pull request twice and the borderline calls move around. In our testing, one hand-built banner came back as a Must fix, then a Consider, then a Should fix, and a later run sometimes splits one finding into several or spots something new. The summary always shows the latest run, and the script won’t repost a comment that’s already on those lines, so it doesn’t turn into noise. However, if you plan to block merges on it, block on Must fix only, where the rules are explicit.
  • Expect the occasional off-by-a-line comment. The script checks every comment lands on a line in the diff and moves anything that doesn’t into the summary, but the model can still pick the neighboring line now and again.

What you'll need

  • A zeroheight Enterprise plan, and an API token (organization settings → Developers) with the page:read and token_set:read scopes
  • A repository on GitHub, GitLab or Bitbucket with CI turned on
  • An API key for Anthropic or OpenAI, or a GitHub Copilot seat and a fine-grained token with the Copilot Requests permission
  • A token that can comment on pull requests (built in on GitHub; a project or repository access token on GitLab and Bitbucket)

How to set this up

  1. Create a zeroheight API token. In your organization’s settings → Developers, create a token with only the page:read and token_set:read scopes, and copy its Client ID and Access Token. The access token is only shown once.
  2. Add your secrets to CI. The token as ZEROHEIGHT_CLIENT_ID and ZEROHEIGHT_ACCESS_TOKEN, plus the key for your provider (ANTHROPIC_API_KEY, OPENAI_API_KEY or COPILOT_GITHUB_TOKEN). On GitLab add a GITLAB_TOKEN, and on Bitbucket a BITBUCKET_TOKEN, so the job can comment.
  3. Add the job. Copy the template for your platform from the repo:
    • GitHub: templates/github/zeroheight-audit.yml into .github/workflows/
    • GitLab: include templates/gitlab/zeroheight-audit.gitlab-ci.yml
    • Bitbucket: merge templates/bitbucket/bitbucket-pipelines.yml into your pipeline
  4. Add the config. Copy zeroheight-audit.config.json to the repo root and set your styleguide ID, token set ID and which files to audit.
  5. Open a pull request that touches a UI file. The summary and inline comments arrive within a few minutes, and update on every push.
  6. Tighten your docs. Look at what it missed. Most misses point at a page that needs a clearer rule, and every rule you add makes the next review better.

Full guides for each platform and provider are in the repo’s docs folder.

GitHub: .github/workflows/zeroheight-audit.yml

name: Design system audit

on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
    paths: ["src/**", "zeroheight-audit.config.json"]

jobs:
  audit:
    if: github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0
      - uses: zeroheight-demos/zeroheight-pr-audit@v2
        with:
          zeroheight-client-id: ${{ secrets.ZEROHEIGHT_CLIENT_ID }}
          zeroheight-access-token: ${{ secrets.ZEROHEIGHT_ACCESS_TOKEN }}
          provider: anthropic   # or openai, or copilot
          anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}

GitLab: add to .gitlab-ci.yml, and set ZEROHEIGHT_CLIENT_ID, ZEROHEIGHT_ACCESS_TOKEN and ZH_AUDIT_PROVIDER as CI/CD variables

include:
  - remote: "https://raw.githubusercontent.com/zeroheight-demos/zeroheight-pr-audit/v2/templates/gitlab/zeroheight-audit.gitlab-ci.yml"

Bitbucket: add to bitbucket-pipelines.yml, and set ZEROHEIGHT_CLIENT_ID, ZEROHEIGHT_ACCESS_TOKEN and ZH_AUDIT_PROVIDER as repository variables

image: node:22
clone:
  depth: full
pipelines:
  pull-requests:
    "**":
      - step:
          name: Design system audit
          script:
            - npx --yes github:zeroheight-demos/zeroheight-pr-audit#v2

The config: zeroheight-audit.config.json in the repo root

{
  "styleguideId": 12345,
  "tokenSetId": 12345,
  "include": ["src/**/*.{tsx,ts,jsx,js,vue,svelte,css,scss,less}"],
  "exclude": ["**/*.test.*", "**/*.spec.*", "**/*.stories.*"],
  "failOn": "none"
}

Try it

Sample prompt

No prompt for this one as it’s set up agentically!

What good looks like

A summary comment on the pull request that reads like a reviewer who knows the system well: a one-line verdict, a count of Must fix, Should fix and Consider findings, a table linking each one to its zeroheight page, and a short note on what the change did well.

On our own demo, a referral page seeded with nine design system problems, it caught all nine: two primary buttons on one surface, buttons used for navigation, an icon-only button with no accessible name, a removed focus ring, a token that doesn’t exist, the wrong icon size, labels that broke the content guidelines, hardcoded values with exact token matches, and font sizes with only close matches (correctly marked as Consider rather than flagged). It also caught things we hadn’t planted. One was a hand-built message strip that should have been the Banner component, which it backed up by quoting Banner’s own rule. The other was three CSS variables that don’t exist anywhere in the design system’s built CSS (one of them copied from pages that were already live).

Inline comments sit on the exact lines, and the straight swaps come with a suggestion you can apply in one click. When the author pushes again, the summary updates in place and comments that are already there aren’t posted a second time.