Skip to main content
Syntax and flags only. For walkthroughs and layout examples, see the Guides tab.

Contents

Global flags

The CLI walks up from the current directory looking for stacksdapp.toml or contracts/Clarinet.toml.

Exit codes

With --json, failures include "ok": false, "code", and "exit_code".

Command overview

new

Creates contracts, frontend, stacksdapp.toml, git hooks, agent skill, and a default counter contract (Clarity 6).

add

Creates contracts/contracts/<name>.clar, updates Clarinet.toml, adds trait requirements for SIP templates, and regenerates bindings.

dev

Default with no --network starts local devnet (Docker required). Do not run clarinet devnet start alongside stacksdapp dev.

generate

deploy

Guides: testnet · mainnet · local devnet

test, check, clean

init, upgrade, doctor

init

Adopt an existing Clarinet project. Adds frontend (if missing), support files, bindings, git hooks, and agent skill.
Expects Clarinet.toml at repo root or contracts/Clarinet.toml. Normalizes standard Clarinet layout. Guide: Adopt an existing project

upgrade

Refresh npm deps, regenerate bindings, refresh git hooks and agent skill. Non-destructive to user contracts.
Guide: Upgrade a project

doctor

Checks Rust 1.75+, Node 20+, Clarinet 3.23+, Docker (for devnet), git hooks path.

completions

Generate shell completions:

Configuration files

After cloning, enable git hooks:

Name validation

  • Project name: single segment, letters/digits/-/_, no .. or absolute paths, max 64 chars
  • Contract name: Clarity identifier, letter first, max 40 chars

JSON output

With --json, success payloads include "ok": true and command-specific fields. Failures include "ok": false, "error", "code", and "exit_code".
Use exit codes for CI scripting. Error fixes: Troubleshooting