cli-guidelines-resources-02

Provide CLI design guidance for help, errors, flags, and subcommands.

9|Updated Jan 31, 2017
One-click install
npx skills add https://github.com/ssiumha/dots --skill cli-guidelines-resources-02
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-guidelines-resources-02
Source: https://github.com/ssiumha/dots/tree/main/prompts/skills/cli-guidelines
Command: npx skills add https://github.com/ssiumha/dots --skill cli-guidelines-resources-02

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Help and documentation patterns ensure users can quickly learn and effectively use CLI tools, with clear examples and proactive error suggestions.

Core Features & Use Cases

  • Help/usage examples, error suggestions, and usage patterns
  • Consistent flag design and long-form options
  • Structured, example-driven CLI documentation

Quick Start

Consult this resource to craft consistent CLI help and error guidance for new commands.

Frequently Asked Questions about cli-guidelines-resources-02

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write effective help and usage messages for CLI commands?

Help messages should provide clear, concise descriptions of what a command does, list available flags with long and short options, and include usage examples. Structure help to show command purpose first, then flags organized by category, with examples demonstrating common workflows to guide users quickly.

What's the best way to design error messages for command-line tools?

Error messages should be specific about what went wrong, suggest the correct action or flag syntax, and use consistent exit codes to signal failure types. Proactive suggestions—showing the user what they likely meant or what flag they forgot—reduce friction and help users self-correct without consulting documentation.

How should I structure flags and arguments in a CLI tool?

Use explicit long-form options (e.g., `--help`, `--output`) paired with short equivalents (e.g., `-h`, `-o`) for frequently used flags. Group related flags logically, document required versus optional arguments clearly, and maintain consistent naming conventions across subcommands to ensure predictable, UNIX-like behavior.

Can I apply consistent CLI design patterns across different programming languages?

Yes. Libraries like Click (Python), argparse (Python), clap (Rust), and cobra (Go) implement consistent patterns for help, flags, and error handling. Using these frameworks unifies development practices across languages and ensures your CLI follows established conventions users expect.

What output formatting should CLI tools use for TTY versus piped contexts?

Detect whether output is connected to a terminal (TTY) and adjust formatting accordingly: use colors and structured text for interactive terminals, plain text for pipes and redirects. This ensures output remains readable when piped to files or other tools while providing richer feedback in interactive sessions.