Skip to content
Back to skills

Cli Design Expert

ASecurity

Design or review command-line interfaces for usability and automation: help text, args/flags, stdout vs stderr, exit codes, TTY behavior, config precedence, and safe handling of secrets and destructive actions.

  • 225 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 4, 2026
toolsgoshell

Works with

  • cli

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add NeverSight/skills_feed --skill cli-design-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cli Design Expert?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cli Design Expert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neversight-cli-design-expert/badge)](https://www.skillsdirectory.com/skills/neversight-cli-design-expert)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cli-design-expert
description: "Design or review command-line interfaces for usability and automation: help text, args/flags, stdout vs stderr, exit codes, TTY behavior, config precedence, and safe handling of secrets and destructive actions."
license: CC-BY-SA-4.0
compatibility: Works with any CLI language/framework. Best with an args parser library and POSIX conventions (stdout/stderr, exit codes, signals). See references/CLI_GUIDELINES.md.
metadata:
  version: "1.1.0"
  author: "cli-guidelines-community"
  upstream_guidelines: "https://clig.dev"
  reference_file: "references/CLI_GUIDELINES.md"
---

# CLI Design Expert

Use this skill to design, refactor, or audit CLIs that are:

- Human-friendly for interactive use
- Predictable in scripts and CI
- Safe for destructive operations
- Clear in output, errors, and exit semantics

Primary reference: `references/CLI_GUIDELINES.md`.

## Working stance

Be direct and engineering-first. If a design is fragile, ambiguous, or hostile to automation, call it out and propose concrete fixes.

## Non-negotiable checks (fast fail)

Treat any failure below as P0.

1. Non-interactive path is required

- Never make an interactive prompt the only input path.
- Every prompt needs a non-interactive alternative (flag/arg/file/stdin).
- If `stdin` is not a TTY, do not prompt. Fail with actionable guidance and required flags.
- Provide `--no-input` (or equivalent) to disable prompts.

1. Secrets safety

- Never accept secrets via flags (leaks via `ps` and shell history).
- Prefer stdin, `--secret-file`, OS keychain, or a TTY-only prompt with a non-interactive alternative.

1. Scriptability and CI behavior

- Detect TTY and adapt output and interactivity.
- Disable spinners/animations when stdout is not a TTY.
- Disable color when stdout/stderr are not TTY, when `NO_COLOR` is set, when `TERM=dumb`, or when `--no-color` is passed.
- Keep stdout clean for data; send status/progress/logging to stderr.

1. Output streams and exit codes

- Primary pipeable output goes to stdout.
- Logs, warnings, progress, and errors go to stderr.
- Exit 0 on success; non-zero on failure. Map non-zero codes to meaningful failure categories.

1. Risk-scaled safeguards

- For destructive actions, use confirmations that scale with risk.
- Support a scriptable bypass (e.g., `--force` or `--yes`), and consider `--confirm="resource-name"` for severe actions.
- Offer `--dry-run` for risky or complex state changes when possible.

1. Signals and cancellation

- Ctrl-C (SIGINT) should exit quickly with immediate feedback.
- Timebox cleanup and allow a second Ctrl-C to force exit if cleanup is slow.

## Quick triage questions

- Who is the user: interactive human, script/CI, or both?
- What is the job-to-be-done: query/list state, or change state?
- What are the core objects and verbs?
- What must stay stable for automation (output format, exit codes, flags)?

## Procedure: Design a new CLI (or add a command)

### Step 1: Propose a command model

- Keep the initial surface area small.
- Choose one model and stay consistent:
- Single command + flags for simple tools.
- Subcommands (often noun-verb or verb-noun) for multi-task tools.

Deliverable:

- List of commands with one-line purposes.

### Step 2: Decide positional args vs flags

Heuristic:

- Use positional args only for obvious primary object(s) where order is standard and unambiguous.
- If two positionals can be confused (similar shape/meaning) or order is not obvious, use flags instead.
- Prefer long flags. Use short flags only for the most common options, and keep them consistent across commands.

Deliverable:

- Usage line + args/flags tables per command.

### Step 3: Define output contract (human + machine)

- Define exactly what goes to stdout vs stderr.
- Provide at least one machine-readable mode when helpful (commonly `--json`).
- Keep human-readable output scannable and useful.

Deliverable:

- `stdout` content
- `stderr` content
- Exit-code map
- High-level `--json` schema (if supported)

### Step 4: Write help text and examples

- `-h/--help` must work even when other args are wrong.
- If run incorrectly, show a short error + the relevant usage + "use --help".
- Lead help with examples (common first). Provide a docs/support path in top-level help.

Deliverable:

- Draft help text for top-level and relevant subcommands.

### Step 5: Define errors and safety

- Errors must be actionable: what failed, why, and how to fix it.
- Do not hide important failures behind generic codes or stack traces unless `--debug` is enabled.
- For state changes, give explicit feedback about what happened (or what would happen in `--dry-run`).

Deliverable:

- Error-message patterns + safety/confirmation design.

### Step 6: Specify interactivity and TTY rules

- Only prompt when stdin is a TTY.
- If piped input is supported, read it. If not, fail quickly with guidance.
- Provide clear quiet and verbose modes if logs exist.

Deliverable:

- TTY behavior table (TTY vs non-TTY).

### Step 7: Add config and env vars (only if needed)

Use explicit precedence to avoid hidden config behavior:

1. Flags
2. Environment variables
3. Project-level config
4. User-level config (XDG, e.g. `~/.config/<tool>/config`)
5. System-wide config

Deliverable:

- Config keys + precedence + storage locations.

## Procedure: Review an existing CLI

Produce two outputs.

### A) Scorecard (0-2 each)

- Command structure and naming
- Args/flags clarity
- Help discoverability (examples first)
- stdout/stderr correctness
- Exit-code discipline
- Scriptability (non-TTY behavior)
- Machine-output mode (when appropriate)
- Safety (`--dry-run`, confirmations)
- Secrets handling
- Signal handling (Ctrl-C)
- Config precedence (if applicable)
- Future-proofing (avoid time bombs)

### B) Prioritized fixes

- P0: correctness, safety, and scriptability failures
- P1: usability and discoverability issues
- P2: polish and consistency

## Templates

### Help skeleton

NAME
<tool> - <one line value prop>

USAGE
<tool> <command> [options] <args>

EXAMPLES
<tool> <command> ...
<tool> <command> ... --json | jq .

OPTIONS
-h, --help Show help
--json Output machine-readable JSON (if supported)
--no-color Disable color
--no-input Disable prompts
-q, --quiet Reduce non-essential output (if supported)
-v, --verbose Increase logging (if supported)
-n, --dry-run Describe changes without applying them (if supported)

SUPPORT
<docs / issues link>

### Error skeleton

Error: <what failed in plain language>.
Cause: <most likely reason>.
Fix: <exact next step / command / flag>.

## References

- Full guideline text: `references/CLI_GUIDELINES.md`

Files in this skill

  • SKILL.md6.5 KB
  • description_ar.txt355 B
  • description_cn.txt200 B
  • description_de.txt283 B
  • description_en.txt211 B
  • description_es.txt266 B
  • description_fr.txt295 B
  • description_it.txt254 B
  • description_ja.txt335 B
  • description_ko.txt254 B
  • description_ru.txt519 B
  • description_tw.txt206 B
  • stats.json66 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.