Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

add-command

/add-command

Dodaje podkomendę do narzędzia CLI w Rust, z obsługą, błędami, wyjściem i testami.

Repozytorium
stacks ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
08.11.2026

Ocena i bezpieczeństwo

96/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść31 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 08.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Dodaje podkomendę do narzędzia CLI w Rust, z obsługą, błędami, wyjściem i testami.

Oryginalny opis (EN)

Add a subcommand to this Rust CLI with its handler, errors, output and tests. Use when the user asks for a new command, subcommand or option that does work.

Jak działa

SKILL.md bez nagłówków drugiego poziomu · 13 linii, 259 słów

Podgląd SKILL.md
---
name: add-command
description: Add a subcommand to this Rust CLI with its handler, errors, output and tests. Use when the user asks for a new command, subcommand or option that does work.
---

# Add a command

`config show` is the worked example: `src/cli.rs` (the `Config` and `ConfigCommand` variants), `src/commands/config.rs` (the handler and its unit tests), the dispatch `match` in `src/app.rs`, and its cases in `tests/cli.rs`. Follow the same path.

1. **Parse.** Add a variant to `Command` in `src/cli.rs` with a `///` doc comment (clap shows it in `--help`). Command-specific arguments go on the variant; a flag every command needs is `global = true` on `Cli`. `Cli::command().debug_assert()` in `cli.rs`'s tests catches conflicting definitions.
2. **Handle.** Create `src/commands/<name>.rs` with `pub fn run(config: &Config, output: Output, out: &mut dyn Write, ...) -> Result<(), AppError>` and declare it in `src/commands.rs`. Write the result once with `output.result(out, &value, &human)`: `value` is a `Serialize` type scripts rely on, `human` the text a person reads. Log with `tracing::debug!`.
3. **Dispatch.** Add the arm to the `match command` in `app::invoke`. The compiler rejects a missing arm.
4. **Fail.** A new failure is a new `AppError` variant in `src/error.rs` with its `code()`, `suggestion()` and `exit_code()` arms (2 for a mistake in the invocation, 3 for configuration, 1 otherwise). Add the row to the exit-status table in `docs/ARCHITECTURE.md`.
5. **Settings.** A new setting goes in `Config`, its `Default`, the file `Layer` and `env_layer` in `src/config.rs`, `validate` if it can be wrong, a precedence test, and a row in `docs/configuration.md`.
6. **Test.** Unit tests beside the handler for both output modes. In `tests/cli.rs`, a success case and one case per failure, each checking the exit status, stdout and stderr in human and `--json` mode.
7. Run `make lint test`, then `make smoke`.

Wersje

RepozytoriumWynikLicencja
Ta strona · steamfield/stacks96Apache-2.0
todoist/todoist-cli100MIT
proteanhq/protean100Apache-2.0
doist/todoist-cli100MIT
coralogix/cx-cli100Apache-2.0
GO-VIRTUAL-bv/tile38.go100MPL-2.0
steamfield/stacks96Apache-2.0
ldayton/dippy95MIT
steamfield/stacks86Apache-2.0

Migawka bazy z 13.11.2026 · wersja paczki ba0aa3f4e2f6 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100add-cli-command
    Dodaje lub zmienia polecenie CLI, flagę albo format wyjścia zgodnie z konwencjami repozytorium dla argumentów, kodów wyjścia, JSON, pomocy i testów.
  • 100add-tauri-command
    Dodaje polecenie Tauri do MooshieUI od początku do końca: handler w Rust, rejestrację w lib.rs i opakowanie ipcInvoke w TypeScript.
  • 100n8nac-reference
    Opisuje każde polecenie, podpolecenie i flagę CLI n8nac w wersji 2.7.0, żeby nie zgadywać flag ani nie wymyślać nieistniejących poleceń.
  • 100add-cli-option
    Dodaje nową opcję CLI lub konfiguracji Remotion: tworzy AnyRemotionOption, rejestruje parsowanie, podpina settery i aktualizuje dokumentację.
  • 95rs-domain-cli
    Pomaga pisać narzędzia wiersza poleceń w Rust: parsowanie argumentów, podpolecenia, TUI, paski postępu i pliki konfiguracji.
  • 100run-cq
    Buduje, uruchamia i testuje cq, CLI do zapytań SQL nad transkryptami Claude Code, napisane w Rust z DuckDB.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.