cli-architecture

Guide CLI framework selection and module structure for Python packages.

28|3|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/oborchers/fractional-cto --skill cli-architecture-oborchers
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cli-architecture
Source: https://github.com/oborchers/fractional-cto/tree/main/python-package/skills/cli-architecture
Command: npx skills add https://github.com/oborchers/fractional-cto --skill cli-architecture-oborchers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers choose the right framework and structure for command-line interfaces (CLIs) within Python packages, ensuring maintainability and good user experience.

Core Features & Use Cases

  • Framework Selection: Guides choices between argparse, Typer, and Click based on project needs.
  • Module Layout: Recommends patterns for organizing CLI code, from a single cli.py to a cli/ directory structure.
  • __main__.py Integration: Ensures seamless python -m package execution.
  • Entry Point Registration: Details how to configure pyproject.toml for script execution.
  • Exit Code Conventions: Standardizes return codes for success, error, and usage issues.
  • Use Case: When building a new Python tool, use this Skill to decide whether Click or Typer is more appropriate and how to lay out the command structure.

Quick Start

Use the cli-architecture skill to determine the best way to structure a new CLI for a Python package.

Frequently Asked Questions about cli-architecture

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

FAQPage Schema
How do I structure a Python CLI for a new package?▼

To structure a Python CLI, you can organize code into a single cli.py file or a cli/ directory, use __main__.py for python -m execution, and register entry points in pyproject.toml for maintainable command-line interfaces.

What is the best way to choose between Click, Typer, and argparse for a Python command-line interface?▼

Choosing between Click, Typer, and argparse depends on project needs: argparse is standard library, while Click and Typer offer advanced command structuring features for complex Python command-line interfaces.

How does __main__.py integration work for running Python packages from the command line?▼

The __main__.py integration works by delegating execution from the module to your CLI logic, ensuring seamless python -m package invocation for your Python command-line interface.

How do I configure entry points in pyproject.toml for script execution?▼

You configure entry points in pyproject.toml to register console scripts, enabling direct execution of your Python CLI commands from the terminal without requiring the python -m prefix.

What exit code conventions should I use for a Python CLI tool?▼

Standard exit code conventions for a Python CLI require returning zero for success, non-zero for errors, and specific codes for usage issues to standardize user experience and script automation.

What are common anti-patterns when building Python command-line interfaces?▼

Common anti-patterns when building Python command-line interfaces include poor module organization, improper entry point registration, and ignoring standard exit code conventions, which reduce maintainability and robustness.