typer-python

Build, review, and test Python command-line interfaces with Typer.

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/schattenspiegel/skill-foundry-skills --skill typer-python-schattenspiegel
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: typer-python
Source: https://github.com/schattenspiegel/skill-foundry-skills/tree/main/skills/typer-python
Command: npx skills add https://github.com/schattenspiegel/skill-foundry-skills --skill typer-python-schattenspiegel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires typer, and includes references (resource) components.

What problem does it solve? Writing Typer CLIs involves subtle decisions about arguments versus options, command topology, callbacks, exit codes, and testing that are easy to get wrong, leading to inconsistent user-facing command contracts and fragile tests. ## Core Features & Use Cases - Parameter and topology guidance: Classify fields as arguments or options, choose between single commands, peer commands, and nested sub-apps, and manage shared state through typed context objects. - Error and exit contract: Map user errors to concise stderr messages and nonzero exits while preserving diagnostics for programmer defects and keeping secrets out of output. - CliRunner testing: Test help output, success paths, invalid input, prompts, and side-effect boundaries against the Typer app rather than calling command functions directly. - Use Case: You are adding an export command to an existing Typer app and need typed path validation, a --force flag, correct exit codes, and tests that verify the output file is not overwritten without the flag. ## Quick Start Ask the assistant to write or review a Typer CLI command with typed arguments, options, exit handling, and CliRunner tests for your project.

Frequently Asked Questions about typer-python

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

FAQPage Schema
How do I write a Typer CLI with typed arguments and options?▼

Define a typer.Typer app and annotate command parameters with typing.Annotated plus typer.Argument for positional inputs and typer.Option for named flags. Keep Python defaults as the source of required/default semantics and call domain functions from the command adapter.

How do I test a Typer CLI with CliRunner?▼

Use typer.testing.CliRunner and invoke the app with representative argument lists, then assert on exit_code, output substrings, and side effects. Cover help output, success, invalid input, prompts via the input parameter, and the installed entry point in a subprocess.

When should I use typer.Argument versus typer.Option?▼

Use Argument for the primary ordered subject of a command such as a file or name, and Option for configuration, flags, secrets, or repeatable values. A required named value should be a required option rather than an option with a fake sentinel default.

Why did my single Typer command become a named subcommand?▼

Adding an app callback changes command topology, so Typer promotes a sole command function from the root invocation to a named subcommand. Lock the intended behavior with help and invocation tests before refactoring the app structure.

When should I not use Typer for a CLI?▼

Do not introduce Typer for a library API, a Click-only project, a one-off shell invocation, or Rich-only terminal rendering. Keep domain operations in ordinary Python functions and let Typer command functions only adapt terminal input and output.