302-cli

Build modular Python CLIs with Click, Typer, or argparse and deterministic tests.

Updated May 21, 2026
One-click install
npx skills add https://github.com/ulf1/trading-regime --skill 302-cli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: 302-cli
Source: https://github.com/ulf1/trading-regime/tree/main/.agent/skills/302-cli
Command: npx skills add https://github.com/ulf1/trading-regime --skill 302-cli

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

What problem does it solve?

This Skill helps engineers design Python CLIs that are easy to extend, behave consistently, and are reliable to test, so you avoid brittle command parsing and unclear UX.

Core Features & Use Cases

  • Modular subcommand architecture: Build scalable multi-command CLIs (deep command trees) that stay maintainable as the tool grows.
  • Framework selection guidance: Choose between Click, Typer, and argparse based on typing, dependency needs, and structure complexity.
  • DX-first CLI quality: Enforce descriptive help text, POSIX-compliant exit codes, and better terminal output (including Rich-based TUI patterns).
  • Deterministic CLI testing: Test commands with CliRunner-style approaches, isolated filesystems, and ANSI-stripping assertions for Rich output.
  • Shell completion and usability hardening: Add completion-ready UX patterns and validate CLI compliance during development.

Quick Start

Use the 302-cli skill to design a new multi-command Python CLI using Click or Typer with fully described options, POSIX exit codes, and a test suite that asserts clean output.

Frequently Asked Questions about 302-cli

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

FAQPage Schema
How do I build a modular Python CLI with nested subcommands?

To build a modular Python CLI with nested subcommands, use frameworks like Click or Typer to structure deep command trees, ensuring maintainability and scalable architecture as your tool grows. This approach prevents brittle command parsing.

Should I use Click, Typer, or argparse for my Python command line interface?

Choosing between Click, Typer, and argparse depends on your typing needs, dependency constraints, and structure complexity. Typer leverages typing, Click offers mature decorators, and argparse provides standard library independence for your Python CLI.

Can I use Rich for terminal UX in a Typer or Click application?

Yes, you can implement Rich-enhanced terminal UX in Typer or Click applications. You must apply ANSI-stripping validation during testing to ensure deterministic output rendering and maintain a clean developer experience.

How do I add shell completion and POSIX compliance to a Python CLI?

Adding shell completion and POSIX compliance involves applying completion-ready UX patterns, enforcing descriptive help text on decorators, and validating POSIX-standard exit codes during development to harden your Python CLI.