Make your product agent-ready
CLI Design
Building CLIs that AI agents can operate as effectively as human users
Last verified 2026-09-24
Summary
CLI Design covers command-line surfaces that agents can script without scraping terminal prose. Use it when a product exposes capabilities through commands, local automation, package scripts, or developer tools.
- Owns: command structure, JSON output, raw payload input, schema introspection, exit codes, discipline, input hardening, safety flags, and packaging CLI knowledge for agents.
- Does not own: model-callable tool schemas in general; see Tool Design. HTTP service contracts; see API Surface.
- Agent-ready means: every command can be discovered, invoked non-interactively, parsed structurally, retried safely, and diagnosed from exit status plus error body.
Start Here
- Command Structure - Shape commands around stable resources and verbs.
- Machine-Readable Output - Return parseable JSON, not terminal-only formatting.
- Raw Payload Input - Accept files or stdin for complex structured input.
- Schema Introspection - Let agents discover commands and options programmatically.
- Context Window Discipline - Keep help, logs, and results compact.
- Input Hardening - Reject malformed arguments with actionable errors.
- Safety Rails - Support dry runs, confirmations, and non-interactive execution.
- Agent Knowledge Packaging - Ship command guidance agents can retrieve.
- CLI Scale - Score a CLI against the seven-axis agent-readiness framework.