Skip to content
Skill Authoring
Skill

/cli-build

Design and build a CLI that an AI agent can operate safely and a human can supervise. Use when the user wants to build a CLI, wrap an API in a command-line tool, build a CRUD or local-first tool over a database or filesystem the user already owns, add --json or --dry-run to an

BOOST
From plugin
crafter-station-skills
1139 skills
Install
$ npx -y skills add crafter-station/skills --skill cli-build --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/cli-build

Context preview

The summary Claude sees to decide when to auto-load this skill.

Design and build a CLI that an AI agent can operate safely and a human can supervise. Use when the user wants to build a CLI, wrap an API in a command-line tool, build a CRUD or local-first tool over a database or filesystem the user already owns, add --json or --dry-run to an

SKILL.md

cli-build.SKILL.md
name: cli-build
version: 0.12.0
description: "Design and build a CLI that an AI agent can operate safely and a human can supervise. Use when the user wants to build a CLI, wrap an API in a command-line tool, build a CRUD or local-first tool over a database or filesystem the user already owns, add --json or --dry-run to an existing CLI, design a trust ladder or approval gate for risky commands, wrap an async API so agents do not write their own poll loop, or decide how to distribute a CLI (npm, native binary, source). Runs on its own when the contract is yours to define; follows a surface-recon report when the target is someone else's service."

cli-build

Build a CLI whose primary user is an agent and whose supervisor is a human. That inverts the usual defaults: machine-readable output is not a flag you add later, prompts are a failure mode in non-interactive contexts, and every write leaves a receipt.

Phase 0: where does the contract come from

Every command you write reads or mutates something with a shape. This phase names that shape's owner, because it decides whether you go find the contract or write it.

**Discovered.** The CLI wraps a system you do not control: a third-party API, a login-walled portal, a device, an undocumented file format. The contract exists and is unverified, so guessing at it wastes more time than mapping it. **Run `surface-recon` first** and start from its report.

**Defined.** You own the model: CRUD over your own database, a scaffolder, a local transform, a wrapper around a library whose types you already have. There is nothing to reverse-engineer, so `surface-recon` has no input and skipping it costs nothing. **Write the contract instead**, in one pass before Phase 1: the entities, their fields and types, the operations allowed on each, and what makes a write irreversible. That artifact is what a recon report would have given you.

**Mixed.** A CLI over your own database that also calls a payment provider is discovered at the boundary and defined in the middle. Recon only the discovered part; do not let one external call turn the whole build into a recon job.

Say which one this is out loud before Phase 1, and write it into `friction.md`. An unstated classification defaults to discovered, which is how a defined build ends up blocked waiting for a report nobody can produce.

**Done when:** the origin is named, and either a recon report exists or the entities and operations are written down.

**Open `friction.md` next to the code now and append as you go.**

A block you rejected and why, a convention that turned out wrong for this domain, a reference that was thin. It folds into the case at the end, and it is what corrects this skill: seven claims inherited from an older version were false against the source, and they surfaced only because someone wrote down that they did not match.

What agent-first actually means

**Every CLI, no exceptions:**

  • **`--json`, and JSON automatically when stdout is not a TTY** even without the flag. Three CLIs converged on this independently; it is the most valuable default here.
  • **No prompt ever blocks a non-interactive run.** Anything that would prompt fails with a structured error instead of hanging.
  • **A `schema` command with a version field**, so agents introspect at runtime instead of parsing `--help`. Present in 3 of 14 corpus CLIs: the highest-value convention and the least adopted.
  • **Exit codes that mean something.** Zero is success; user error and system failure are distinguishable.
  • **Data on stdout, diagnostics on stderr, always.** Including the banner, which is why `banner` is a block and not a `console.log`.
  • **A secret read from the terminal never echoes**, and returns `null` with no TTY rather than hanging. That is `prompt-secret`.

Those are now enforced as tests rather than trusted as prose, in the `surfacer` repository, which compiles CLIs from a recon descriptor. Each test names the rule it checks so the two read together.

It is worth knowing what that exercise found, because the same shape is likely wherever this list is only written down. Encoding the rules against the generator caught three violations, including the two most valuable defaults here. Then applying the identical list to the generator's own CLI caught four more, in the tool that had just been taught to enforce them. A compiler that emits agent-first CLIs while not being one is the easiest version of this to miss, because every test was passing and every test was pointed at the output.

So the list binds twice, and the tests live in two files only because a test cannot invoke a binary from another crate: `crates/surfacer-emit-cli/tests/agent_first_rules.rs` for what is generated, `crates/surfacer-app/tests/agent_first_rules.rs` for the tool doing the generating. If you build a tool that produces CLIs, check the producer against this list too. Prose does not fail a build, and a rule you enforce on others is the one you stop checking on yourself.

**When the domain has real consequences** (money, irreversible writes, third-party side effects, personal data):

  • A trust ladder classifying commands by risk.
  • `--dry-run` on every mutation, returning what *would* happen.
  • An append-only audit log written **before** the network call, not after.
  • A killswitch the human can trigger out of band.

**When the API is asynchronous:** `--wait` on every submitting command, backed by a job ledger that survives a killed poll. Handing the poll loop to the caller makes the agent write backoff logic it will get subtly wrong. See [compounding-surface.md](references/compounding-surface.md).

**Size the friction to the damage, and "none" is a real size.** Ask what one wrong call costs, then choose. A read-only CLI over a public dataset earns `--json` and a `schema` command and stops there: nobody loses anything by running the query twice. Intent tokens are for a wrong call that costs money. Adopting the full ladder for a tool that cannot

Read more
Ships withcrafter-station-skills

Agent skills extracted from real work. Each one shipped something first.

Get the whole plugin

Other skills on crafter-station-skills.