Provides checklist for reviewing Typer CLI command implementations. Covers structure, Annotated syntax, error handling, exit codes, display module usage, destructive action patterns, and help text conventions. Use when user asks to review/check/verify a CLI command, wants feedback on implementation, or asks if a command follows best practices.
Checklist for reviewing Typer CLI command implementations.
src/<cli_app>/commands/app = typer.Typer() and @app.command()@app.command() for each subcommandcommands/__init__.py with add_typer()add_typer(app) without nameadd_typer(app, name="group")Annotated syntax-f, -q)# GOOD:
name: Annotated[str, typer.Argument(help="item name")]
force: Annotated[bool, typer.Option("--force", "-f", help="skip confirmation")] = False
# BAD:
name: str = typer.Argument(..., help="The name of the item.")
display.error()raise typer.Exit(code) after errorsraise typer.Abort() for cancellation# GOOD:
if id < 1:
display.error("ID must be positive")
raise typer.Exit(EXIT_INVALID_INPUT)
# BAD:
if id < 1:
print("Error: ID must be positive")
return
display moduleprint(), typer.echo(), or console.print()# GOOD:
display.success(f"Added '{task.title}'")
# BAD:
print(f"Added '{task.title}'")
--force / -f flagtyper.confirm() with default=False# GOOD:
if not force:
confirm = typer.confirm(f"Delete '{task.title}'?", default=False)
if not confirm:
display.info("Cancelled")
raise typer.Abort()
# BAD: defaults to Yes
confirm = typer.confirm(f"Delete?", default=True)
| Mistake | Fix |
|---------|-----|
| print() | display.success/error/warning/info() |
| Wrong exit code | 0=success, 1=error, 2=invalid |
| Missing --force on delete | Add force option with default False |
| Confirmation defaults Yes | default=False in typer.confirm() |
| Old Typer syntax | Annotated[type, typer.Argument()] |
| Missing app = typer.Typer() | Each command file needs its own app |
| Not registered | add_typer(app) in commands/__init__.py |
## Review: <command_name>
[OK] Uses Annotated syntax
[OK] Has docstring in imperative mood
[X] Missing --force flag on destructive command
[X] Uses print() instead of display module
[!] Help text could be shorter
### Summary
<brief summary of issues found>
### Suggested Fixes
<code suggestions if needed>
npx skills add https-deeplearning-ai/reviewing-cli-command下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer