Docs

Agent setup

Install the Zitadel Agent Skills, drive the CLI with JSON envelopes, and prove sign-in in a browser.

A coding agent can drive the Zitadel CLI end to end. It reads one JSON object per command, instead of prose hints, and proves the generated app in a browser. This page covers the skills to install, the JSON contract, and the browser proof.

Before an agent starts, it needs Node.js 24 or newer, a package manager and browser automation. Quickstart shows how to check Node.js and the package manager. The browser automation is the agent's own tool, such as Playwright; the UI proof uses it.

Install the Agent Skills

The CLI ships Agent Skills so a coding agent can drive it and the SDKs with guidance that matches the version you run: the zitadel router skill, the CLI skill, and the per-framework SDK and component skills. Add them to your project for any skills-compatible agent (Claude Code, Cursor, Copilot, Codex, and more):

npx @zitadel/cli@latest skills add

They land in .agents/skills/, and in .claude/skills/ for Claude Code. Run it again after updating the CLI to keep them in step. To install them from the repository's main instead, run npx skills add zitadel/nextgen --full-depth.

An agent that reaches your project only through the server's MCP endpoint, without a shell, gets its skill from the server: zitadel-project says how to work with the project through the endpoint's tools. Agents that read MCP's Skills extension, such as Claude Code and VS Code, offer it with the server's other tools; the server's version decides what it says.

Ask your agent

With the skills installed, ask in plain words. Each ask below is one the CLI can carry out today; the linked guide shows the commands the agent runs, so you can check its work or run them yourself.

AskGuide
Add sign-in to my app.Quickstart, Add Zitadel to an existing app
Add passkeys.Enable passkeys
Make the login match our brand.Customize the login design
Ask for the company at sign-up.Edit the login flow
Connect Acme's OpenID Connect single sign-on.Connect any other OpenID Connect provider
Require 16-character passwords.Set the password policy, Test a policy
Give alex@example.com read-only access to the project.Manage project access
Show me what the next deploy changes.Deploy
Roll back the last deploy.Roll back a deploy
Why couldn't dana@example.com sign in?Find out why a user could not sign in
Which requests failed this morning?List the requests that failed
Who changed the password policy?Find out who changed the configuration

A change to sign-in is a file under .zitadel/, so it reaches users only when it is deployed. Ask the agent to show you deploy --dry-run and to commit the change before it deploys; the diff is your review.

Connect an agent through MCP

setup also writes .mcp.json, which connects Claude Code and the Copilot agent in VS Code to the server's MCP endpoint. There, each API operation is a tool, for an agent that works without a shell. Connect an AI agent explains the file and how to connect other clients.

Invocation contract

Always pass:

--non-interactive --json

When operating outside the current directory, also pass:

--cwd <path>

The CLI prints one parseable JSON object on stdout, the envelope. Installer, audit, and package-manager progress goes to stderr. Capture stdout and stderr separately when scripting, into files outside the app directory: setup scaffolds a new app only into an empty directory. The contract covers the Zitadel commands. The built-in help, version, and commands print no envelope.

Envelope shape

Every envelope includes:

  • cli_version
  • command
  • source
  • status: ok, skipped, or error

ok responses include command-specific data and a warnings list. skipped is a no-op, not a failure: nothing was done because a person declined or there was nothing to do, with a stable reason such as already-claimed. A dry run answers ok with data.dry_run: true and a headline ending in "(dry run)". error responses include code, message, and usually a hint. Prefer next_commands over prose hints: it sits inside data on ok responses and at the top level on skipped and error responses.

Read the results

Each command in the prompt below reports its outcome in the envelope:

  • doctor: data.ok is true when every check passed. A failed check returns an error envelope instead, and its next_commands name the fix.
  • start: data.urls.api and data.urls.console are the server's URLs. start returns no console sign-in link.
  • setup: status is ok, data.project.project_id is the project ID, data.files_written lists the files setup wrote, and next_commands holds the next steps. Setup does not return the project secret: it is in .env.local as ZITADEL_PROJECT_SECRET (Quickstart).
  • console: data.sign_in_url is the one-time link.

Agent prompt

Create a new, empty local app directory with a lowercase name, such as my-app, and run these in it:

1. npx @zitadel/cli@latest doctor --non-interactive --json
2. npx @zitadel/cli@latest start --non-interactive --json
3. npx @zitadel/cli@latest setup --framework next --server local --non-interactive --json
4. npm run dev

Use the available browser automation to open the generated app. Register a unique user, verify the signed-in profile state, log out, log back in with the same user, and finish on the signed-in page.

To reach the management console, run
npx @zitadel/cli@latest console --non-interactive --json and open data.sign_in_url
right away. Each link signs in the local admin once and expires after a minute, so
get a new one per visit. The link step 2 returns usually expires before setup finishes.

Summarize commands run, JSON statuses, files changed, browser steps completed, and any setup or UI friction.

The run worked when setup returned status: ok and the browser loop ends on the signed-in page, with the profile showing the user you registered.

To keep that proof as a test in the app, write it with @zitadel/testing, which boots its own Zitadel server and seeds the users (Test your app's sign-in).

Stable UI proof

<zitadel-login> and <zitadel-session> are web components that render in a shadow DOM, and the fields and buttons inside them have shadow roots of their own. Browser drivers with shadow-DOM-aware locators can target the test hooks directly. Generic DOM-eval drivers need to recurse through every shadow root.

The hooks are data-testid values. Useful ones include:

  • zitadel-field-email and zitadel-field-password (the field elements)
  • zitadel-input-email and zitadel-input-password (the native inputs inside them)
  • zitadel-action-submit (the submit button element)
  • zitadel-action-submit-button (the native button inside it)

For sign-out, the generated profile page renders <zitadel-session>: target [data-testid="zitadel-session-logout"]. An app that renders <zitadel-logout> instead, as the React, Vue, Solid, Svelte, and Qwik manual samples do, has no test id there: click its "Open user menu" button, then target the .signout-btn button.

Was this helpful?