---
title: Set up Fidel with an AI coding agent
description: Steps for Claude Code, Cursor, Codex and other coding agents to set up Fidel design system checks in a repository, including the steps a person must do.
---

# Set up Fidel with an AI coding agent

A coding agent can do most of the setup. Three steps need a person in a browser: signing in, installing the GitHub App and, if `init` asks for it, linking the repository. `npx usefidel init` stops when it has no interactive terminal, so the agent hands that step to the person.

## Prompt to give your agent

```text
Set up Fidel design system checks in this repository by following
https://usefidel.com/docs/ai-agents.md. Stop and ask me whenever a step
needs me to sign in or approve something in the browser.
```

## Steps for the agent

1. **Check the prerequisites.**

   ```bash
   node --version            # must be v24 or later
   git remote get-url origin # must be a GitHub repository
   ```

2. **Ask the person to run `init` in their own terminal**, from the repository root:

   ```bash
   npx usefidel init
   ```

   It opens the browser for sign-in (email or Google). If no browser can open, it prints a URL to visit. Wait until the person confirms it finished, then read what it printed about anything still missing.

3. **Check the two files it wrote.** `fidel.config.json` must contain a non-empty `designSystemChecks` array, a non-empty `checks` array, or both. `.github/workflows/fidel.yml` should match:

   ```yaml
   name: Design Validation
   on:
     pull_request:
       types: [opened, synchronize]

   permissions:
     contents: read
     pull-requests: write
     id-token: write

   jobs:
     fidel:
       runs-on: ubuntu-latest
       steps:
         - uses: actions/checkout@v4
         - uses: usefidel/fidel-action@v3
   ```

   Keep `id-token: write`. Fidel uses it to authenticate the workflow without a stored secret.

4. **Ask the person to install the GitHub App** on this repository: [github.com/apps/use-fidel](https://github.com/apps/use-fidel). If `init` said the repository is not linked, ask them to run `npx usefidel link` too.

5. **Open a test pull request.** Commit both files on a new branch together with a change to a frontend file (for example a `.tsx` or `.css` file). A pull request that changes only `fidel.config.json` does not start a check.

   ```bash
   git switch -c add-fidel
   git add fidel.config.json .github/workflows/fidel.yml
   git commit -m "Add Fidel design validation"
   git push -u origin add-fidel
   gh pr create --fill
   ```

6. **Confirm it ran.** Fidel posts one comment on the pull request and updates it on each push.

   ```bash
   gh pr view --comments
   ```

   If there is no comment, check the workflow run with `gh run list --workflow fidel.yml` and look the error up in [Troubleshooting](/docs/troubleshooting/).

## Rules for agents

- Don't set `failOnDrift` to `true` unless the person asks. Comments only is the default for a reason: teams review findings before blocking merges.
- Never put a secret in a `url` in `fidel.config.json`. URLs are fetched, stored with the run and linked from the pull request comment. Use `{pr}`, `{branch}` or `{sha}` for preview URLs.
- Don't remove permissions from the generated workflow.
- Don't edit `.github/workflows/fidel.yml` if it already existed. `init` never overwrites it.

## Related

- [Configuration: fidel.config.json](/docs/configuration/)
- [CLI reference](/docs/cli/)
- [Troubleshooting](/docs/troubleshooting/)
