When To Use
- Designing a new CLI's arguments, flags, subcommands, and help text before implementation
- Refactoring an existing CLI's surface area for consistency or composability
- User asks to spec out command-line UX, exit codes, output formats, or config precedence
Boundaries
- Not for implementing CLI code; this skill produces a design spec, not source files
- Not for designing REST APIs, GraphQL schemas, or non-CLI interfaces
- Do not recommend specific parsing libraries unless the user explicitly asks
- Skip when the user already has a finalized spec and just needs implementation
Verification
- Deliverable includes a command tree, args/flags table, exit code map, and example invocations
- Output and error contracts specify stdout vs stderr, TTY detection, and machine-output flags
- Safety rules (dry-run, confirmations, force) are defined for any destructive operations
- Spec is language-agnostic unless the user specifies a runtime
Create CLI
Design CLI surface area (syntax + behavior), human-first, script-friendly.
Do This First
Clarify (fast)
Ask, then proceed with best-guess defaults if user is unsure:
- Command name + one-sentence purpose.
- Primary user: humans, scripts, or both.
- Input sources: args vs stdin; files vs URLs; secrets (never via flags).
- Output contract: human text,
--json, --plain, exit codes.
- Interactivity: prompts allowed? need
--no-input? confirmations for destructive ops?
- Config model: flags/env/config-file; precedence; XDG vs repo-local.
- Platform/runtime constraints: macOS/Linux/Windows; single binary vs runtime.
Deliverables (what to output)
When designing a CLI, produce a compact spec the user can implement:
- Command tree + USAGE synopsis.
- Args/flags table (types, defaults, required/optional, examples).
- Subcommand semantics (what each does; idempotence; state changes).
- Output rules: stdout vs stderr; TTY detection;
--json/--plain; --quiet/--verbose.
- Error + exit code map (top failure modes).
- Safety rules:
--dry-run, confirmations, --force, --no-input.
- Config/env rules + precedence (flags > env > project config > user config > system).
- Shell completion story (if relevant): install/discoverability; generation command or bundled scripts.
- 5–10 example invocations (common flows; include piped/stdin examples).
Default Conventions (unless user says otherwise)
-h/--help always shows help and ignores other args.
--version prints version to stdout.
- Primary data to stdout; diagnostics/errors to stderr.
- Add
--json for machine output; consider --plain for stable line-based text.
- Prompts only when stdin is a TTY;
--no-input disables prompts.
- Destructive operations: interactive confirmation + non-interactive requires
--force or explicit --confirm=....
- Respect
NO_COLOR, TERM=dumb; provide --no-color.
- Handle Ctrl-C: exit fast; bounded cleanup; be crash-only when possible.
Templates (copy into your answer)
CLI spec skeleton
Fill these sections, drop anything irrelevant:
- Name:
mycmd
- One-liner:
...
- USAGE:
mycmd [global flags] <subcommand> [args]
- Subcommands:
mycmd init ...
mycmd run ...
- Global flags:
-h, --help
--version
-q, --quiet / -v, --verbose (define exactly)
--json / --plain (if applicable)
- I/O contract:
- Exit codes:
0 success
1 generic failure
2 invalid usage (parse/validation)
- (add command-specific codes only when actually useful)
- Env/config:
- env vars:
- config file path + precedence:
- Examples:
Notes
- Prefer recommending a parsing library (language-specific) only when asked; otherwise keep this skill language-agnostic.
- If the request is “design parameters”, do not drift into implementation.
1---2name: create-cli3description: Design command-line interface parameters and UX: arguments, flags, subcommands, help text, output formats, error messages, exit codes, prompts, config/env precedence, and safe/dry-run behavior. Use when you’re designing a CLI spec (before implementation) or refactoring an existing CLI’s surface area for consistency, composability, and discoverability.4---56## When To Use78- Designing a new CLI's arguments, flags, subcommands, and help text before implementation9- Refactoring an existing CLI's surface area for consistency or composability10- User asks to spec out command-line UX, exit codes, output formats, or config precedence1112## Boundaries1314- Not for implementing CLI code; this skill produces a design spec, not source files15- Not for designing REST APIs, GraphQL schemas, or non-CLI interfaces16- Do not recommend specific parsing libraries unless the user explicitly asks17- Skip when the user already has a finalized spec and just needs implementation1819## Verification2021- Deliverable includes a command tree, args/flags table, exit code map, and example invocations22- Output and error contracts specify stdout vs stderr, TTY detection, and machine-output flags23- Safety rules (dry-run, confirmations, force) are defined for any destructive operations24- Spec is language-agnostic unless the user specifies a runtime2526# Create CLI2728Design CLI surface area (syntax + behavior), human-first, script-friendly.2930## Do This First3132- Read `skills/create-cli/references/cli-guidelines.md` and apply it as the default rubric.33- Upstream/full guidelines: https://clig.dev/ (propose changes: https://github.com/cli-guidelines/cli-guidelines)34- Ask only the minimum clarifying questions needed to lock the interface.3536## Clarify (fast)3738Ask, then proceed with best-guess defaults if user is unsure:3940- Command name + one-sentence purpose.41- Primary user: humans, scripts, or both.42- Input sources: args vs stdin; files vs URLs; secrets (never via flags).43- Output contract: human text, `--json`, `--plain`, exit codes.44- Interactivity: prompts allowed? need `--no-input`? confirmations for destructive ops?45- Config model: flags/env/config-file; precedence; XDG vs repo-local.46- Platform/runtime constraints: macOS/Linux/Windows; single binary vs runtime.4748## Deliverables (what to output)4950When designing a CLI, produce a compact spec the user can implement:5152- Command tree + USAGE synopsis.53- Args/flags table (types, defaults, required/optional, examples).54- Subcommand semantics (what each does; idempotence; state changes).55- Output rules: stdout vs stderr; TTY detection; `--json`/`--plain`; `--quiet`/`--verbose`.56- Error + exit code map (top failure modes).57- Safety rules: `--dry-run`, confirmations, `--force`, `--no-input`.58- Config/env rules + precedence (flags > env > project config > user config > system).59- Shell completion story (if relevant): install/discoverability; generation command or bundled scripts.60- 5–10 example invocations (common flows; include piped/stdin examples).6162## Default Conventions (unless user says otherwise)6364- `-h/--help` always shows help and ignores other args.65- `--version` prints version to stdout.66- Primary data to stdout; diagnostics/errors to stderr.67- Add `--json` for machine output; consider `--plain` for stable line-based text.68- Prompts only when stdin is a TTY; `--no-input` disables prompts.69- Destructive operations: interactive confirmation + non-interactive requires `--force` or explicit `--confirm=...`.70- Respect `NO_COLOR`, `TERM=dumb`; provide `--no-color`.71- Handle Ctrl-C: exit fast; bounded cleanup; be crash-only when possible.7273## Templates (copy into your answer)7475### CLI spec skeleton7677Fill these sections, drop anything irrelevant:78791. **Name**: `mycmd`802. **One-liner**: `...`813. **USAGE**:82 - `mycmd [global flags] <subcommand> [args]`834. **Subcommands**:84 - `mycmd init ...`85 - `mycmd run ...`865. **Global flags**:87 - `-h, --help`88 - `--version`89 - `-q, --quiet` / `-v, --verbose` (define exactly)90 - `--json` / `--plain` (if applicable)916. **I/O contract**:92 - stdout:93 - stderr:947. **Exit codes**:95 - `0` success96 - `1` generic failure97 - `2` invalid usage (parse/validation)98 - (add command-specific codes only when actually useful)998. **Env/config**:100 - env vars:101 - config file path + precedence:1029. **Examples**:103 - …104105## Notes106107- Prefer recommending a parsing library (language-specific) only when asked; otherwise keep this skill language-agnostic.108- If the request is “design parameters”, do not drift into implementation.