cli-guidelines-resources-04

Design consistent CLI tools using clig.dev principles for structure and errors.

9|Updated Jan 31, 2017
One-click install
npx skills add https://github.com/ssiumha/dots --skill cli-guidelines-resources-04
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-guidelines-resources-04
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-04

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

User-friendly error messages and defensive patterns reduce confusion and improve recoverability when CLI tools fail.

Core Features & Use Cases

  • Human-friendly error messages with actionable guidance
  • Distinct error codes and consistent exit statuses
  • Example-driven guidance for common failure scenarios

Quick Start

Reference this resource when rewriting error handling to ensure consistent, helpful messages.

Frequently Asked Questions about cli-guidelines-resources-04

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

FAQPage Schema
How do I write error messages that help users recover from CLI failures?

Error handling in CLI tools should provide actionable guidance: describe what went wrong, why it happened, and what the user can do next. Use distinct error codes, consistent exit statuses, and example-driven scenarios for common failures to reduce confusion and improve recoverability.

What makes a CLI tool robust and user-friendly?

Robust CLI design combines descriptive error handling, clear exit codes, human-friendly messaging, and defensive patterns. These prevent confusion during failures, ensure consistent behavior across commands, and guide users toward solutions when things go wrong.

How do I structure help documentation and error output for consistency across CLI commands?

Apply resource-driven CLI design patterns covering help content, output formatting, error messages, arguments, flags, and subcommands. Consistent structure makes CLI behavior predictable, improves discoverability, and ensures users receive actionable feedback at every stage.

What exit codes and error statuses should my CLI tool use?

Exit codes communicate outcome to downstream processes and scripts. Assign distinct codes for different failure types—invalid input, missing resources, permission errors—so users and automation can respond appropriately. Pair codes with clear, descriptive error messages.

How do I make CLI output TTY-aware and improve user feedback?

TTY-aware behavior detects interactive terminals and adjusts output accordingly: use formatting and colors for human readers, plain text for piping. This ensures your CLI integrates smoothly into workflows, automation scripts, and provides appropriate feedback based on context.

When should I implement prompts and interactive behavior in a CLI tool?

Use interactivity and prompts when CLI tools require user confirmation, multiple choices, or sensitive input. Implement TTY detection to disable prompts in non-interactive contexts like scripts or automation, ensuring your tool works reliably across different execution environments.