← ClaudeAtlas

cli-contractslisted

Design a CLI's command, flag, stream, exit-code, and JSON contract before coding it. Use when adding or changing a CLI surface.
fmind/dot · ★ 4 · Data & Documents · score 80
Install: claude install-skill fmind/dot
# CLI Contracts Define a command-line interface as a stable human and machine contract before implementing it. [typer](../typer/SKILL.md) owns Python CLI implementation; [systematic-debugging](../systematic-debugging/SKILL.md) owns unknown failures. ## Workflow 1. **Name the jobs**: one purpose per command, a predictable noun-verb hierarchy, and aliases only when they cannot trigger a different class of action. 1. **Specify inputs**: positional arguments, flags, environment variables, config precedence, defaults, validation, mutual exclusions, and behavior without a TTY. 1. **Separate streams**: requested data to stdout, diagnostics and progress to stderr; `--json` stays machine-readable, schema-stable, and free of decoration. 1. **Define outcomes**: map success, usage errors, authentication failures, remote failures, partial results, and cancellation to documented exit codes; never turn an error into an empty success. 1. **Make help executable**: root and subcommand help, examples, deprecations, and shell completions generate from the same command definition. 1. **Protect sensitive context**: errors show safe command and argument context, never collected values, tokens, provider response bodies, or unredacted stderr. 1. **Handle process behavior**: respect signals, cancellation, timeouts, piping, broken pipes, and cleanup; a destructive command needs a confirmation or an explicit non-interactive opt-in such as `--yes`. 1. **Preserve compatibility deliberately**: command n