typer-patterns

Generate type-safe Typer CLI patterns with Enums, sub-apps, and factories.

Updated Nov 11, 2025
One-click install
npx skills add https://github.com/vanman2024/cli-builder --skill typer-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typer-patterns
Source: https://github.com/vanman2024/cli-builder/tree/main/plugins/cli-builder/skills/typer-patterns
Command: npx skills add https://github.com/vanman2024/cli-builder --skill typer-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill delivers modern Typer-based CLI patterns with type hints, Enums, and sub-apps to build maintainable CLIs quickly.

Core Features & Use Cases

  • Type Hints Everywhere: End-to-end type annotations for clear APIs.
  • Enum-Based Options: Constrained choices with autocomplete.
  • Sub-Apps: Structured CLI with nested sub-apps for large CLIs.
  • Factory Pattern: Optional Typer app factories for testability.

Quick Start

Start with a basic Typer app, add sub-apps, and progressively enhance with enums and validators.

Frequently Asked Questions about typer-patterns

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

FAQPage Schema
How do I build a type-safe Python CLI with Typer?

Type-safe Python CLIs with Typer require end-to-end type hints on all parameters and return types, combined with Typer decorators and imports. This Skill provides patterns, templates, and example implementations that enforce type safety throughout your CLI, reducing bugs and improving IDE support for maintainable command-line applications.

What's the best way to structure sub-apps in a Typer CLI?

Sub-apps in Typer organize large CLIs into nested command groups using Typer's app factory pattern. This Skill covers structured architectures with nested sub-apps, dependency injection, and factory-pattern designs that scale CLI complexity while maintaining clear, testable code organization.

How do I use Enums for constrained CLI options in Python?

Enums in Python CLIs provide type-safe, autocomplete-friendly option choices. This Skill demonstrates enum-based options with Typer that constrain user input to valid values, enable shell completion, and integrate seamlessly with type hints for validated, maintainable command parameters.

Can I apply factory patterns to Typer apps for better testability?

Factory patterns with Typer apps decouple app initialization from business logic, enabling easier unit testing and dependency injection. This Skill covers optional factory-pattern architectures that improve test coverage and code reusability across CLI applications.

Do I need advanced Python knowledge to implement type hints in Typer CLIs?

Type hints in Typer require Python's type annotation syntax but this Skill provides templates and example CLIs that demonstrate practical patterns. Starting with basic apps and progressively adding sub-apps, enums, and validators makes type-safe CLI development accessible while building maintainability.