kmaruthi2002/universal-llm-skills/cli-development

Claude Code and agent skill by kmaruthi2002/universal-llm-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Design and build command-line tools people and scripts can rely on: command and subcommand structure, flags and arguments, help text and error messages, exit codes, stdin/stdout/stderr discipline, human vs. machine-readable output (tables, JSON, colour, TTY detection), configuration precedence (flags, env vars, config files), interactivity and prompts, long-running operations, signals, cross-platform behaviour, testing, and packaging/distribution. Use when creating a CLI, adding commands or flags to one, improving help or errors, making output scriptable, or shipping a command-line tool. For one-off shell scripts use scripting-and-shell.

Install

npx vskill@latest install kmaruthi2002/universal-llm-skills/cli-development

SKILL.md

The same SKILL.md was published earlier as kmaruthi2002/universal-llm-skills/cli-development.

CLI Development

A command-line tool has two kinds of users: people at a terminal and programs that call it. People need discoverability, clear feedback, and forgiving defaults. Programs need stable output, meaningful exit codes, and no surprises. A good CLI serves both without compromising either, and treats its commands, flags, and output as a public interface that others will build on.

Scope

Covers designing and implementing reusable command-line tools in any language: interface design, I/O conventions, configuration, errors, interactivity, testing, and distribution.

Not covered:

  • Quick one-off automation scripts — see scripting-and-shell (though its scripts benefit from several conventions here).
  • Full-screen terminal UIs beyond prompts and progress — this skill touches them only briefly.
  • Designing HTTP APIs the CLI might call — see api-design (many of the same interface-stability ideas apply).

Core principles

1. The interface is a contract

Command names, flag names, argument order, output formats, and exit codes become dependencies the moment someone puts your tool in a script. Why: breaking them breaks automation silently and far from you. Design them deliberately, document them, and evolve them with deprecation rather than renaming freely.

2. Follow the conventions of the platform and the ecosystem

Users carry expectations from every other CLI they use: --help, --version, -h, -- to end options, - meaning stdin, long flags with --, short flags with -, combining short flags (-xvf), exit code 0 for success. Why: conventions are free usability; every deviation costs every user a moment of confusion. Guidelines such as POSIX utility conventions, GNU long-option conventions, and community guides (e.g. clig.dev) describe them.

3. Stdout is for data, stderr is for everything else

The primary output — what a user would pipe to another program — goes to stdout. Progress, logs, warnings, prompts, and errors go to stderr. Why: this lets tool | other-tool work while the user still sees messages, and lets scripts capture results without parsing around chatter.

4. Be human-friendly by default, machine-friendly on request, and never ambiguous

Default output is for people (readable, maybe colourful, maybe a table). Provide a stable machine format (--json or similar, or plain line-oriented output) for scripts. Detect when output is not a terminal and drop decoration. Why: optimizing only for humans makes the tool unscriptable; optimizing only for machines makes it unpleasant to use.

5. Fail loudly, clearly, and early

Validate input before doing work; on error, say what went wrong, why, and what to do next, then exit non-zero. Why: silent failure or exit code 0 on error breaks scripts in the worst way — they continue with bad data.

6. Be safe by default

Destructive or expensive operations require confirmation in interactive use, an explicit flag in non-interactive use, and offer a dry run. Why: CLIs are fast and repeatable, which makes mistakes fast and repeatable too.

Discovering context

Before building or changing a CLI:

  • If the tool exists: read its current commands, flags, help output, and output formats; find who calls it (scripts, CI, other tools) — these constrain changes. Match its existing naming style (kebab-case flags, verb-noun vs. noun-verb subcommands) even if you would choose differently.
  • Identify the language and argument-parsing library in use, or the ecosystem default if starting fresh (e.g. Python argparse, Click, Typer; Go cobra, urfave/cli, the standard flag package; Rust clap; Node commander, yargs, oclif; Java picocli; .NET System.CommandLine; shell getopts). Use the library's features (help generation, completion, validation) rather than hand-parsing.
  • Identify the audience and environments: developers, operators, CI pipelines, end users on Windows/macOS/Linux, containers, air-gapped servers.
  • If it is part of a family of tools (a company's CLIs, a framework's tooling), match the family's conventions for config locations, auth, output formats, and flags.

Command structure

Single-purpose vs. subcommands
  • A tool that does one thing (grep, jq) takes flags and arguments directly.
  • A tool that manages several resources or workflows uses subcommands (git commit, kubectl get pods, docker image ls).

Subcommand naming patterns:

PatternExampleFits
verb nountool create projectTools with a few universal actions over many resource types
noun verbtool project createTools with many resource types, each with its own actions; groups help by resource
flat verbstool build, tool deployWorkflow tools with few concepts

Pick one and use it consistently. Mixing patterns is the most common structural flaw.

Guidance:

  • Use consistent verbs across resources: if it is list for one, do not make it ls for another and show-all for a third (aliases are fine; the canonical name should be consistent).
  • Keep nesting shallow — two levels is usually enough.
  • Avoid ambiguous near-synonyms as separate commands (update vs. upgrade doing different things).
  • Do not allow arbitrary abbreviations of subcommands by prefix matching; it prevents adding new commands later without breaking someone's abbreviation. Explicit aliases are fine.
  • Running the tool with no arguments should show brief usage (or do the obvious default action if there is one), not do something destructive.
Arguments vs. flags
  • Positional arguments for the primary, obvious inputs, especially when there are one or two (cp SRC DEST) or a list of the same kind (rm FILE...).
  • Flags for everything optional, and for anything whose meaning would be unclear by position. Two positional arguments of different kinds are often fine; three is usually a sign that some should be flags.
  • Every flag should have a long form (--output); give short forms (-o) only to frequently used flags, since the single-letter namespace is small and permanent.
  • Use standard names where they exist: -h/--help, --version, -v/--verbose (or -v for version in some ecosystems — pick and be consistent), -q/--quiet, -o/--output, -f/--force, -n/--dry-run (beware: -n has other meanings in some tools), --json, --no-color, --yes/-y to skip confirmation, --config.
  • Boolean flags: --flag to enable and --no-flag to disable, when the default might need overriding.
  • Accept --flag=value and --flag value. Support -- to end option parsing, so filenames starting with - can be passed.
  • Accept - as a filename meaning stdin/stdout where file input/output is supported.
  • Flags that take a list: repeatable (--tag a --tag b) is usually clearer than delimited (--tags a,b); if you use delimiters, document escaping.
  • Prefer explicit names over clever ones: --older-than 7d is better than --age -7.
  • Validate values early: enumerated choices, ranges, file existence, mutually exclusive flags. Report all problems in one message if practical.

Help and documentation

Help text is the primary documentation for most users. It is read under time pressure, in a terminal.

Good help output:

  • Starts with one line saying what the command does.
  • Shows usage syntax (tool deploy [OPTIONS] ENVIRONMENT).
  • Lists the most common flags first, or groups flags by purpose in larger tools. Shows defaults and allowed values.
  • Includes a few examples of real invocations — users copy examples far more than they read flag descriptions.
  • Points to fuller documentation (a URL or man page) and to subcommand help.
  • Fits a typical terminal width (wrap around 80 columns, or to the detected width).

Behaviour:

  • -h and --help work on every command and subcommand, and tool help <command> if the ecosystem expects it. Help goes to stdout and exits 0 when requested; usage shown because of an error goes to stderr and exits non-zero.
  • On invalid usage, show a short error plus a hint (Run 'tool deploy --help' for usage.), not the full help wall.
  • Suggest corrections for typos (Unknown command 'delpoy'. Did you mean 'deploy'?) — most parsing libraries support this.
  • --version prints the version (and optionally build info) to stdout and exits 0.
  • Generate help, man pages, shell completions, and the reference docs from the same command definitions so they cannot drift. Ship completions for common shells (bash, zsh, fish, PowerShell); most libraries generate them.

Output

Human output
  • Lead with what the user needs. For a mutation, confirm what happened ("Created project 'atlas' (id prj_123)"). For a query, show the results. Do not print nothing on success if the user would wonder whether it worked — but also do not be chatty; ls-style tools rightly print only data.
  • Tables for lists of records, aligned, with headers; truncate long fields to the terminal width with a way to see full values (--wide, -o json).
  • Use colour and symbols to add meaning (errors red, success green, dim for secondary info), never as the only carrier of meaning — some users cannot see colour, and logs strip it.
  • Disable colour and animations when: stdout/stderr is not a TTY, NO_COLOR is set (a widely adopted convention), TERM=dumb, or --no-color is passed. Some tools also honour FORCE_COLOR / CLICOLOR_FORCE.
  • Show progress for operations longer than about a second or two (spinner or progress bar on stderr), and only when stderr is a TTY; in CI, print occasional plain status lines instead.
  • Print paths, IDs, and URLs in forms users can copy and paste.
Machine output
  • Provide a structured output mode (--json, --output json|yaml, or a --format template) for anything scripts might consume. JSON is the most broadly useful.
  • Machine output is a versioned contract: keep field names stable, add fields rather than renaming, and document the schema. Human output can change freely between releases; say so in docs, so nobody parses it.
  • In machine mode, print only the data to stdout — no banners, progress, or warnings mixed in (those go to stderr).
  • For list output in line-oriented mode, one record per line; offer null-delimited output (-0/--null) if values can contain newlines.
  • Consider a --quiet mode that prints only essential identifiers (e.g. the ID of a created resource) for easy capture in shell variables.
  • Stream large outputs rather than buffering everything; for JSON, newline-delimited JSON (one object per line) streams well.

Exit codes

  • 0: success. Anything else: failure. Scripts and CI depend on this more than anything else you produce.
  • Use a small, documented set of non-zero codes if callers need to distinguish failures. Common conventions: 1 general error, 2 usage error (invalid flags or arguments, as many parsing libraries and shells use). Some tools follow BSD sysexits.h (e.g. 64 usage, 65 data error, 69 unavailable, 75 temporary failure, 77 permission denied, 78 configuration error); choose one scheme and document it.
  • Codes above 125 have shell meanings (126 not executable, 127 not found, 128+N killed by signal N — e.g. 130 for Ctrl-C/SIGINT); do not use them for your own errors, but do exit with 130 after handling SIGINT if you mimic shell behaviour.
  • Partial success is a design decision: e.g. a batch where 3 of 100 items failed should usually exit non-zero and report which failed, unless a flag says otherwise. "Nothing to do" is usually success.
  • Commands that test a condition (tool check, diff-like tools) may use exit codes as answers (0 = same/healthy, 1 = different/unhealthy, 2 = error); document it clearly.

Errors

A good error message answers: what failed, why, and what the user can do.

  • Weak: Error: ENOENT
  • Strong: Error: config file not found at ~/.config/tool/config.toml. Run 'tool init' to create one, or pass --config PATH.

Guidance:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kmaruthi2002/universal-llm-skills/cli-development/badge)](https://verified-skill.com/skills/kmaruthi2002/universal-llm-skills/cli-development)

Something wrong with this skill or its page? Tell us.