본문으로 건너뛰기
cccskills
무료GitHub에 공개

adding-cli-command

Provides Typer templates, handles registration, and ensures consistency. ALWAYS use this skill when adding or modifying CLI commands. Use when user requests to add/create/implement/build/write a new command (e.g., "add edit command", "create search feature") OR update/modify/change/edit an existing command.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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

For commands with subcommands (<cli_app> db migrate, <cli_app> db status).

import typer

from <cli_app>.storage import storage
from <cli_app>.display import display

app = typer.Typer(help="Database operations.")


@app.command()
def migrate():
    """Run database migrations."""
    storage.migrate()
    display.success("Migrations complete")


@app.command()
def status():
    """Show database status."""
    info = storage.get_status()
    display.info(f"Version: {info.version}")

Template C: Destructive Command

For deletion with confirmation.

import typer
from typing import Annotated

from <cli_app>.storage import get_task, delete_task
from <cli_app>.display import display
from <cli_app>.constants import EXIT_ERROR

app = typer.Typer()


@app.command()
def clear(
    task_id: Annotated[int, typer.Argument(help="task ID to delete")],
    force: Annotated[bool, typer.Option("--force", "-f", help="skip confirmation")] = False,
):
    """Delete a task permanently."""
    task = get_task(task_id)
    if not task:
        display.error(f"Task {task_id} not found")
        raise typer.Exit(EXIT_ERROR)

    if not force:
        confirm = typer.confirm(f"Delete '{task.title}'?", default=False)
        if not confirm:
            display.info("Cancelled")
            raise typer.Abort()

    delete_task(task_id)
    display.success(f"Deleted '{task.title}'")

Registration

Register in commands/__init__.py:

import typer

from .add import app as add_app
from .clear import app as clear_app

app = typer.Typer(help="<cli_app> CLI.", no_args_is_help=True)

# Single commands - add WITHOUT name
app.add_typer(add_app)
app.add_typer(clear_app)

# Command groups - add WITH name
# app.add_typer(db_app, name="db")

Conventions

RuleExample
ArgumentsAnnotated[str, typer.Argument(help="...")]
OptionsAnnotated[str, typer.Option("--name", "-n", help="...")]
DocstringsImperative mood, < 60 chars
OutputAlways via display module
Exit codes0=success, 1=error, 2=invalid
DestructiveMust have --force flag, default=False confirmation

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Analyze weekly marketing campaign performance data across channels. Use when analyzing multi-channel digital marketing data to calculate funnel metrics (CTR, CVR) and compare to benchmarks, compute cost and revenue efficiency metrics (ROAS, CPA, Net Profit), or get budget reallocation recommendations based on performance rules.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

https-deeplearning-ai/sc-agent-skills-files1.4천2026년 6월 9일 업데이트

Comprehensive diagnostic analysis of time series data. Use when users provide CSV time series data and want to understand its characteristics before forecasting - stationarity, seasonality, trend, forecastability, and transform recommendations.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

https-deeplearning-ai/sc-agent-skills-files1.4천2026년 6월 9일 업데이트

CraftedWell brand guidelines for presentations and documents. Use this skill whenever creating or styling documents (docx, pdf) or presentations (pptx) for CraftedWell. Apply warm, artisanal aesthetic with chocolate/caramel color palette, Georgia headings, and Arial body text.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

https-deeplearning-ai/sc-agent-skills-files1.4천2026년 6월 9일 업데이트

Generate pytest tests for Typer CLI commands. Includes fixtures (temp_storage, sample_data), CliRunner patterns, confirmation handling (y/n/--force), and edge case coverage. Use when user asks to "write tests for", "test my CLI", "add test coverage", or any CLI + test request.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

https-deeplearning-ai/sc-agent-skills-files1.4천2026년 6월 9일 업데이트

Generate educational practice questions from lecture notes to test student understanding. Use when users request practice questions, exam preparation materials, study guides, or assessment items based on lecture content.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

https-deeplearning-ai/sc-agent-skills-files1.4천2026년 6월 9일 업데이트

Create learning paths for programming tools, and define what information should be researched to create learning guides. Use when user asks to learn, understand, or get started with any programming tool, library, or framework.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

https-deeplearning-ai/sc-agent-skills-files1.4천2026년 6월 9일 업데이트

https-deeplearning-ai의 스킬 모두 보기

이 스킬의 문제 신고