Create CLI
Attribution: Sourced from steipete/agent-scripts by Peter Steinberger.
When to Use
- Designing CLI argument syntax, flags, help text, and output format
- Reviewing CLI UX for human-friendliness and script-compatibility
- Specifying error messages, config handling, and dry-run behavior
- Creating a new command-line tool from scratch
Design CLI surface area (syntax + behavior), human-first, script-friendly.
Reference: https://clig.dev/
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
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
-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.
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)
- 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: CLI UX/spec design: args, flags, help, output, errors, config, dry-run.4---56# Create CLI78> **Attribution:** Sourced from [steipete/agent-scripts](https://github.com/steipete/agent-scripts) by [Peter Steinberger](https://github.com/steipete).910## When to Use1112- Designing CLI argument syntax, flags, help text, and output format13- Reviewing CLI UX for human-friendliness and script-compatibility14- Specifying error messages, config handling, and dry-run behavior15- Creating a new command-line tool from scratch1617Design CLI surface area (syntax + behavior), human-first, script-friendly.1819Reference: https://clig.dev/2021## Clarify (fast)2223Ask, then proceed with best-guess defaults if user is unsure:2425- Command name + one-sentence purpose.26- Primary user: humans, scripts, or both.27- Input sources: args vs stdin; files vs URLs; secrets (never via flags).28- Output contract: human text, `--json`, `--plain`, exit codes.29- Interactivity: prompts allowed? need `--no-input`? confirmations for destructive ops?30- Config model: flags/env/config-file; precedence; XDG vs repo-local.31- Platform/runtime constraints: macOS/Linux/Windows; single binary vs runtime.3233## Deliverables3435When designing a CLI, produce a compact spec the user can implement:3637- Command tree + USAGE synopsis.38- Args/flags table (types, defaults, required/optional, examples).39- Subcommand semantics (what each does; idempotence; state changes).40- Output rules: stdout vs stderr; TTY detection; `--json`/`--plain`; `--quiet`/`--verbose`.41- Error + exit code map (top failure modes).42- Safety rules: `--dry-run`, confirmations, `--force`, `--no-input`.43- Config/env rules + precedence (flags > env > project config > user config > system).44- Shell completion story (if relevant): install/discoverability; generation command or bundled scripts.45- 5–10 example invocations (common flows; include piped/stdin examples).4647## Default Conventions4849- `-h/--help` always shows help and ignores other args.50- `--version` prints version to stdout.51- Primary data to stdout; diagnostics/errors to stderr.52- Add `--json` for machine output; consider `--plain` for stable line-based text.53- Prompts only when stdin is a TTY; `--no-input` disables prompts.54- Destructive operations: interactive confirmation + non-interactive requires `--force` or explicit `--confirm=...`.55- Respect `NO_COLOR`, `TERM=dumb`; provide `--no-color`.56- Handle Ctrl-C: exit fast; bounded cleanup; be crash-only when possible.5758## CLI Spec Skeleton5960Fill these sections, drop anything irrelevant:61621. **Name**: `mycmd`632. **One-liner**: `...`643. **USAGE**:65 - `mycmd [global flags] <subcommand> [args]`664. **Subcommands**:67 - `mycmd init ...`68 - `mycmd run ...`695. **Global flags**:70 - `-h, --help`71 - `--version`72 - `-q, --quiet` / `-v, --verbose` (define exactly)73 - `--json` / `--plain` (if applicable)746. **I/O contract**:75 - stdout:76 - stderr:777. **Exit codes**:78 - `0` success79 - `1` generic failure80 - `2` invalid usage (parse/validation)818. **Env/config**:82 - env vars:83 - config file path + precedence:849. **Examples**:85 - …8687## Notes8889- Prefer recommending a parsing library (language-specific) only when asked; otherwise keep this skill language-agnostic.90- If the request is "design parameters", do not drift into implementation.