skills/python-cli-typer/SKILL.md
Use when building or structuring Python CLI commands with Typer, including commands, options, and multi-command apps.
npx skillsauth add narumiruna/agent-skills python-cli-typerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use Typer for ergonomic CLI construction. Core principle: keep command wiring thin, explicit, and testable while moving business logic into regular Python functions.
uv add typer
| Task | Pattern |
| --- | --- |
| Single command | @app.command() |
| Options | function args with defaults |
| Multiple commands | multiple @app.command() |
| Module run | uv run python -m <package>.cli --help |
| Script run | uv run python cli.py --help |
| CLI tests | CliRunner().invoke(app, [...]) |
typer.Typer() app in cli.py.if __name__ == "__main__": app() for script/module execution or a project console script in pyproject.toml.uv run python -m <module> or uv run python cli.py.typer.testing.CliRunner.import typer
app = typer.Typer()
@app.command()
def greet(name: str, count: int = 1) -> None:
for _ in range(count):
typer.echo(f"Hello, {name}!")
if __name__ == "__main__":
app()
Usage:
uv run python cli.py --help
uv run python cli.py Alice
uv run python cli.py Alice --count 3
Module entry point:
uv run python -m my_package.cli --help
Multiple commands:
import typer
app = typer.Typer()
@app.command()
def create(name: str) -> None:
"""Create a new item."""
typer.echo(f"Creating {name}...")
@app.command()
def delete(name: str, force: bool = False) -> None:
"""Delete an item."""
if not force:
if not typer.confirm(f"Delete {name}?"):
raise typer.Abort()
typer.echo(f"Deleted {name}")
if __name__ == "__main__":
app()
CLI test:
from typer.testing import CliRunner
from my_package.cli import app
runner = CliRunner()
def test_greet() -> None:
result = runner.invoke(app, ["Alice", "--count", "2"])
assert result.exit_code == 0
assert "Hello, Alice!" in result.stdout
if __name__ == "__main__" for script entry.uv run.development
Score or compare one or more agent skills across trigger clarity, workflow actionability, safety boundaries, verification rigor, incremental knowledge value, and leanness. Use only when the user explicitly asks for ratings, numerical quality scores, rubric-based scorecards, or scored comparisons; use creating-agent-skills for unscored reviews or revisions.
development
Assess or improve an existing codebase's architecture when the user asks about module boundaries, coupling, scattered ownership, testability, change locality, deep modules, seams, or behavior-preserving structural refactoring. Use for cross-module design rather than ordinary diff review or a confirmed edge-case bug fix.
development
Perform read-only security audits, vulnerability assessments, or threat-focused reviews of diffs, pull requests, code paths, or explicitly scoped repositories when security is the primary objective or acceptance criterion. Use reviewing-code for ordinary review with baseline security coverage and hardening-code-paths for fixing confirmed findings.
development
Run iterative multi-reviewer panels over a code diff, verify their findings, apply explicitly authorized fixes, and re-review the updated change until it passes or reaches a stopping condition. Use when the user asks for a panel loop, multi-model code-review consensus, or a review-fix-re-review cycle.