본문으로 건너뛰기
Skillpedia
일반 코딩33k · #8795

rust-cli-builder

하는 일

이 스킬은 AI 에이전트가 Rust로 명령줄 도구를 만들도록 돕습니다. 새 CLI를 만들거나 서브커맨드, 설정 파일, 깔끔한 출력을 추가하려는 개발자를 위한 것입니다.

사용하는 경우

  • ✓Rust 명령줄 도구를 처음부터 만들고 싶을 때.
  • ✓기존 Rust CLI에 서브커맨드를 추가해야 할 때.
  • ✓Rust 도구에서 설정 파일 불러오기나 색상 출력을 원하는 경우.

스킬 링크

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/rust-cli-builder/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/rust-cli-builder/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“CSV 파일을 JSON으로 바꾸는 Rust CLI를 만들어 주세요. 기본 옵션을 위한 설정 파일도 포함해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 기존 프로젝트가 있으면 먼저 살펴본 뒤, 명령, 입출력 형식, 공유 방법에 대해 질문합니다. 그다음 clap, 오류 처리, 설정 지원을 갖춘 코드를 씁니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Rust CLI Tool Builder

When to use

Use this skill when you need to:

  • Scaffold a new Rust CLI tool from scratch with clap
  • Add subcommands to an existing CLI application
  • Implement config file loading (TOML/JSON/YAML)
  • Set up proper error handling with anyhow/thiserror
  • Add colored and formatted terminal output
  • Structure a CLI project for distribution via cargo install or GitHub releases

Phase 1: Explore (Plan Mode)

Enter plan mode. Before writing any code, explore the existing project:

If extending an existing project

  • Find Cargo.toml and check current dependencies (clap version, serde, tokio, etc.)
  • Locate the CLI entry point (src/main.rs or src/cli.rs)
  • Check if clap is using derive macros or builder pattern
  • Identify existing subcommand structure
  • Look for existing error types, config structs, and output formatting
  • Check if there's a src/lib.rs separating library logic from CLI

If starting from scratch

  • Check the workspace for any existing Rust projects or workspace Cargo.toml
  • Look for a .cargo/config.toml with custom settings
  • Check for rust-toolchain.toml to know the target Rust edition

Phase 2: Interview (AskUserQuestion)

Use AskUserQuestion to clarify requirements. Ask in rounds.

Round 1: Tool purpose and commands

Question: "What kind of CLI tool are you building?"
Header: "Tool type"
Options:
  - "Single command (like ripgrep, curl)" — One main action with flags and arguments
  - "Multi-command (like git, cargo)" — Multiple subcommands under one binary
  - "Interactive REPL (like psql)" — Persistent session with a prompt loop
  - "Pipeline tool (like jq, sed)" — Reads stdin, transforms, writes stdout

Question: "What will the tool operate on?"
Header: "Input"
Options:
  - "Files/directories" — Read, process, or generate files
  - "Network/API" — HTTP requests, TCP connections, API calls
  - "System resources" — Processes, hardware info, OS config
  - "Data streams (stdin/stdout)" — Pipe-friendly text/binary processing

Round 2: Subcommands (if multi-command)

Question: "Describe the subcommands you need (e.g., 'init', 'build', 'deploy')"
Header: "Commands"
Options:
  - "2-3 subcommands (I'll describe them)" — Small focused tool
  - "4-8 subcommands with groups" — Medium tool, may need command groups
  - "I have a rough list, help me design the API" — Collaborative command design

Round 3: Configuration and output

Question: "How should the tool be configured?"
Header: "Config"
Options:
  - "CLI flags only (Recommended)" — All config via command-line arguments
  - "Config file (TOML)" — Load defaults from ~/.config/toolname/config.toml
  - "Config file + CLI overrides" — Config file for defaults, flags override specific values
  - "Environment variables + flags" — Env vars for secrets, flags for everything else

Question: "What output format does the tool need?"
Header: "Output"
Options:
  - "Human-readable (colored text)" — Pretty terminal output with colors and formatting
  - "Machine-readable (JSON)" — Structured output for piping to other tools
  - "Both (--format flag)" — Default human, --json or --format=json for machines
  - "Minimal (exit codes only)" — Success/failure via exit code, errors to stderr

Round 4: Async and error handling

Question: "Does the tool need async operations?"
Header: "Async"
Options:
  - "No — synchronous is fine (Recommended)" — File I/O, computation, simple operations
  - "Yes — tokio (network I/O)" — HTTP requests, concurrent connections, async file I/O
  - "Yes — tokio multi-threaded" — Heavy parallelism, multiple concurrent tasks

Question: "How should errors be presented to users?"
Header: "Errors"
Options:
  - "Simple messages (anyhow) (Recommended)" — Human-readable error chains, good for most CLIs
  - "Typed errors (thiserror)" — Custom error enum with specific variants for each failure
  - "Both (thiserror for lib, anyhow for bin)" — Library code is typed, CLI wraps with anyhow

Phase 3: Plan (ExitPlanMode)

Write a concrete implementation plan covering:

  1. Project structure — Cargo.toml dependencies, src/ file layout
  2. CLI definition — clap derive structs for all commands, args, and flags
  3. Config loading — config file format and merge strategy with CLI args
  4. Core logic — main functions for each subcommand, separated from CLI layer
  5. Error types — error enum or anyhow usage, user-facing error messages
  6. Output formatting —
자주 묻는 질문

코딩 전에 질문하나요?

네. 스킬은 명령, 형식, 배포 방식에 대해 먼저 계획하면서 질문합니다.

어떤 인자 라이브러리를 쓰나요?

명령줄 인자 파싱에 clap을 씁니다.

도구를 어떻게 공유하나요?

cargo install이나 GitHub 릴리스를 통한 배포를 다룹니다.

상세 정보

작성자의 원본 설명

Plan and build production-ready Rust CLI tools using clap for argument parsing, with subcommands, config file support, colored output, and proper error handling. Uses interview-driven planning to clarify commands, input/output formats, and distribution strategy before writing any code.

repo: davila7/claude-code-templates

인기도

GitHub 스타
33k
순위
#8795
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬