click
- Repo stars 2,412
- License NOASSERTION
- Author repo debugpy
Skill: Click
Best practices for building CLI applications with Click including commands, groups, options, and testing.
When to Use
Apply this skill when building command-line interfaces with Click — commands, groups, options, arguments, and prompts.
Commands
- Use
@click.command()for single commands,@click.group()for multi-command CLIs. - Declare options with
@click.option()and positional args with@click.argument(). - Use
help=on every option and command for auto-generated help text. - Use
envvar=to allow environment variable fallback for sensitive options.
Groups
- Organize subcommands with
@click.group()andgroup.add_command(). - Use
@click.pass_contextto share state between group and subcommands.
Type Safety
- Use Click's built-in types (
click.Path(exists=True),click.Choice([...]),click.IntRange()). - Use callbacks for custom validation.
Testing
- Use
click.testing.CliRunner()for testing commands without subprocess overhead. - Assert on
result.exit_codeandresult.output. - Use
mix_stderr=Falseto test stderr separately.
Pitfalls
- Don't use
sys.exit()— useclick.exceptions.Exitor return from the command. - Don't use
print()— useclick.echo()for proper encoding handling. - Always handle
KeyboardInterrupt/ abort prompts gracefully.
- Fluxly category
- Other
- Author-declared agents
- No explicit declaration found; this is not inferred or tested compatibility
- Static check
- 94 / 100 · heuristic scan, not runtime safety proof
- Author / version / license
- @microsoft · NOASSERTION
- Fluxly token estimate
- Lean
- Fluxly setup estimate
- Guided setup
- External API key
- No requirement detected
- Detected OS requirements
- Unspecified
- Runtime requirements
- Unspecified
- Detected file/system behavior
-
- Read-only
- Shell exec
- Env read
- Detected network behavior
- Local-only
- Install commands
- None (reference only)
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
The current SKILL.md does not define a fixed output example. Apply this skill when building command-line interfaces with Click — commands, groups, options, arguments, and prompts.
Use @click.command() for single commands, @click.group() for multi-command CLIs. Declare options with @click.option() and positional args with @click.argument(). Use help= on every option and command for auto-generated help text.
Organize subcommands with @click.group() and group.addcommand(). Use @click.passcontext to share state between group and subcommands.
Use Click's built-in types (click.Path(exists=True), click.Choice([...]), click.IntRange()). Use callbacks for custom validation.
Use click.testing.CliRunner() for testing commands without subprocess overhead. Assert on result.exitcode and result.output. Use mixstderr=False to test stderr separately.
Don't use sys.exit() — use click.exceptions.Exit or return from the command. Don't use print() — use click.echo() for proper encoding handling. Always handle KeyboardInterrupt / abort prompts gracefully.
# Skill: Click
Best practices for building CLI applications with Click including commands, groups, options, and testing.
## When to Use
Apply this skill when building command-line interfaces with Click — commands, groups, options, arguments, and prompts.
## Commands
- Use `@click.command()` for single commands, `@click.group()` for multi-command CLIs.
- Declare options with `@click.option()` and positional args with `@click.argument()`.
- Use `help=` on every option and command for auto-generated help text.
- Use `envvar=` to allow environment variable fallback for sensitive options.
## Groups
- Organize subcommands with `@click.group()` and `group.add_command()`.
- Use `@click.pass_context` to share state between group and subcommands.
## Type Safety
- Use Click's built-in types (`click.Path(exists=True)`, `click.Choice([...])`, `click.IntRange()`).
- Use callbacks for custom validation.
## Testing
- Use `click.testing.CliRunner()` for testing commands without subprocess overhead.
- Assert on `result.exit_code` and `result.output`.
- Use `mix_stderr=False` to test stderr separately.
## Pitfalls
- Don't use `sys.exit()` — use `click.exceptions.Exit` or return from the command.
- Don't use `print()` — use `click.echo()` for proper encoding handling.
- Always handle `KeyboardInterrupt` / abort prompts gracefully. Author text anchors workflow facts; Fluxly only indexes current sections, terms, files, and commands.
sections -> When to Use → Commands → Groups → Type Safety → Testing → Pitfalls
terms -> Best practices for building CLI applications with Click including commands, groups, options, and testing. · Apply this skill when building command-line interfaces with Click — commands, groups, options, arguments, and prompts. · - Use @click.command() for single commands, @click.group() for multi-command CLIs. · - Organize subcommands with @click.group() and group.addcommand(). · - Use Click's built-in types (click.Path(exists=True), click.Choice([...]), click.IntRange()). · - Use click.testing.CliRunner() for testing commands without subprocess overhead. · - Don't use sys.exit() — use click.exceptions.Exit or return from the command.
files/cmd -> @click.command() · @click.group() · @click.option() · @click.argument() · help= · envvar= · group.addcommand() · @click.passcontext
body sha256 -> 14b8da56c09c
Decide Fit First
Design Intent
How To Use It
Boundaries And Review