create-cli-tool
SKILL.md
Create CLI Tool
Shape a CLI that feels good for people and predictable for scripts.
Start Here
- Read
references/cli-guidelines.mdand treat it as the default rubric. - Consider upstream guidance at https://clig.dev/ when resolving tradeoffs.
- Ask only the minimum questions needed to lock the interface.
- Design forward only. Do not preserve legacy behavior unless the user asks.
Quick Clarify
Ask, then proceed with sensible defaults if unclear:
- Command name and single-sentence purpose.
- Primary audience: humans, scripts, or both.
- Inputs: flags/args vs stdin; files vs URLs; secrets never via flags.
- Outputs: human text, structured (
--json), or stable line text (--plain). - Interactivity: prompts allowed; need
--no-input; confirmations for destructive ops. - Configuration: flags vs env vs config file; precedence model; XDG vs repo-local.
- Runtime constraints: OS targets; single binary or runtime required.
What to Deliver
Produce a compact, implementation-ready spec:
- Command tree plus USAGE synopsis.
- Full args/flags table: type, default, required, examples.
- Subcommand behavior: inputs, outputs, side effects, idempotence.
- Output rules: stdout vs stderr, TTY detection,
--json/--plain,--quiet/--verbose. - Error taxonomy and exit codes for common failures.
- Safety controls:
--dry-run, confirmations,--force,--no-input. - Config/env rules and precedence (flags > env > project config > user config > system).
- Shell completion approach if relevant.
- 5-10 example invocations, including stdin/pipes.
Defaults Unless Overridden
-h/--helpprints help and ignores other flags.--versionprints to stdout.- Primary data to stdout; diagnostics to stderr.
- Provide
--jsonfor machine output; add--plainfor stable line output when useful. - Prompt only if stdin is a TTY;
--no-inputdisables prompts. - Destructive operations require explicit confirmation or
--forcefor non-interactive runs. - Respect
NO_COLORandTERM=dumb; provide--no-color. - Handle Ctrl-C with fast exit and minimal cleanup.
Spec Template
Fill only what applies:
- 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:
- stdout:
- stderr:
- Exit codes:
0success1generic failure2invalid usage (parse/validation)- (add command-specific codes only when actually useful)
- Env/config:
- env vars:
- config file path + precedence:
- Examples:
- ...
Notes
- Keep it language-agnostic unless asked to recommend a parser library.
- If the request is only about parameters, avoid implementation details.
Weekly Installs
3
Repository
khoi/skillsGitHub Stars
1
First Seen
14 days ago
Security Audits
Installed on
opencode3
gemini-cli3
github-copilot3
codex3
kimi-cli3
amp3