Community编程与开发github.com

steipete/create-cli

CLI 用户体验/规范:参数、标志、帮助、输出、错误、配置、空运行。

create-cli 是什么?

这个技能为设计和规范命令行界面(CLI)提供了一套全面的指导原则,使开发者能够创建既人性化又适合脚本调用的工具。它涵盖了CLI设计的各个方面,包括命令结构、参数解析、帮助信息、输出格式、错误处理和配置管理。该技能强制要求首先阅读并应用 `cli-guidelines.md` 作为默认标准,并参考 `clig.dev` 的完整指南。它强调通过最少的澄清问题快速锁定界面,并在用户不确定时提供智能默认值。最终输出是一个紧凑的规范,包括命令树、参数表、子命令语义、输出规则、错误处理、安全规则(如 `--dry-run` 和确认机制)、配置优先级以及 shell 补全策略,并附带 5-10 个常见用例的示例。该技能是语言无关的,适用于任何编程语言或平台(macOS/Linux/Windows),并建议使用成熟的解析库来避免手动解析。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/steipete/agent-scripts/tree/main/skills/create-cli

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

创建 CLI

设计 CLI 交互面(语法 + 行为),以人为本,脚本友好。

首先执行

快速澄清

提问,如果用户不确定,则使用最佳猜测默认值继续:

  • 命令名称 + 一句话用途。
  • 主要用户:人类、脚本,或两者兼顾。
  • 输入来源:参数 vs stdin;文件 vs URL;秘密(绝不能通过标志传递)。
  • 输出契约:人类文本、--json、--plain、退出码。
  • 交互性:是否允许提示?是否需要 --no-input?破坏性操作是否需要确认?
  • 配置模型:标志/环境变量/配置文件;优先级;XDG 还是仓库本地。
  • 平台/运行时约束:macOS/Linux/Windows;单二进制文件还是运行时依赖。

交付物(需要输出的内容)

设计 CLI 时,生成一个用户可以实现的紧凑规范:

  • 命令树 + USAGE 语法摘要。
  • 参数/标志表(类型、默认值、必需/可选、示例)。
  • 子命令语义(每个子命令的功能;幂等性;状态变更)。
  • 输出规则:stdout vs stderr;TTY 检测;--json/--plain;--quiet/--verbose。
  • 错误 + 退出码映射(主要故障模式)。
  • 安全规则:--dry-run、确认机制、--force、--no-input。
  • 配置/环境变量规则 + 优先级(标志 > 环境变量 > 项目配置 > 用户配置 > 系统配置)。
  • Shell 补全方案(若相关):安装/可发现性;生成命令或绑定脚本。
  • 5–10 个示例调用(常见流程;包含管道/stdin 示例)。

默认约定(除非用户另有说明)

  • -h/--help 始终显示帮助信息并忽略其他参数。
  • --version 将版本信息打印到 stdout。
  • 主要数据输出到 stdout;诊断/错误信息输出到 stderr。
  • 添加 --json 用于机器输出;考虑使用 --plain 输出稳定的基于行的文本。
  • 仅当 stdin 是 TTY 时才进行提示;--no-input 禁用提示。
  • 破坏性操作:交互式需确认;非交互式需要 --force 或显式 --confirm=...。
  • 尊重 NO_COLOR、TERM=dumb;提供 --no-color。
  • 处理 Ctrl-C:快速退出;有限清理;尽可能支持崩溃安全。

模板(复制到回答中)

CLI 规范骨架

填写以下部分,删除不相关的内容:

  1. 名称:mycmd
  2. 一句话描述:...
  3. 用法:
    • mycmd [全局标志] <子命令> [参数]
  4. 子命令:
    • mycmd init ...
    • mycmd run ...
  5. 全局标志:
    • -h, --help
    • --version
    • -q, --quiet / -v, --verbose (精确定义)
    • --json / --plain (若适用)
  6. I/O 契约:
    • stdout:
    • stderr:
  7. 退出码:
    • 0 成功
    • 1 通用失败
    • 2 无效用法(解析/验证)
    • (仅在确实有用时添加特定命令的退出码)
  8. 环境变量/配置:
    • 环境变量:
    • 配置文件路径 + 优先级:
  9. 示例:
    • …

备注

  • 仅在询问时推荐解析库(语言特定);否则保持该技能语言无关。
  • 如果请求是“设计参数”,不要偏离到实现细节。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

steipete/agent-transcript

GitHub PR/issue agent transcripts: redact, preview, and insert safely.

steipete/beeper

Beeper cache: contact hints, room lookup, WhatsApp/iMessage traces, FTS.

steipete/browser-use

Existing Chrome automation: Chrome plugin first, mcporter fallback.

steipete/clawsweeper-status

ClawSweeper status: URLs, workflow health, active workers, ops snapshot.

steipete/clickclack

ClickClack ops: chat app, Hetzner deploy, DNS/docs/app, Docker rollout.

steipete/cloudflare-registrar

Cloudflare Registrar: domain availability, prices, registration via mcporter.

steipete/codex-debugging

Codex debugging: codex-rs core/tui/exec/cli/app-server/config.

steipete/discord-clawd

Discord-backed OpenClaw agent/session relay; not archive search.

steipete/domain-dns-ops

DNS/domain ops: registrars, zones, redirects, DNS/HTTP verify, manager truth.

steipete/frontend-design

Frontend UI: pages, apps, components, polished non-generic design.

steipete/github-author-context

GitHub contributor context: identity, activity, trust, company/team signal.

steipete/github-cache-hygiene

GitHub quota/cache hygiene: gh, ghx, xcache, gitcrawl, mirrors, limits.

steipete/github-deep-review

GitHub deep review: bugs, PRs, best fix, stale-or-real, read code first.

steipete/github-project-triage

GitHub issue/PR triage: queues, CI, blockers, risk, proof, next actions.

steipete/hopper-debugger

Hopper debugging: macOS/iOS binaries, ObjC/Swift symbols, dyld, LLDB.

steipete/instruments-profiling

Instruments/xctrace profiling: macOS/iOS traces, binaries, args, exports.

steipete/mac-maintenance

Mac upkeep: brew update/upgrade, pull clean repos, empty Trash.

steipete/maintainer-orchestrator

Open-source maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.

steipete/markdown-converter

Markdown conversion: PDF, Office, HTML, data, OCR, audio, ZIP, YouTube.

steipete/nano-banana-pro

Nano Banana/Gemini image gen/edit: text/image input, 512-4K workflows.

相关技能