python-cli-patterns

Generate Typer and Rich CLI application templates with configuration and testing patterns.

29|6|Updated Nov 27, 2025
One-click install
npx skills add https://github.com/0xDarkMatter/claude-mods --skill python-cli-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-cli-patterns
Source: https://github.com/0xDarkMatter/claude-mods/tree/main/skills/python-cli-patterns
Command: npx skills add https://github.com/0xDarkMatter/claude-mods --skill python-cli-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) and references (resource) components.

What problem does it solve?

This Skill showcases modern CLI patterns using Typer and Rich to build robust command-line applications.

Core Features & Use Cases

  • Typer-based app skeletons, command groups, and rich output
  • Error handling, interactive prompts, and robust options
  • Quick templates and examples for real-world CLIs

Quick Start

Use the included asset cli-template.py to scaffold a production-ready CLI.

Frequently Asked Questions about python-cli-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a Python CLI application with Typer and Rich?

Typer and Rich together enable building robust Python CLI applications with typed arguments, subcommands, and rich formatted output. This Skill provides patterns and templates for command registration, configuration management, error handling, and interactive prompts across simple commands to complex multi-level subcommand structures.

What's the best way to structure a production-ready Python CLI with configuration and environment variables?

Modern Python CLIs use layered configuration combining environment variables, TOML files, and Pydantic models for validation. This Skill demonstrates composing state and context management, loading configuration from multiple sources, and organizing command groups and subcommands for maintainability in production applications.

How do I add progress displays and error handling to a Python command-line tool?

Rich provides UI components for progress bars and styled output, while Typer's structured error handling enables graceful failures. This Skill covers implementing robust error handling patterns, interactive prompts, and rich terminal displays within CLI applications using these frameworks.

Can I test Python CLI applications built with Typer?

Yes. This Skill includes testable CLI templates and patterns that isolate command logic from framework concerns, enabling unit and integration testing of Typer-based applications. The provided templates structure code for dependency injection and test coverage.

Do I need Typer and Rich to build modern Python CLIs, or are there alternatives?

Typer and Rich are modern, well-maintained choices for Python CLIs, but alternatives exist. This Skill specifically demonstrates patterns using Typer for command handling and Rich for output formatting; the underlying patterns are adaptable to other frameworks in the same category.

Where do I start building a Python CLI from scratch?

Use the included cli-template.py asset to scaffold a production-ready CLI foundation. It demonstrates command registration, argument typing, subcommand organization, configuration loading, and error handling—providing a ready-to-extend skeleton for real-world applications.