create-cli
它能做什么
这个技能帮助在构建命令行工具之前规划它的行为,包括命令、选项、输出和错误代码。适合正在开发新终端工具的开发者。
适用场景
- ✓你正在设计一个新的命令行工具的时候。
- ✓你想在可读输出、JSON 输出和退出代码之间做选择的时候。
- ✓某个命令需要安全选项,例如试运行或确认提示的时候。
技能链接
https://github.com/steipete/agent-scripts/blob/main/skills/create-cli/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想做一个导出笔记的命令行工具。请帮我设计它的命令和参数。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体只会问必要的问题以确定界面,然后编写一份紧凑的规格,包括命令树、选项、输出规则、错误代码和安全选项,并遵循公共命令行指南。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Create CLI
Design CLI surface area (syntax + behavior), human-first, script-friendly.
Do This First
- Read
agent-scripts/skills/create-cli/references/cli-guidelines.mdand apply it as the default rubric. - Upstream/full guidelines: https://clig.dev/ (propose changes: https://github.com/cli-guidelines/cli-guidelines)
- Ask only the minimum clarifying questions needed to lock the interface.
Clarify (fast)
Ask, then proceed with best-guess defaults if user is unsure:
- Command name + one-sentence purpose.
- Primary user: humans, scripts, or both.
- Input sources: args vs stdin; files vs URLs; secrets (never via flags).
- Output contract: human text,
--json,--plain, exit codes. - Interactivity: prompts allowed? need
--no-input? confirmations for destructive ops? - Config model: flags/env/config-file; precedence; XDG vs repo-local.
- Platform/runtime constraints: macOS/Linux/Windows; single binary vs runtime.
Deliverables (what to output)
When designing a CLI, produce a compact spec the user can implement:
- Command tree + USAGE synopsis.
- Args/flags table (types, defaults, required/optional, examples).
- Subcommand semantics (what each does; idempotence; state changes).
- Output rules: stdout vs stderr; TTY detection;
--json/--plain;--quiet/--verbose. - Error + exit code map (top failure modes).
- Safety rules:
--dry-run, confirmations,--force,--no-input. - Config/env rules + precedence (flags > env > project config > user config > system).
- Shell completion story (if relevant): install/discoverability; generation command or bundled scripts.
- 5–10 example invocations (common flows; include piped/stdin examples).
Default Conventions (unless user says otherwise)
-h/--helpalways shows help and ignores other args.--versionprints version to stdout.- Primary data to stdout; diagnostics/errors to stderr.
- Add
--jsonfor machine output; consider--plainfor stable line-based text. - Prompts only when stdin is a TTY;
--no-inputdisables prompts. - Destructive operations: interactive confirmation + non-interactive requires
--forceor explicit--confirm=.... - Respect
NO_COLOR,TERM=dumb; provide--no-color. - Handle Ctrl-C: exit fast; bounded cleanup; be crash-only when possible.
Templates (copy into your answer)
CLI spec skeleton
Fill these sections, drop anything irrelevant:
- Name:
mycmd - One-liner:
... - USAGE:
mycmd [global flags] <subcommand> [args]
- Subcommands:
mycmd init ...mycmd run ...
- Global flags:
-h, --help--version-q, --quiet/-v, --verbose(define exactly)--json/--plain(if applicable)
- I/O contract:
- stdout:
- stderr:
- Exit codes:
0success1generic failure2invalid usage (parse/validation)- (add command-specific codes only when actually useful)
- Env/config:
- env vars:
- config file path + precedence:
- Examples:
- …
Notes
- Prefer recommending a parsing library (language-specific) only when asked; otherwise keep this skill language-agnostic.
- If the request is “design parameters”, do not drift into implementation.
常见问题
它会直接写出完成的工具吗?
不会。它只生成一份紧凑的规格,供你或开发者去实现。
密钥应该通过参数传递吗?
不应该。技能规定,密钥永远不能通过参数传递。
它遵循哪些指南?
随附的参考资料,基于 clig.dev 上公开的命令行指南。
详情
热度
- GitHub 星标
- 7.4k
- 排名
- #13230
- 许可证
- MIT
- 更新时间
- 2026/10/30
评论
- …
同一仓库的更多技能
beeper
7.4k帮你的智能体搜索本地 Beeper 聊天记录,找到消息,并判断模糊线索指的是哪个聊天或联系人。
cloudflare-registrar
7.4k帮你的智能体查询 Cloudflare Registrar 的域名价格和可用性,并在确认后注册或列出域名。
codexbar
7.4k帮你的智能体查看你在 Codex、Claude、Kimi 等 AI 服务中还剩多少用量,包括限额、额度和重置时间。
frontend-design
7.4k帮你的智能体构建有独特风格、质量过硬的网页界面,给出清晰的设计方向,避免千篇一律的 AI 式布局。