unix-cli

Enforce UNIX and POSIX CLI conventions for argument parsing, exit codes, and stdout/stderr separation.

Updated Mar 11, 2026
One-click install
npx skills add https://github.com/selfagency/agentsy --skill unix-cli-selfagency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unix-cli
Source: https://github.com/selfagency/agentsy/tree/main/.agents/skills/unix-cli
Command: npx skills add https://github.com/selfagency/agentsy --skill unix-cli-selfagency

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill prevents command-line tools from breaking scripts and pipelines by enforcing UNIX/POSIX conventions for argument parsing, exit codes, and stdout/stderr separation.

Core Features & Use Cases

  • Argument & Flag Design: Define options clearly (prefer flags, support long options, use standard parsing libraries) so automation stays reliable.
  • Exit Codes & Error Semantics: Return 0 only for success and use standard exit-code conventions, including signal-based termination codes (128+N).
  • Composable I/O Behavior: Keep data on stdout and diagnostics on stderr, support stdin/stdout filtering patterns, and adapt interactive output to TTY using NO_COLOR rules.
  • Best-fit scenarios: Use it when designing or reviewing tools that will be used in shells, CI pipelines, batch processing, or as filters in UNIX pipelines.

Quick Start

Use the unix-cli skill to review your CLI’s behavior on exit codes, stdout/stderr usage, and help/usage output before releasing it.

Frequently Asked Questions about unix-cli

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

FAQPage Schema
How do I handle stdout and stderr separation to make my CLI composable in pipelines?

To ensure composable CLI behavior, route all machine-readable data to stdout and send diagnostics or error messages to stderr. This separation prevents pipeline corruption when your tool's output is piped into downstream scripts.

What are the standard exit code conventions for POSIX command-line tools?

POSIX exit codes require returning 0 for success and non-zero for failures, using standard conventions like sysexits for specific errors and 128+N for signal-based termination. This deterministic behavior makes CLI tools safe to script and automate.

Why does my CLI tool break when piped into a script, and how do I fix the argument parsing?

CLI tools break scripts when argument parsing is non-deterministic or output streams are mixed. Fix this by using standard parsing libraries, supporting long and short flags, and ensuring help and version output goes to the correct streams.

Does my command-line tool need to adapt interactive output when it detects a TTY?

Yes, composable CLI tools should detect TTY environments to adapt human-readable output, applying rules like NO_COLOR for pipelines. This ensures deterministic machine parsing while maintaining usability for direct terminal usage.

What is the best way to audit a CLI for POSIX compliance before releasing it?

The best way to audit a CLI is to review its exit codes, stdout/stderr separation, signal handling, and help/usage output against POSIX conventions. This ensures the tool will not break automation when used in shells or CI pipelines.