cli-architecture

Standardize multi-command CLI architecture with explicit parameter flow.

Updated Jan 25, 2026
One-click install
npx skills add https://github.com/gestrich/python-architecture --skill cli-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-architecture
Source: https://github.com/gestrich/python-architecture/tree/main/plugin/skills/cli-architecture
Command: npx skills add https://github.com/gestrich/python-architecture --skill cli-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building CLI tools with multiple commands often leads to scattered argument parsing, inconsistent entry points, and unclear parameter flow. This skill standardizes the structure to deliver predictable, testable CLIs.

Core Features & Use Cases

  • Single entry point dispatcher: Routes commands from a single main.py to dedicated handlers.
  • Explicit parameter flow: Commands receive concrete parameters, not environment reads, improving testability.
  • Command organization: Clear separation between entry point, parsing layer, and business logic.
  • Use Case: Create a multi-command tool (e.g., greet, status, config) with easy extension and consistent behavior.

Quick Start

Build a minimal CLI with a main.py dispatcher and a sample command, then run: python -m mypackage greet --name Alice

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 with multiple commands to keep argument parsing maintainable?

A maintainable Python CLI uses a single __main__.py entry point to route commands to dedicated handlers. This separates argument parsing from business logic, ensuring explicit parameter flow and predictable, testable command functions.

What's the best way to make Python command line tool arguments testable?

To make command line arguments testable, route commands through a parser configuration that passes concrete parameters directly to command functions. This explicit parameter flow prevents hidden environment reads and simplifies unit testing.

Why does my multi-command CLI have scattered argument parsing and inconsistent entry points?

Scattered argument parsing happens when a multi-command CLI lacks a standardized dispatcher. Using a single __main__.py adapter layer to route commands ensures consistent entry points and centralizes argument parsing for the entire CLI tool.

How do I set up a __main__.py dispatcher for a Python command line tool?

Set up a __main__.py dispatcher by creating a cli/commands structure in your Python project. Configure a parser to route commands from this single entry point to dedicated handler functions, enabling clean command dispatch.

Can I extend a multi-command Python CLI with new commands without breaking existing ones?

Yes, you can extend a multi-command Python CLI by adding new handlers to the cli/commands structure. The single entry point dispatcher and explicit parameter flow ensure that adding commands does not break existing tool behavior.

Do I need a specific Python project structure to use a command dispatch architecture?

Yes, this command dispatch architecture requires a Python project containing a __main__.py entry point, a cli/commands directory structure, and a parser configuration to deliver explicit, testable command functions.