draft v1 — feedback welcome

OpenAPI,
but for CLIs.

CLI Schema is a language-agnostic specification for machine-readable CLI descriptions — structured enough for AI agents, expressive enough for docs, precise enough for shell completions.

$ mytool __schema
{
  "name": "mytool",
  "version": "1.0.0",
  "commands": [
    {
      "name": "deploy",
      "description": "Deploy the app",
      "flags": [
        { "name": "env", "type": "string" }
      ]
    }
  ]
}
$

One schema.
Endless tooling.

Describe your CLI once in a structured, open format — then let every tool in the ecosystem consume it.

AI-agent ready

Structured enough for LLMs and autonomous agents to reason about your CLI without training data.

📖
Docs generation

Generate beautiful, accurate reference docs directly from the schema. No more manual maintenance.

Shell completions

Power tab completions for bash, zsh, fish, and PowerShell from a single source of truth.

🌐
Language-agnostic

Works with any CLI regardless of implementation language — Go, Rust, Python, Ruby, or anything else.

🔍
Validation

JSON Schema meta-schema included. Validate any cli-schema document against the spec instantly.

🔓
Open & CC0

Public domain dedication. No licensing concerns. Use it in any project, commercial or otherwise.


Simple by design.

Two ways to expose a schema. One consistent format to consume it.

01
Implement the meta-command

Add a __schema subcommand to your CLI that outputs a valid cli-schema JSON document. Discovery is instant.

02
Or ship a sidecar file

Place a mytool.cli-schema.json file next to your binary. No runtime changes required.

03
Tooling consumes it

Any tool that understands cli-schema can now generate docs, completions, type-safe wrappers, or agent interfaces — automatically.

gh.cli-schema.json — excerpt
{
  "name": "gh",
  "version": "2.40.0",
  "commands": [
    {
      "name": "pr",
      "description": "Manage pull requests",
      "commands": [
        {
          "name": "create",
          "flags": [
            {
              "name": "title",
              "short": "t",
              "type": "string",
              "required": true
            }
          ]
        }
      ]
    }
  ]
}

Built for the
whole ecosystem.

cli-schema is infrastructure. Build anything on top of it.

AI / AGENTS
LLM tool calling

Give agents a structured view of any CLI without fine-tuning. cli-schema maps directly to function calling schemas.

DX
IDE integrations

Power autocompletion, inline docs, and flag validation inside editors and devtools.

DOCS
Reference generation

Always-accurate CLI reference pages, man pages, and --help output generated straight from the schema.

SHELL
Universal completions

One schema, completions for every shell. bash, zsh, fish, PowerShell — generated without manual scripts.


Start with the spec.

The specification is open, CC0 licensed, and ready for feedback.
Contributions and implementations welcome.