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

scaffold-cli

Generate CLI command with argument parsing, handler, help text, and tests

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

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.0 KB

SKILL.md(원문)

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

Context

Project {{project_name}} is a CLI application using {{stack}}. You will create a new command "{{input.name}}".

Read AGENTS.md for conventions. Read existing commands to understand patterns.

Instructions

  1. Analyze existing command patterns

    • Read existing command files
    • Identify: argument parsing library (cobra, clap, click, commander, argparse, etc.)
    • Identify: command registration pattern (subcommands, router, etc.)
    • Identify: output formatting (table, JSON, plain text, colored)
    • Note error handling patterns (exit codes, stderr vs stdout)
  2. Create command file

    • Path: according to project convention
      • Go (cobra): cmd/{{input.name}}.go or internal/cmd/{{input.name}}.go
      • Rust (clap): src/commands/{{input.name}}.rs
      • Python (click): src/commands/{{input.name}}.py
      • Node (commander): src/commands/{{input.name}}.ts
    • Implement:
      • Command definition with name, description, aliases
      • Argument/flag parsing with validation
      • Help text with usage examples
      • Handler function with business logic
  3. Create argument/flag definitions

    • Define all required and optional flags
    • Set proper types (string, bool, int, etc.)
    • Add short aliases where appropriate (-o for --output)
    • Set sensible defaults
    • Add validation for required args
  4. Register command

    • Add to root command / command registry
    • Ensure it shows up in --help output
    • Set up proper parent-child relationship for subcommands
  5. Implement handler logic

    • Separate business logic from CLI plumbing
    • Use project's existing service/logic layer
    • Handle errors gracefully with helpful messages
    • Respect --quiet/--verbose flags if they exist
    • Use proper exit codes (0 = success, 1 = error, 2 = usage error)
  6. Create tests

    • Path: according to convention
    • Test cases:
      • Command executes successfully with valid args
      • Help text is correct
      • Required args validation works
      • Flag parsing works correctly
      • Error cases return proper exit codes
      • Output format is correct

Script

#!/bin/bash
# Detect CLI framework
if [ -f "go.mod" ]; then
  if grep -q "cobra" go.mod 2>/dev/null; then
    echo "Framework: Cobra (Go)"
    echo "Command path: cmd/{{input.name}}.go"
  elif grep -q "urfave/cli" go.mod 2>/dev/null; then
    echo "Framework: urfave/cli (Go)"
  fi
elif [ -f "Cargo.toml" ]; then
  if grep -q "clap" Cargo.toml 2>/dev/null; then
    echo "Framework: Clap (Rust)"
    echo "Command path: src/commands/{{input.name}}.rs"
  fi
elif [ -f "package.json" ]; then
  if grep -q "commander" package.json 2>/dev/null; then
    echo "Framework: Commander (Node)"
  elif grep -q "yargs" package.json 2>/dev/null; then
    echo "Framework: Yargs (Node)"
  fi
elif [ -f "pyproject.toml" ] || [ -f "requirements.txt" ]; then
  if grep -q "click" pyproject.toml requirements.txt 2>/dev/null; then
    echo "Framework: Click (Python)"
  elif grep -q "typer" pyproject.toml requirements.txt 2>/dev/null; then
    echo "Framework: Typer (Python)"
  fi
fi

Validation

  • Command file created and follows existing patterns
  • Command registered and shows in --help
  • Arguments and flags parsed correctly
  • Help text is clear with usage examples
  • Error messages are helpful (not stack traces)
  • Exit codes are correct (0 success, non-zero error)
  • Tests created and passing
  • Typecheck/compile passing
  • Lint passing

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

anoa

무료

Drive a real browser from the command line — open pages, snapshot the interactive elements as refs, click and fill by ref, read text, run JS, screenshot. Use when a task needs a live browser: checking a page renders, walking a login or checkout flow, scraping something that only exists after JavaScript runs, or reproducing a UI bug.

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

porcupine-md/jonggrang162026년 9월 15일 업데이트

Run linters/typecheckers to calculate health score.

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

porcupine-md/jonggrang162026년 9월 15일 업데이트

Comprehensive UI/UX compliance check (A11y, performance, responsive).

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

porcupine-md/jonggrang162026년 9월 15일 업데이트

Infrastructure-first security audit (OWASP, secrets, dependencies).

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

porcupine-md/jonggrang162026년 9월 15일 업데이트

auth

무료

Setup authentication flow (register, login, session/JWT, middleware)

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

porcupine-md/jonggrang162026년 9월 15일 업데이트

Deep knowledge about deploying applications to AWS (EC2, ECS, S3, CloudFront, Cloud Run).

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

porcupine-md/jonggrang162026년 9월 15일 업데이트

porcupine-md의 스킬 모두 보기

이 스킬의 문제 신고