Agents
Drive Stanza from Claude Code, Codex, Cursor, or any other coding agent.
Stanza is built to be agent-friendly: every verb has a non-interactive form, the manifest is declarative state, and --dry-run previews any mutation before it runs. An agent that follows a handful of rules can scaffold and modify a Stanza project as reliably as a human at a prompt.
SKILL.md
For Claude Code, Codex, and other agent runtimes that load skills, Stanza ships a self-contained skill bundle. Install it with the Skills CLI:
npx skills add https://github.com/jakejarvis/stanza --skill stanza-cliThat drops the skill into your agent's skill directory; the agent picks it up on the next prompt that matches its triggers (running stanza-cli, creating a project, adding modules, etc.). The skill is designed to work without access to this source repo — it encodes the published CLI contract alone.
The source lives at
skills/stanza-cli/ if you'd
rather vendor it directly.
Agent guidance
A few rules on top of the CLI surface keep agent runs predictable:
- Discover before assuming. The registry evolves — confirm any module id with
npx -y stanza-cli@latest searchbefore passing it toadd. Use the printedcategory/idvalue, not the display label. - Prefer
npxfor automation.npx -y stanza-cli@latest <verb>avoids the package-manager argument-forwarding ambiguity thatpnpm create/npm init/bun createintroduce. - Preview with
--dry-runbefore mutating commands when you want to show the user what's about to happen. - Respect the dirty-worktree refusal. Commit or stash first. Only reach for
--dangerously-allow-dirtywith the user's explicit approval. - Pass
--app=<id>toadd/removein multi-app projects. Single-app projects auto-target, but ifstanza.json'sappsarray has more than one entry, scripts should pass the flag explicitly rather than relying on cwd inference. stanza.jsonis generated state. Don't hand-edit it; use the verbs that maintain it (add,remove).- Generated files are user-owned source. Once Stanza writes a template, edit it like any other file in the repo.
- Verify with
stanza doctor. It reports drift betweenstanza.jsonand the filesystem and exits non-zero, so a script can gate on it after a run or after hand-edits.
Common errors
| Error | What it means and what to do |
|---|---|
Module not found | The id doesn't exist in the registry. Run stanza search and use the printed id. |
missing-peer / incompatible-peer | The selected module needs a peer category filled first (e.g. Better Auth needs an orm). Add the peer, then re-run. |
no-adapter | None of the module's adapters match the current stack. Try a different module in the same category. |
No stanza.json found | You're not in a Stanza project. Run from the project root or a child directory containing a parent stanza.json. |
| Dirty worktree refusal | Commit or stash, or ask the user before using --dangerously-allow-dirty. |
Putting it together
A minimal agent script that scaffolds a project, adds auth, and verifies nothing else changed:
# 1. Confirm the modules exist.
npx -y stanza-cli@latest search
# 2. Scaffold.
npx -y stanza-cli@latest init my-app --yes \
--framework=tanstack-start \
--ui=tailwind \
--db=postgres \
--orm=drizzle \
--pm=pnpm
cd my-app
pnpm install
# 3. Preview, then add auth.
npx -y stanza-cli@latest add auth better-auth --dry-run
npx -y stanza-cli@latest add auth better-auth
pnpm install
# 4. Inspect + verify.
npx -y stanza-cli@latest list
npx -y stanza-cli@latest doctor # confirm the project matches its manifestWhen reporting results back to the user, include the exact command run, whether it wrote files, and any follow-up install needed.