Repository inventory

wdm0006/python-skills

Skills indexed from this repository, with install-style signals scoped to the repo.
7 skills42 GitHub stars0 weekly installsPythonGitHubOwner profile

Overview

This skill builds command-line interfaces for Python libraries using Click or Typer, providing patterns for command groups, argument handling, progress bars, shell completion, and testing. It packages ready-to-apply examples and a practical checklist so you can add robust CLI functionality to a library or create standalone command-line tools. The material emphasizes developer ergonomics, predictable UX, and testability.

How this skill works

The skill supplies example code and conventions: a Click-based group entry point, command definitions with arguments and options, file/stdin handling, progress bars, colored output, and error handling. It shows how to wire an entry point via pyproject.toml, enable shell completions, and exercise commands with Click's CliRunner for automated testing. Patterns are adaptable to Typer when you prefer type-hint-driven APIs.

When to use it

  • Adding CLI commands to a Python library for developer or user workflows
  • Building a standalone command-line tool that needs argument parsing and subcommands
  • Needing consistent stdin/stdout behavior for pipes and scripts
  • Implementing progress reporting and colored terminal output
  • Automating CLI tests and verifying error handling and exit codes

Best practices

  • Expose a single group entry point and declare it in pyproject.toml for easy installation
  • Support '-' for stdin/stdout using click.File and document behavior
  • Return non-zero exit codes and send error messages to stderr for scripting reliability
  • Write tests with click.testing.CliRunner for normal and stdin scenarios
  • Provide --help and --version for all commands and offer shell completion scripts
  • Use click.progressbar and click.secho for consistent UX across platforms

Example use cases

  • A data processing library that needs a CLI to run batch jobs and show progress
  • A developer tool that wraps project tasks (format, lint, release) as subcommands
  • A file converter that reads from stdin or a path and writes to stdout or a file
  • A deployment helper that needs colored, human-friendly status messages
  • Automated CI tests that invoke CLI commands and assert exit codes and output

FAQ

Use Click for mature, feature-rich control and Typer if you prefer modern type-hint-driven APIs; both can follow the same UX patterns shown here.

How do I test stdin-based commands?

Use click.testing.CliRunner and pass input as the input parameter, or invoke the command with '-' when you support click.File with default '-'.

7 skills

More from this maintainer
Other repositories and skills published under the same GitHub owner.
Skills library
Jump back to the full directory or explore grouped topics.
Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational