AgentSkillsCN

unix-cli

UNIX 命令行界面指南——用于构建遵循 POSIX 规范、具备恰当退出码、流畅处理数据流,并贯彻 UNIX 哲学的工具。在编写、审查或设计 CLI 工具时,应使用此技能,以确保这些工具能够与 UNIX 工具链无缝集成。适用于涉及 CLI 工具、命令行参数、退出码、stdout/stderr、信号,或 Shell 脚本的任务。

SKILL.md
--- frontmatter
name: unix-cli
description: UNIX command-line interface guidelines for building tools that follow POSIX conventions, proper exit codes, stream handling, and the UNIX philosophy. This skill should be used when writing, reviewing, or designing CLI tools to ensure they integrate properly with the UNIX tool chain. Triggers on tasks involving CLI tools, command-line arguments, exit codes, stdout/stderr, signals, or shell scripts.

UNIX/POSIX Standards CLI Best Practices

Comprehensive guidelines for building command-line tools that follow UNIX conventions, designed for AI agents and LLMs. Contains 44 rules across 8 categories, prioritized by impact from critical (argument handling, exit codes, output streams) to incremental (configuration and environment).

When to Apply

Reference these guidelines when:

  • Writing new CLI tools in any language
  • Parsing command-line arguments and flags
  • Deciding what goes to stdout vs stderr
  • Choosing appropriate exit codes
  • Handling signals like SIGINT and SIGTERM

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Argument & Flag DesignCRITICALargs-
2Exit CodesCRITICALexit-
3Output StreamsCRITICALoutput-
4Error HandlingHIGHerror-
5I/O & CompositionHIGHio-
6Help & DocumentationMEDIUM-HIGHhelp-
7Signals & RobustnessMEDIUMsignal-
8Configuration & EnvironmentMEDIUMconfig-

Quick Reference

1. Argument & Flag Design (CRITICAL)

2. Exit Codes (CRITICAL)

3. Output Streams (CRITICAL)

4. Error Handling (HIGH)

5. I/O & Composition (HIGH)

6. Help & Documentation (MEDIUM-HIGH)

7. Signals & Robustness (MEDIUM)

8. Configuration & Environment (MEDIUM)

How to Use

Read individual reference files for detailed explanations and code examples:

Reference Files

FileDescription
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information