If you're building a Typer CLI and want consistency across commands, this gives you three battle-tested templates: single commands that take arguments directly, command groups for subcommands like `db migrate`, and destructive operations with confirmation flows. It handles the registration boilerplate in `__init__.py` and enforces conventions like using Annotated types, proper exit codes, and routing all output through a display module. The destructive template is solid, it won't let you forget the `--force` flag or confirmation prompt. One constraint: it assumes you've already got a storage and display module set up. Good for teams that want their CLI commands to look like they were written by the same person.

GitHub stars
1.3K
last updated
Jun 8, 2026

Install

$ npx -y skills add https-deeplearning-ai/sc-agent-skills-files --skill adding-cli-command --agent claude-code

Installs into .claude/skills of the current project.

Files

Adding CLI Commands

Templates and workflow for adding or updating Typer CLI commands.

<cli_app> refers to the name of your CLI application (e.g., task, myapp, todo).

Workflow

  1. Identify command type (single command, command group, or destructive)
  2. Create file in src/<cli_app>/commands/<command>.py
  3. Use appropriate template below
  4. Register in src/<cli_app>/commands/__init__.py

Template A: Single Command

For commands taking arguments directly (<cli_app> add "item").

import typer
from typing import Annotated

from <cli_app>.storage import add_task
from <cli_app>.display import display
from <cli_app>.constants import EXIT_INVALID_INPUT

app = typer.Typer()


@app.command()
def add(
    title: Annotated[str, typer.Argument(help="task title")],
    priority: Annotated[str, typer.Option("--priority", "-p", help="priority level")] = "low",
):
    """Add a new task."""
    if not title.strip():
        display.error("Title cannot be empty")
        raise typer.Exit(EXIT_INVALID_INPUT)

    task = add_task(title=title, priority=priority)
    display.success(f"Added '{task.title}'")

Template B: Command Group

Sponsors

Details

Repository
github.com/https-deeplearning-ai/sc-agent-skills-files
Categories
DevOps & CI/CD, AI & Agent Building, CLI & Terminal
First seen
Jun 11, 2026

More from https-deeplearning-ai/sc-agent-skills-files

All 4
1hypnguyen1209 avatarcloud-securityhypnguyen1209/offensive-claudeCloud penetration testing — AWS/Azure/GCP privilege escalation, container escape, Kubernetes attacks, serverless exploitation, IaC misconfigurations0skills.sh installs
2jdrhyne avatarsalesforcejdrhyne/agent-skillsQuery and manage Salesforce CRM data via the Salesforce CLI (`sf`). Run SOQL/SOSL queries, inspect object schemas, create/update/delete records, bulk import/exp0skills.sh installs
3JetBrains avatarchangelogJetBrains/ideavimMaintains IdeaVim changelog (CHANGES.md) and build.gradle.kts changeNotes. Use when updating changelog, documenting releases, or reviewing commits/PRs for chang0skills.sh installs
4kostard avatarforgecad-component-modelkostard/forgecad-public-kitEnforce the ForgeCAD Component Model when building multi-part assemblies. Parts build at origin, connectors position them, data flows down from parent. Use when0skills.sh installs
5kostard avatarforgecad-image-replicatorkostard/forgecad-public-kitBuild real ForgeCAD geometry from one or more reference images by treating images as evidence, inferring the object, then validating against both reference-matc0skills.sh installs
6kostard avatarforgecad-prepare-promptkostard/forgecad-public-kitTurn a fuzzy physical product, mechanism, or CAD artifact request into a concrete manufacture-realistic prototype ForgeCAD build brief and a single master promp0skills.sh installs