cli-developer by jeffallan/claude-skills
npx skills add https://github.com/jeffallan/claude-skills --skill cli-developer--help 输出来进行验证。<cli> --help 以验证帮助文本是否正确呈现,并运行 <cli> --version 以确认版本输出。根据上下文加载详细指导:
| 主题 | 参考 | 加载时机 |
|---|---|---|
| 设计模式 | references/design-patterns.md |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 子命令、标志、配置、架构 |
| Node.js CLI | references/node-cli.md | commander, yargs, inquirer, chalk |
| Python CLI | references/python-cli.md | click, typer, argparse, rich |
| Go CLI | references/go-cli.md | cobra, viper, bubbletea |
| 用户体验模式 | references/ux-patterns.md | 进度条、颜色、帮助文本 |
#!/usr/bin/env node
// npm install commander
const { program } = require('commander');
program
.name('mytool')
.description('Example CLI')
.version('1.0.0');
program
.command('greet <name>')
.description('Greet a user')
.option('-l, --loud', 'uppercase the greeting')
.action((name, opts) => {
const msg = `Hello, ${name}!`;
console.log(opts.loud ? msg.toUpperCase() : msg);
});
program.parse();
有关 Python (click/typer) 和 Go (cobra) 的快速入门示例,请参阅 references/python-cli.md 和 references/go-cli.md。
--help 和 --version 标志不必要地阻塞同步 I/O — 改用异步读取或流处理。
当输出将被管道传输时打印到 stdout — 将日志/诊断信息写入 stderr。
当输出不是 TTY 时使用颜色 — 在应用颜色前进行检测:
// Node.js
const useColor = process.stdout.isTTY;
# Python
import sys
use_color = sys.stdout.isatty()
// Go
import "golang.org/x/term"
useColor := term.IsTerminal(int(os.Stdout.Fd()))
破坏现有的命令签名 — 将标志/子命令的重命名视为破坏性变更。
在 CI/CD 环境中要求交互式输入 — 始终通过标志或环境变量提供非交互式后备方案。
硬编码路径或平台特定逻辑 — 使用 os.homedir() / os.UserHomeDir() / Path.home() 代替。
发布时不包含 Shell 自动补全 — 上述所有三个框架都内置了自动补全生成功能。
在实现 CLI 功能时,请提供:
CLI 框架 (commander, yargs, oclif, click, typer, argparse, cobra, viper), 终端用户界面 (chalk, inquirer, rich, bubbletea), 测试 (快照测试、端到端测试), 分发 (npm, pip, homebrew, releases), 性能优化
每周安装量
989
代码仓库
GitHub 星标数
7.3K
首次出现
2026年1月20日
安全审计
安装于
opencode830
gemini-cli804
codex795
github-copilot751
claude-code735
cursor716
--help output before writing code.<cli> --help to verify help text renders correctly and <cli> --version to confirm version output.Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Design Patterns | references/design-patterns.md | Subcommands, flags, config, architecture |
| Node.js CLIs | references/node-cli.md | commander, yargs, inquirer, chalk |
| Python CLIs | references/python-cli.md | click, typer, argparse, rich |
| Go CLIs | references/go-cli.md | cobra, viper, bubbletea |
| UX Patterns | references/ux-patterns.md | Progress bars, colors, help text |
#!/usr/bin/env node
// npm install commander
const { program } = require('commander');
program
.name('mytool')
.description('Example CLI')
.version('1.0.0');
program
.command('greet <name>')
.description('Greet a user')
.option('-l, --loud', 'uppercase the greeting')
.action((name, opts) => {
const msg = `Hello, ${name}!`;
console.log(opts.loud ? msg.toUpperCase() : msg);
});
program.parse();
For Python (click/typer) and Go (cobra) quick-start examples, see references/python-cli.md and references/go-cli.md.
--help and --version flagsBlock on synchronous I/O unnecessarily — use async reads or stream processing instead.
Print to stdout when output will be piped — write logs/diagnostics to stderr.
Use colors when output is not a TTY — detect before applying color:
// Node.js
const useColor = process.stdout.isTTY;
# Python
import sys
use_color = sys.stdout.isatty()
// Go
import "golang.org/x/term"
useColor := term.IsTerminal(int(os.Stdout.Fd()))
Break existing command signatures — treat flag/subcommand renames as breaking changes.
Require interactive input in CI/CD environments — always provide non-interactive fallbacks via flags or env vars.
Hardcode paths or platform-specific logic — use os.homedir() / os.UserHomeDir() / Path.home() instead.
Ship without shell completions — all three frameworks above have built-in completion generation.
When implementing CLI features, provide:
CLI frameworks (commander, yargs, oclif, click, typer, argparse, cobra, viper), terminal UI (chalk, inquirer, rich, bubbletea), testing (snapshot testing, E2E), distribution (npm, pip, homebrew, releases), performance optimization
Weekly Installs
989
Repository
GitHub Stars
7.3K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode830
gemini-cli804
codex795
github-copilot751
claude-code735
cursor716
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
Grimoire CLI 使用指南:区块链法术编写、验证与执行全流程
940 周安装
Grimoire Uniswap 技能:查询 Uniswap 元数据与生成代币/资金池快照的 CLI 工具
940 周安装
Grimoire Aave 技能:查询 Aave V3 元数据和储备快照的 CLI 工具
941 周安装
Railway CLI 部署指南:使用 railway up 命令快速部署代码到 Railway 平台
942 周安装
n8n Python 代码节点使用指南:在自动化工作流中编写 Python 脚本
943 周安装
Flutter Platform Views 实现指南:Android/iOS/macOS原生视图与Web嵌入教程
943 周安装