Claude-skill-registry cli-development-guidelines
This skill should be used when designing, implementing, or reviewing CLI tools, or when flags, subcommands, help text, exit codes, or `--cli-dev` are mentioned.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/cli-development-guidelines" ~/.claude/skills/majiayu000-claude-skill-registry-cli-development-guidelines && rm -rf "$T"
manifest:
skills/data/cli-development-guidelines/SKILL.mdsource content
CLI Development Guidelines
When to activate this skill
- You are designing, implementing, or reviewing a command-line tool.
- The user mentions (explicitly or implicitly):
, flags, subcommands, exit codes, stdout/stderr, piping, JSON output, color, prompts, config files, env vars, “works in CI”, install/uninstall, telemetry.--help
What this skill produces
- A CLI contract (what users can rely on): commands, flags, IO behavior, exit codes, config/env, examples, and safety behavior.
- Draft help output and docs structure (example-first).
- A compliance audit (when runnable) using
.scripts/cli_audit.py
Non-negotiable CLI citizenship
- Exit codes:
on success.0- Non-zero on failure (and ideally meaningful, documented codes).
- Streams:
is for primary output and machine-readable output.stdout
is for errors, warnings, progress, and “what I’m doing” messaging.stderr
- Discoverability:
(and usually--help
) shows help and exits.-h
prints version and exits.--version
- Interactivity:
- Prompts only when
is a TTY.stdin - Provide
to force non-interactive behavior.--no-input
- Prompts only when
- Scripting friendliness:
- No ANSI color / spinners when output isn’t a TTY.
- Support
andNO_COLOR
.--no-color - Consider
and--json
for stable output.--plain
Workflow
Sketch the CLI contract first
- Start from the user’s jobs-to-be-done (what they’re trying to accomplish).
- Decide:
- Command shape: single command vs subcommands (
is common).noun verb - Inputs: args vs flags vs stdin vs prompts vs config/env.
- Outputs: human default, plus machine modes (
,--json
,--plain
).--quiet - Safety: confirmations,
,--dry-run
, secret handling.--force
- Command shape: single command vs subcommands (
Use:
Implement with safe defaults
- Use a CLI parsing library (don’t hand-roll).
- Make “boundary-crossing” actions explicit:
- Network calls
- Writing files not explicitly provided
- Mutating remote state
- Avoid footguns:
- Don’t accept secrets via flags or environment variables.
- Don’t print stack traces by default.
- Don’t assume TTY (detect it).
Validate and iterate
- Run an automated sanity check (when possible):
python scripts/cli_audit.py -- <your-cli> [subcommand]
- Fix in this order:
- Broken stdout/stderr separation
- Incorrect exit codes
- Help that’s missing or undiscoverable
- Unsafe defaults (destructive ops, secrets, hidden network writes)
- Unscriptable output (no stable modes)
Use:
- Checklist
scripts/cli_audit.py
Reference library
- Core reference: references/REFERENCE.md
- Quick audit checklist: references/CHECKLIST.md
- Evaluation prompts: references/EVAL_PROMPTS.md
Templates and scripts
- CLI spec template:
templates/cli-command-spec-template.json - Help text template:
templates/help-text-template.md - Error message template:
templates/error-message-template.md - Audit a CLI:
scripts/cli_audit.py