一键导入
cli
Expert command-line interface development including argument parsing, subcommands, interactive prompts, and CLI best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Expert command-line interface development including argument parsing, subcommands, interactive prompts, and CLI best practices
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Docker and Docker Compose operations — build, run, compose, multi-stage
Documentation generation — API docs, READMEs, guides, changelogs
GitHub CLI (gh) comprehensive reference for repositories, issues, pull requests, Actions, projects, releases, gists, codespaces, organizations, extensions, and all GitHub operations from the command line.
React component development — hooks, state management, testing
Security scanning, vulnerability assessment, and hardening
Tailwind CSS — utility-first styling, responsive design, component patterns
| name | cli |
| description | Expert command-line interface development including argument parsing, subcommands, interactive prompts, and CLI best practices |
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
You are a Command Line Interface (CLI) expert specializing in argument parsing, subcommands, interactive prompts, and CLI best practices. Use this skill when the user needs help with:
| Language | Primary Library | Notes |
|---|---|---|
| Go | Cobra + Viper | De facto standard for Go CLIs |
| Python | Click | Composable, decorator-based |
| Rust | clap | Derive-based, feature-rich |
| Node.js | Commander.js | Mature, widely used |
-s / --long syntaxapp sub cmd)viper.AutomaticEnv() / click.option(envvar=...)var rootCmd = &cobra.Command{Use: "myapp", Short: "Does awesome things"}
var verbose bool
func init() {
cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output")
rootCmd.PersistentFlags().StringP("output", "o", "json", "output format (json|yaml|text)")
rootCmd.AddCommand(configCmd)
}
func initConfig() {
viper.AddConfigPath(os.UserHomeDir())
viper.SetConfigName(".myapp")
viper.AutomaticEnv()
viper.ReadInConfig()
}
func main() {
if err := rootCmd.Execute(); err != nil { os.Exit(1) }
}
@click.group()
@click.option('--verbose', '-v', is_flag=True)
@click.pass_context
def cli(ctx, verbose):
ctx.ensure_object(dict)
ctx.obj['verbose'] = verbose
@cli.command()
@click.argument('filename', type=click.Path(exists=True))
@click.option('--format', '-f', type=click.Choice(['json', 'yaml', 'text']), default='text')
@click.pass_context
def process(ctx, filename, format):
if ctx.obj['verbose']:
click.echo(f"Processing: {filename}")
# ... process and output
#[derive(Parser)]
#[command(author, version, about)]
struct Cli {
#[arg(short, long, default_value = "config.yaml")]
config: String,
#[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8,
#[command(subcommand)]
command: Commands,
}
if not click.confirm('Deploy to production. Continue?'):
click.echo('Cancelled.')
return
with click.progressbar(items, label='Processing') as bar:
for item in bar:
process(item)
// Go: capture output, set args, execute
buf := new(bytes.Buffer)
rootCmd.SetOut(buf)
rootCmd.SetArgs([]string{"--help"})
err := rootCmd.Execute()
# Python: Click test runner
runner = CliRunner()
result = runner.invoke(cli.process, [str(test_file)])
assert result.exit_code == 0
-s/--long), always provide --helpNO_COLOR; use progress indicators for long ops--verbose/--quietFor exhaustive patterns, examples, and advanced usage see: