Langsung ke konten
Skillpedia
Pemrograman umum33k Β· #8795

rust-cli-builder

Fungsinya

Skill ini membantu agent AI Anda membangun alat baris perintah dengan Rust. Skill ini untuk pengembang yang membuat CLI baru atau menambahkan subperintah, file konfigurasi, dan keluaran yang rapi pada CLI yang sudah ada.

Kapan dipakai

  • βœ“Saat Anda ingin membuat alat baris perintah Rust baru dari awal.
  • βœ“Ketika Anda perlu menambahkan subperintah ke CLI Rust yang sudah ada.
  • βœ“Saat Anda ingin pemuatan file konfigurasi atau keluaran berwarna pada alat Rust.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/rust-cli-builder/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBuatkan CLI Rust yang mengubah file CSV menjadi JSON, dengan file konfigurasi untuk opsi standar.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent pertama-tama menjelajahi proyek yang sudah ada, lalu mengajukan pertanyaan tentang perintah, format input dan output, serta cara alat akan dibagikan. Setelah itu agent menulis kode dengan clap, penanganan galat, dan dukungan konfigurasi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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 β€”
Pertanyaan umum

Apakah agent bertanya sebelum menulis kode?

Ya, skill ini merencanakan bersama Anda terlebih dahulu, mencakup perintah, format, dan distribusi.

Pustaka argumen apa yang digunakan?

Skill ini memakai clap untuk membaca argumen baris perintah.

Bagaimana alat bisa dibagikan?

Skill ini mencakup distribusi melalui cargo install atau rilis GitHub.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
33k
Peringkat
#8795
Lisensi
MIT
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa