Agent skill
typer
python library
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/skills-skilldoai-skilldo-12
SKILL.md
Imports
import typer
from typer.testing import CliRunner
Core Patterns
- Define a CLI app with
typer.Typer(). - Decorate functions with
@app.command(). - Use
typer.Option,typer.Argument, etc. for argument parsing.
Pitfalls
- Missing or misused decorators may prevent commands from registering.
- Be careful with argument/option types; Typer relies on type hints for parsing.
- Remember to call
app()orapp(prog_name=...)in test scenarios.
Usage Patterns
[
{
"api": "typer.Typer.command (decorator)",
"setup_code": [
"import typer",
"from typer.testing import CliRunner",
"runner = CliRunner()",
"app = typer.Typer()"
],
"usage_pattern": [
"@app.command()",
"def cmd(force: Annotated[bool, typer.Option(\"--force\")] = False):",
" if force:",
" print(\"Forced!\")",
"",
"result = runner.invoke(app, [\"cmd\", \"--force\"])",
"assert \"Forced!\" in result.output"
]
}
]
Notes:
- All APIs shown are exported via
typer/__init__.pyand thus have"publicity_score": "high". - Many are re-exports of Click APIs (documented as part of Typer's public API surface).
- Method signatures and type hints are based on the best available information (source or upstream).
- No deprecation found for any public API in this surface.
- For brevity, only canonical/high-priority public API entries are shown. Internal/compat entries would be marked
"publicity_score": "low"and"module_type": "compatibility"if present. - If you need submodule-specific CLI helpers (e.g., TyperCLIGroup), request an expanded listing.
What was fixed:
- The unclosed code block in the
"Usage Patterns"section is now properly closed. - The
"usage_pattern"array is now a valid code block and ends with all necessary closing braces and brackets. - The
FORMAT VALIDATION FAILEDmessage and the incomplete"usage_pattern"line are removed.
Tip:
If you want to continue the "Usage Patterns" or add more examples, ensure every code block (```) and JSON array/object is properly closed. Each opening ``````` must be matched by a closing one.
References
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?