Skillshub reviewing-cli-command
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.
install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/https-deeplearning-ai/sc-agent-skills-files/reviewing-cli-command" ~/.claude/skills/comeonoliver-skillshub-reviewing-cli-command && rm -rf "$T"
manifest:
skills/https-deeplearning-ai/sc-agent-skills-files/reviewing-cli-command/SKILL.mdsource content
Reviewing CLI Commands
Checklist for reviewing Typer CLI command implementations.
Review Process
- Read the command file
- Check each section below
- Report findings using output format at bottom
Structure
- File in
src/<cli_app>/commands/ - Has
andapp = typer.Typer()@app.command() - Command groups use
for each subcommand@app.command() - Registered in
withcommands/__init__.pyadd_typer() - Single commands:
without nameadd_typer(app) - Command groups:
add_typer(app, name="group")
Arguments & Options
- Uses
syntaxAnnotated - Arguments for required positional input
- Options for optional named parameters
- Short flags where appropriate (
,-f
)-q - Help text: lowercase, no period, brief
# 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.")
Error Handling
- Validates input before processing
- Exit codes: 0=success, 1=error, 2=invalid input
- Errors via
display.error() - Uses
after errorsraise typer.Exit(code) - Uses
for cancellationraise typer.Abort()
# 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
Output
- All output through
moduledisplay - No
,print()
, ortyper.echo()console.print()
# GOOD: display.success(f"Added '{task.title}'") # BAD: print(f"Added '{task.title}'")
Destructive Actions
- Has
/--force
flag-f -
withtyper.confirm()default=False - Shows "Cancelled" on abort
# 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)
Help Text
- Docstring exists
- Imperative mood ("Add a task" not "Adds a task")
- First line < 60 characters
Common Mistakes
| Mistake | Fix |
|---|---|
| |
| Wrong exit code | 0=success, 1=error, 2=invalid |
Missing on delete | Add force option with default False |
| Confirmation defaults Yes | in |
| Old Typer syntax | |
Missing | Each command file needs its own app |
| Not registered | in |
Review Output Format
## 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>