Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

For coding agents

cardano-init can be run completely by an LLM agent.

  • JSON output. Every command accepts --format json and prints one JSON object. Errors carry a stable code and a context that says how to fix them. cardano-init list --format json returns every role and tool.
  • No prompts. One-shot mode (--name …) never prompts, so an agent can create a project in one call. --format json also turns prompts off: if required input is missing, the command returns an error.

Generated AGENTS.md

Every project includes an AGENTS.md, and a CLAUDE.md that imports it. It is written for the tools you selected and contains:

  • the project layout;
  • the interface contract and the rules it sets;
  • the just commands to build, test, and clean;
  • links to the official documentation of each tool;
  • the cardano-dev-skills most useful for that stack.

cardano-dev-skills is a Cardano Foundation skill set for agents. It teaches how to write validators, build transactions, and debug on-chain failures. cardano-init creates the project, and the generated AGENTS.md points the agent to the skills it needs.

A typical agent flow

# 1. Discover what's available
cardano-init list --format json

# 2. Scaffold in one call
cardano-init --format json --name my-protocol --on-chain aiken --off-chain meshjs --devnet yaci

# 3. Check toolchains from inside the project
cd my-protocol && cardano-init doctor --format json

# 4. Build and test
just test

JSON envelope

A --format json response has one of two shapes:

{ "schema_version": 1, "ok": true,  "data":  { } }
{ "schema_version": 1, "ok": false, "error": { "code": "<stable>", "message": "<human>", "context": { } } }

message is for humans and can change between versions. code and the context keys are stable. The exit code gives the category: 0 success, 1 runtime error, 2 usage error (see Exit codes).

Error codes

codeExitcontextMeaning
name_required2{}A creation flag was given without --name.
invalid_project_name2{ name, reason }The name has characters outside [A-Za-z0-9_-] or starts with ..
unknown_tool2{ tool_id, role, valid_tools }No tool with that id for the role.
tool_role_mismatch2{ tool_id, role, valid_roles }The tool exists but doesn’t fill that role.
fullstack_conflict2{}--fullstack combined with --on-chain / --off-chain.
fullstack_unsupported2{ tool_id, valid_tools }The tool has no fullstack template.
no_roles_selected2{}No role flag was given.
experimental_not_allowed2{ tools, remedy }An experimental tool was selected without --allow-experimental.
incompatible_tools2{ tools, reason, compatible_providers, compatible_off_chain, remedy }The off-chain tool can’t reach any selected provider.
project_unrecognized2{ dirs }add / remove couldn’t identify a component directory.
slot_occupied2{ role, dir }A target directory exists and isn’t the recognized component.
nothing_to_change2{}The requested add / remove is a no-op.
dir_exists1{ path }The project directory already exists and isn’t empty.
worktree_dirty1{ path }Uncommitted changes (or not a git repository) and no --force.
registry_load1{ file?, detail }The embedded registry failed to load.
scaffold_error1{ path?, detail }A template asset, render, or I/O failure.