Token导航 LogoToken导航

Agent Skill · 待分类

cli-design(CLI 设计)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

cli-design 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为权限未标注;许可证信息还不明确,第三方扫描已通过,按安装量在待分类类的 11,209 个 Skill 里排第 8,318。

总安装 306周安装 13GitHub Stars 643下载 107核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cli-design(CLI 设计)
来源仓库:https://github.com/citypaul/.dotfiles
仓库路径:skills/cli-design
安装命令:
npx skills add https://github.com/citypaul/.dotfiles --skill cli-design
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/citypaul/.dotfiles --skill cli-design

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

cli-design 提供命令行界面设计指导与最佳实践。适合在 Codex、Claude、Cursor、Gemini CLI 中优化终端用户体验时使用。关注提示友好性、错误信息与帮助文档的清晰度。当前无详细技能说明,请查阅 GitHub 仓库获取更多信息。

cli-design 属于待分类类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/cli-design

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/citypaul/.dotfiles --skill cli-design;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    权限没有明确标注,第一次使用时只给一个无关紧要的任务,观察它到底读了哪些文件和网络。

常见问题

6 条

cli-design 怎么安装?

在终端执行 npx skills add https://github.com/citypaul/.dotfiles --skill cli-design。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

cli-design 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

cli-design 需要什么权限?

权限级别没有明确标注。第一次使用时建议只给无关紧要的任务,观察它实际读写了哪些内容。

cli-design 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

cli-design 用的人多吗?

公开数据是累计安装 306 次,近一周安装 13 次,下载 107 次,GitHub 643 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

cli-design 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
cli-design

CLI 设计 · 本页

306643权限未标注未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
cli-design
description
Unix-composable CLI design patterns. Use when building CLI tools, designing command trees, implementing output layers, or testing CLI behavior. Covers stream separation (stdout/stderr), format flags (--json/--plain), exit codes, TTY detection, composability, and error design. Language-agnostic principles; TypeScript implementation patterns in resources/. For API design (REST, HTTP), see api-design.

CLI Design: Unix-Composable Command-Line Interfaces

This skill covers language-agnostic CLI design principles. The rules about stream separation, exit codes, format flags, and composability apply regardless of implementation language.

For API contract stability and Hyrum's Law, see the api-design skill. For config, env vars, and graceful shutdown, see the twelve-factor skill.

TypeScript implementation patterns are in the resources/ directory. Load them on demand when building a CLI in TypeScript:

ResourceLoad when...
output-architecture.mdImplementing Result types, entry point wiring, formatters, logger, JSON envelope schemas
testing-cli.mdWriting Vitest tests for CLI behavior (streams, exit codes, pipes, contract tests)
stream-contracts.mdUnderstanding Node.js buffering, NDJSON, signal handling, crash-only design

When to Use

  • Building any command-line tool (any language)
  • Designing command tree, flags, and I/O contracts
  • Implementing the output layer (format detection, stream routing)
  • Testing CLI behavior (stdout/stderr separation, exit codes)
  • Reviewing a CLI for Unix composability

Core Principle

stdout is for DATA only — the product the user asked for. stderr is for EVERYTHING ELSE — diagnostics, progress, spinners, warnings, errors.

This separation is what makes mycli --json | jq ... work. One spinner character on stdout breaks every downstream pipe.

"Whatever software you're building, you can be absolutely certain that people will use it in ways you didn't anticipate. Your software will become a part in a larger system — your only choice is over whether it will be a well-behaved part." — clig.dev

The Unix Stream Contract

ContentStreamWhy
Primary output (data, results, JSON)stdoutPipeable, buffered for throughput
Progress bars, spinners, statusstderrNot data — must not corrupt pipes
Warnings, errors, diagnosticsstderrVisible to user even when stdout is piped
Debug/verbose outputstderrDiagnostic, never data

Buffering behavior:

  • stdout: line-buffered when connected to a TTY, block-buffered when piped (~2x faster than stderr)
  • stderr: unbuffered — every write is a syscall (immediate but expensive)
  • Check each stream independently — stdout being piped does not mean stderr is piped

When stdout is piped, the user doesn't want your status messages in their data. All non-data output must go to stderr.

For a deep dive on buffering behavior and performance implications, see resources/stream-contracts.md.


Keep Handlers Pure

The practical rule: functions that do the work should return data, not write to stdout. The CLI entry point handles all I/O.

Entry point (CLI main)              Your logic (handlers)
─────────────────────               ─────────────────────
parse args                          (input) → structured result
detect format (json/plain/human)    no printing to stdout
call handler                        no writing to stderr
format the result                   no calling exit
write to correct stream             just returns data
set exit code

This isn't an architecture mandate — it's just clean function design. The benefits are concrete:

  • Testable without subprocess spawning — call the handler, assert on the returned value
  • Format flexibility for free — same data renders as JSON, plain text, or coloured tables by swapping one function
  • Reusable — the same handler works from a CLI, MCP server, HTTP API, or programmatic import

For simple CLIs where the "handler" is just calling a library, this separation already exists naturally — your library returns data, your CLI formats it. No extra layers needed.

If your project uses hexagonal architecture, the mapping is direct: the CLI entry point is a driving adapter, and the handler is a use case that returns a result through a port. See the hexagonal-architecture skill — the patterns reinforce each other, but hex arch is not required to benefit from keeping handlers pure.

For TypeScript implementation patterns (Result types, entry point wiring, formatters, logger interfaces), see resources/output-architecture.md.


Format Flag Contract

Three-tier output hierarchy:

Default: Human-Readable

  • Colors, tables, formatted text
  • Progress bars and spinners on stderr
  • Output tailored for terminal width
  • May change between versions — this is not a contract

--plain: Grep/Awk-Friendly

  • One record per line, no formatting, no colors
  • Stable between minor versions — this is a contract
  • Flat table rows, no borders, no grouped sections
  • Enables: mycli list --plain | grep error | wc -l
"Encourage your users to use --plain or --json in scripts to keep output stable." — clig.dev

--json: Structured Data

  • stdout contains ONLY valid JSON — no spinners, no color, no progress
  • stderr continues normally — human diagnostics still visible
  • Errors are structured JSON too — not just success responses
  • Schema is versioned — breaking changes to JSON output are breaking changes to the CLI
  • --json implies non-interactive regardless of TTY

Consistent envelope:

{ "ok": true, "data": { ... } }
{ "ok": false, "error": { "code": "CONFIG_MISSING", "message": "...", "fix": "..." } }

NDJSON for Streaming

For large datasets, use NDJSON (one JSON object per \n):

  • Each line is independently parseable
  • Include a type field per record for multiplexing events
  • Final line can be a summary record
  • Enables: mycli run --format ndjson | while read -r line; do ...; done

For NDJSON specification details, see resources/stream-contracts.md.


Exit Codes

CodeMeaningWhen
0SuccessOperation completed as expected
1Domain failureTool-specific failure (e.g. quality threshold not met)
2Invalid usageBad flags, missing required args, validation error
78Configuration errorInvalid config file, missing required config
75Temporary failureNetwork timeout, service unavailable — retry may help
130SIGINTUser pressed Ctrl-C (128 + 2)
143SIGTERMProcess terminated (128 + 15)

Rules:

  • Non-zero exit code MUST have a stderr explanation
  • Document exit codes in --help
  • Never use codes above 125 for application errors (reserved for signals: 128 + signal number)
  • Exit code 75 (transient) is critical — it tells retry logic the failure may be temporary
  • Map non-zero codes to the most important failure modes for your tool

TTY Detection

Check priority order (first match wins):

PriorityConditionEffect
1--format json or --json flagNon-interactive, no color, no animation
2--no-color flagDisable color (output may still be interactive)
3NO_COLOR env (non-empty)Disable color
4FORCE_COLOR envEnable color regardless
5TERM=dumbDisable color and animations
6CI=trueNo interactive prompts
7stdout is not a TTY (!isatty(stdout))Plain output, no animations on stdout
8DefaultFull interactive with colors

Check stdout and stderr independently. When stdout is piped but stderr is a TTY, you can still show spinners on stderr while keeping stdout clean for the pipe consumer.

Optionally support MYCLI_NO_COLOR for app-specific color override.


Input Design

Flags Over Arguments

  • 1 positional arg: acceptable (the "main thing")
  • 2 positional args: suspicious — consider flags instead
  • 3+ positional args: never acceptable

Flags are self-documenting, order-independent, and future-proof.

# Bad — which is source, which is destination?
mycli copy myapp backup

# Good — explicit
mycli copy --from myapp --to backup

Standard Flags

Always provide long forms. Short flags only for the most common operations.

FlagMeaning
-h, --helpShow help (this should only mean help)
--versionPrint version to stdout
-q, --quietSuppress non-essential output
-v, --verboseMore detail in human output
-d, --debugDiagnostic output to stderr
-f, --forceSkip confirmation prompts
-n, --dry-runShow what would happen without doing it
--jsonStructured JSON output
--plainStable, grep-friendly plain text
--no-colorDisable color output
--no-inputDisable all prompts/interactivity
-o, --outputOutput file

Prompts and Interactivity

  • All prompts MUST be bypassable via flags for scriptability
  • Confirmation → --yes or --force
  • Selection → --type=value
  • Text input → --name=value
  • Passwords → --password-file=path or stdin pipe
  • If stdin is not a TTY, never prompt — fail with a clear error or use defaults
  • Secrets via files/stdin/env only — never via flag values (they leak to ps output and shell history)

Conventions

  • Support -- to stop flag parsing: mycli run -- --flag-for-child-process
  • Support - for stdin/stdout file arguments: curl ... | mycli process -
  • Accept both --flag=value and --flag value
  • If stdin is expected but is an interactive terminal, display help immediately (don't hang like cat)

Config Precedence

Highest to lowest priority:

  1. Flags — per-invocation overrides
  2. Environment variables — MYCLI_* prefix, per-session
  3. Project config — .myclirc, mycli.config.ts, or in package.json
  4. User config — ~/.config/mycli/ (follow XDG spec)
  5. Defaults — sensible built-in values

Rules:

  • Follow the XDG Base Directory Specification for config file locations
  • Env var naming: MYCLI_* prefix, uppercase letters + digits + underscores
  • Never accept secrets via flags — use env vars, files, or stdin
  • Read .env where appropriate, but don't use it as a substitute for proper config
  • If you modify configuration that belongs to another program, ask consent first

Error Design

Every error needs:

  1. Machine-readable code — UPPER_SNAKE_CASE (e.g. CONFIG_MISSING, AUTH_EXPIRED)
  2. What went wrong — context: which resource, operation, input
  3. How to fix it — exact command or action the user should take
  4. Reference — docs URL or mycli help <topic> (optional)

Human Mode

Error: CONFIG_MISSING — Configuration file not found
No configuration file found at ./mycli.config.ts or ~/.config/mycli/config.ts

Fix: Run `mycli init` to create a default configuration file
Docs: https://mycli.dev/docs/configuration
  • Put the most important information last (the eye is drawn to the end)
  • Use red sparingly and intentionally
  • Suggest corrections for typos ("Did you mean 'deploy'?")
  • Group similar errors under one header — don't repeat 50 similar-looking lines
  • Write debug logs to a file, not the terminal (unless --debug)

JSON Mode

Errors are structured too — not just success responses:

{
  "ok": false,
  "error": {
    "code": "CONFIG_MISSING",
    "message": "No configuration file found at ./mycli.config.ts",
    "fix": "Run `mycli init` to create a default configuration file",
    "transient": false
  }
}

The transient boolean tells retry logic whether the failure may be temporary.


Composability Patterns

Design for real-world pipes:

# Filter structured output
mycli list --json | jq '.data[] | select(.status == "failed")'

# Stream results for large datasets
mycli run --format ndjson | while read -r line; do echo "$line" | jq '.file'; done

# Feed stdin
cat previous-results.json | mycli report --format markdown

# Combine with other tools
mycli run --json | mycli diff --baseline previous.json

# Silent mode for CI — only exit code matters
mycli check --quiet || echo "Check failed!"

# Chain: create outputs an identifier, next command uses it
mycli create --json | jq -r '.data.id' | xargs mycli deploy --id

# Column selection for efficiency
mycli list --json --fields name,status,id | jq '.data[]'

# Parallel processing
mycli list --json --fields id | jq -r '.data[].id' | xargs -P4 mycli process --id

Key patterns:

  • Create commands output identifiers so subsequent commands can chain
  • List commands support --fields for column selection (reduces output size, critical for agent efficiency)
  • --quiet for CI scripts that only care about the exit code
  • NDJSON for streaming large datasets without buffering everything in memory
  • --dry-run with --json outputs planned changes as structured data

Subcommand Design

  • noun verb pattern is most common: mycli config set, mycli report generate
  • Be consistent across all subcommands — same flag names for same things
  • No ambiguous pairs (update vs upgrade is confusing)
  • No catch-all subcommands (you can never add subcommands with conflicting names)
  • No arbitrary abbreviations — aliases must be explicit and stable
  • With no args: list subcommands (multi-command CLI) or show help (single-command CLI)

Help

  • mycli --help — top-level help
  • mycli help <subcommand> — subcommand help
  • mycli <subcommand> --help — same as above
  • If run with missing required args, show concise help + 1-2 examples + "use --help for more"
  • Examples are the most-read section — lead with them
  • Include flag types, defaults, and allowed values for finite sets

Output Stability Contract

Stdout is a public API. Breaking changes to stdout format are breaking changes to the CLI.

ChangeImpact
Adding new optional JSON fieldsSafe (additive)
Adding new subcommandsSafe
Adding new flags with preserving defaultsSafe
Removing or renaming flagsBreaking
Removing or renaming JSON fieldsBreaking
Changing exit codesBreaking
Changing default behaviorBreaking
Changing human-readable outputUsually OK (not a contract)

When in doubt, add alongside — don't modify. Deprecate with stderr warnings before removing.


Anti-Patterns

#Anti-PatternWhy It's Wrong
1Mixing data and diagnostics on stdoutBreaks every pipe: `mycli list \jq .` fails if warnings are on stdout
2Colors/ANSI in piped outputANSI sequences corrupt downstream parsing. Check isatty(stdout) + NO_COLOR
3Interactive prompts with no flag bypassAgents can't type 'y'. Every prompt needs --yes/--force. Non-TTY without bypass = hang
4Printing nothing on successSilence is ambiguous — show brief confirmation. Offer -q for scripts that want silence
5Designing for humans OR machines, not bothDetect context (TTY vs pipe), adapt automatically
6Output that doesn't guide the next actionEvery output is a signpost: success = next command, failure = fix command
7Breaking existing CLI contractsFlag names, exit codes, output shape are contracts. Add alongside, never modify
8console.log anywhere except the CLI adapterHandlers must return data; only the presentation layer writes to streams
9Handlers that exit the process directlyLet the entry point decide. Handlers return errors as data
10Non-zero exit without stderr explanationScripts need both the code and the reason
11Verbose default outputA single test run can generate 419KB. Support --fields, --quiet, --json

Verification Checklist

After designing or reviewing a CLI:

  • [ ] stdout has ONLY data; stderr has everything else
  • [ ] Every command supports --json with consistent envelope
  • [ ] Exit codes are semantic and documented in --help
  • [ ] Every prompt has a --yes/--force/--flag bypass
  • [ ] Errors include: code, message, fix suggestion
  • [ ] --dry-run available for mutating commands
  • [ ] Progress/spinners go to stderr, never stdout
  • [ ] NO_COLOR, TERM=dumb, and --no-color respected
  • [ ] Piped output contains zero ANSI escape codes
  • [ ] Success output includes next-action guidance
  • [ ] Existing flags, exit codes, output fields never removed or renamed
  • [ ] JSON schema is versioned (additions safe, removals breaking)
  • [ ] Config follows flags > env > project > user > defaults
  • [ ] Secrets accepted only via files/stdin/env, never via flags
  • [ ] Startup < 500ms, print something in < 100ms
  • [ ] Ctrl-C exits fast with bounded cleanup
  • [ ] --help includes 2-3 realistic examples
  • [ ] Human output is grep-parseable (flat rows, no table borders)

Quick Reference

Stream Routing

stdout ← data, results, JSON, NDJSON
stderr ← progress, spinners, warnings, errors, debug, prompts

Format Hierarchy

Default (TTY)     → colors, tables, formatted text
--plain           → one record per line, stable, grep-friendly
--json            → structured JSON, versioned schema
--format ndjson   → streaming, one JSON object per line

Exit Codes

0   success
1   domain failure
2   invalid usage
75  temporary failure (retry)
78  config error
130 SIGINT (Ctrl-C)
143 SIGTERM

Config Precedence

flags > env vars > project config > user config > defaults

Flags Cheat Sheet

-h  --help        Show help
    --version     Print version
-q  --quiet       Less output
-v  --verbose     More output
-d  --debug       Diagnostic output
-f  --force       Skip prompts
-n  --dry-run     Preview changes
    --json        Structured JSON
    --plain       Grep-friendly text
    --no-color    Disable color
    --no-input    No prompts
-o  --output      Output file
    --fields      Select columns

平台分布

Codex

33.95%
按下载量换算36

Claude

31.25%
按下载量换算33

Cursor

18.46%
按下载量换算20

Gemini CLI

10.1%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

权限未标注

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills