python-cli-patterns_skill

This skill helps you create robust Python CLI applications using Typer and Rich patterns for commands, output, and error handling.
  • Shell

8

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill 0xdarkmatter/claude-mods --skill python-cli-patterns

  • SKILL.md4.0 KB

Overview

This skill provides practical patterns and templates for building Python CLI applications using Typer and Rich. It bundles examples for command grouping, argument and option handling, rich terminal output, progress reporting, and error handling to accelerate real-world CLI development. Use it as a starting point or reference when creating robust, user-friendly command-line tools.

How this skill works

The skill demonstrates a minimal Typer app structure with typed arguments, options, and commands, plus techniques for organizing multi-command CLIs via add_typer. It shows how to integrate Rich for tables, progress bars, and colored output, and includes a small error helper that prints messages and exits cleanly. Example assets and reference notes point to advanced patterns for configuration and formatting.

When to use it

  • When you need a lightweight, typed CLI with automatic help and completion.
  • To structure multi-command tools (subcommands like users create/list).
  • When you want polished terminal output (tables, panels, colored status).
  • To add progress indicators for long-running operations.
  • When you want consistent error messages and exit codes.

Best practices

  • Use Typer type hints for automatic validation and clear help text.
  • Group related commands with add_typer to keep the interface discoverable.
  • Keep console output separate from business logic; return structured results for testing.
  • Use Rich for user-facing displays and typer.echo for simple messages.
  • Provide explicit exit codes and uniform error handling with a small helper.

Example use cases

  • A developer tool with multiple subcommands: myapp users list / myapp users create.
  • A data-processing CLI that shows a Rich progress bar while processing items.
  • A deployment helper that prints summary tables of targets and statuses.
  • Quick utilities that accept typed flags and arguments and provide rich help text.
  • Scripts that validate config files and surface human-friendly errors on failure.

FAQ

Prefer Typer for new projects: it builds on Click, uses Python type hints for clearer APIs, and auto-generates helpful usage and completions.

When is Rich overkill?

Use Rich when you need formatted tables, progress, or colored messages. For tiny scripts that only print single-line output, stick to simple prints or typer.echo to avoid extra dependency complexity.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
python-cli-patterns skill by 0xdarkmatter/claude-mods | VeilStrat