Skip to main content

design-a-cli

Design a command-line interface with coherent commands, arguments, output, errors, configuration, and compatibility for both people and scripts. Use when creating a new CLI, reshaping an existing command, or defining a stable shell-facing contract before implementation.

소스 정보

저장소
protosphinx/sphinxstack
최근 소스 활동
2026년 7월 29일 13:55
감지된 SKILL.md 언어
영어
스타
3
포크
0

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
2 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
design-a-cli
category
code
description
Design a command-line interface with coherent commands, arguments, output, errors, configuration, and compatibility for both people and scripts. Use when creating a new CLI, reshaping an existing command, or defining a stable shell-facing contract before implementation.
# design-a-cli Treat the command line as a public interface. Optimize the common human path while keeping output, exit behavior, quoting, and versioning predictable enough for automation. ## Inputs - Name the users, tasks, operating systems, shell environments, and automation consumers. - Gather existing commands, conventions, configuration sources, and compatibility commitments. - Separate required first-release tasks from possible future commands. ## Procedure 1. Write the three to five highest-value tasks as complete invocations with the intended result. 2. Choose a noun-verb or verb-noun command grammar and apply it consistently. Prefer discoverable words over abbreviations. 3. Define positional arguments, named options, defaults, repeatable flags, mutually exclusive choices, and input precedence. 4. Specify configuration precedence across flags, environment, project files, user files, and built-in defaults. 5. Design stdout for requested results and stderr for diagnostics. Define quiet, verbose, structured, and color behavior. 6. Assign stable exit codes to success, usage error, missing dependency, rejected input, remote failure, and partial result. 7. Write help for the root, each command, realistic examples, destructive effects, and recovery. Make help useful without network access. 8. Define interactive behavior and a non-interactive equivalent. Never let automation hang on an unexpected prompt. 9. Walk quoting, spaces, Unicode, paths, stdin, pipes, pagination, cancellation, and terminal-width cases. 10. Prototype the command surface and test it with a first-time user plus one shell script. 11. Publish a versioned CLI contract and the compatibility rules for renames, deprecated flags, and output changes. ## Boundaries Do not put secrets in command history, process arguments, or diagnostic output. Require explicit confirmation for destructive actions and support a non-interactive safety flag only when the caller acknowledges the target. Do not silently change machine-readable output. ## Done - A CLI contract lists commands, arguments, options, precedence, output channels, exit codes, and examples - Root and command help are tested by a first-time user without additional explanation - A script test verifies non-interactive behavior, structured output, quoting, and stable exit status - Compatibility and deprecation rules identify what may change and how consumers will be warned Then use write-a-technical-tutorial for a hands-on guide after the interface works.
GitHub에서 보기