Click — CLI-приложения на Python
engineering
click is a Claude Code skill that provides best practices for building CLI applications with the Click framework, covering commands, groups, options, arguments, prompts, and testing. It guides usage of `@click.command()` for single commands and `@click.group()` with `@click.pass_context` for multi-command CLIs that share state across subcommands. Built-in types like `click.Path(exists=True)`, `click.Choice`, and `click.IntRange` handle type safety and validation, while `envvar=` enables environment variable fallback for sensitive options. Testing is done via `click.testing.CliRunner()`, asserting on `result.exit_code` and `result.output` with `mix_stderr=False` for isolated stderr checks. The skill also flags common pitfalls — using `sys.exit()` instead of `click.exceptions.Exit`, and `print()` instead of `click.echo()` for correct encoding handling.
- #click
- #cli
- #python
- #command-line
- #testing