cli-guidelines-resources-03

Provide structured CLI design guidelines for resource-driven tooling.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Consistent and machine-friendly output handling ensures CLI programs communicate results effectively to both humans and automation.

Core Features & Use Cases

  • stdout vs stderr conventions, JSON output, and table formatting
  • TTY-aware color usage and paging
  • Structured, machine-readable output for automation

Quick Start

Implement or adapt output formatting to align with the provided outputs and consider adding a --json flag for structured data.

Frequently Asked Questions about cli-guidelines-resources-03

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

FAQPage Schema
How do I format CLI output for both humans and automation?

Structure output using stdout for results and stderr for errors, with optional --json flag for machine-readable formats. This separation ensures scripts and tools can reliably parse program output while users see readable text.

What's the best way to handle color and formatting in terminal output?

Detect TTY availability to conditionally apply colors and paging; disable colored output when piping to files or other commands. This prevents formatting codes from corrupting data while preserving readability in interactive terminals.

How should a CLI tool structure JSON output?

Output valid JSON to stdout with consistent schema, enabling downstream tools to parse results programmatically. Include structured metadata alongside data so automation can handle errors and validate responses.

When should I use exit codes in CLI design?

Use standardized exit codes (0 for success, non-zero for specific failures) so scripts can branch on program outcomes without parsing text output. This makes error handling predictable across different operating systems and shells.

Can I format tabular data for both display and parsing?

Yes—use aligned tables for terminal display and JSON or CSV formats via flags for automation. Dual formats let users read results interactively while scripts extract data reliably.

Why should CLI help text follow conventions?

Standardized help generation across tools reduces user friction and enables consistent documentation. Following conventions for flags, subcommands, and descriptions makes CLIs predictable and easier to integrate into workflows.