Community程式設計與開發github.com

steipete/create-cli

設計 CLI 使用者體驗(語法與行為),以人為本,同時支援腳本化操作。

create-cli 是什麼?

這項技能旨在幫助開發者設計高品質的命令列介面(CLI),涵蓋語法、行為、錯誤處理、設定等層面。它遵循業界最佳實踐(如 clig.dev 指南),並提供一套明確的規格化流程,讓開發者能快速產出適合人類操作與腳本自動化的 CLI 規格文件。支援的平台包括任何 CLI 工具(macOS、Linux、Windows),無論是單一二進位檔或需執行環境的應用都可套用。使用時,AI 會先要求使用者提供命令名稱與一句話目的,然後根據預設慣例(如標準輸出、錯誤輸出分流、`--help` 行為、`--json` 輸出、`NO_COLOR` 支援等)自動補齊規格。最終輸出的內容包含命令樹、參數表格、子命令語意、輸出規則、錯誤代碼、安全機制(例如 `--dry-run`、`--force`、`--no-input`)、設定優先順序與範例。這份規格可直接作為實作依據,有效降低 CLI 設計的模糊性與反覆修改成本。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/steipete/agent-scripts/tree/main/skills/create-cli

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

建立命令列介面

設計命令列介面(語法與行為),以人為本,並支援腳本化操作。

先讀這個

快速釐清

提問後,若使用者不確定則以最佳預設值繼續:

  • 命令名稱 + 一句話目的。
  • 主要使用者:人類、腳本、或兩者兼顧。
  • 輸入來源:引數 vs 標準輸入;檔案 vs URL;機密(絕不能透過旗標傳遞)。
  • 輸出合約:人類可讀文字、--json、--plain、結束碼。
  • 互動性:允許提示嗎?需要 --no-input 嗎?破壞性操作需要確認嗎?
  • 設定模型:旗標/環境變數/設定檔;優先順序;XDG 規範 vs 儲存庫本地設定。
  • 平台/執行時期限制:macOS/Linux/Windows;單一二進位檔 vs 執行時期。

交付物(要輸出什麼)

設計 CLI 時,產出一份使用者可實作的簡潔規格:

  • 命令樹 + USAGE 範例語法。
  • 引數/旗標表格(型別、預設值、必填/選填、範例)。
  • 子命令語意(每個子命令的作用;是否冪等;狀態變更)。
  • 輸出規則:標準輸出 vs 標準錯誤;TTY 偵測;--json/--plain;--quiet/--verbose。
  • 錯誤與結束碼對應表(主要失敗模式)。
  • 安全規則:--dry-run、確認、--force、--no-input。
  • 設定與環境變數規則 + 優先順序(旗標 > 環境變數 > 專案設定 > 使用者設定 > 系統設定)。
  • Shell 自動補全說明(如果相關):安裝與可發現性;生成命令或內建腳本。
  • 5–10 個範例呼叫(常見流程;包含管線/標準輸入範例)。

預設慣例(除非使用者另有指定)

  • -h/--help 總是顯示說明,並忽略其他引數。
  • --version 將版本號輸出到標準輸出。
  • 主要資料輸出到標準輸出;診斷/錯誤輸出到標準錯誤。
  • 加入 --json 用於機器輸出;考慮加入 --plain 用於穩定的逐行文字。
  • 僅在標準輸入為 TTY 時才顯示提示;--no-input 停用提示。
  • 破壞性操作:互動模式需要確認;非互動模式需要 --force 或明確的 --confirm=...。
  • 尊重 NO_COLOR 與 TERM=dumb;提供 --no-color。
  • 處理 Ctrl-C:快速退出;有限度的清理;儘可能採用崩潰安全模式。

模板(複製到你的回答中)

CLI 規格骨架

填入以下內容,刪除不相關的部分:

  1. 名稱:mycmd
  2. 一句話說明:...
  3. 使用方式:
    • mycmd [全域旗標] <子命令> [引數]
  4. 子命令:
    • mycmd init ...
    • mycmd run ...
  5. 全域旗標:
    • -h, --help
    • --version
    • -q, --quiet / -v, --verbose(明確定義)
    • --json / --plain(如果適用)
  6. 輸入/輸出合約:
    • 標準輸出:
    • 標準錯誤:
  7. 結束碼:
    • 0 成功
    • 1 一般失敗
    • 2 無效使用(解析/驗證錯誤)
    • (僅在確實有用時才加入命令專用碼)
  8. 環境變數/設定:
    • 環境變數:
    • 設定檔路徑 + 優先順序:
  9. 範例:
    • …

備註

  • 僅在使用者要求時才推薦特定語言的解析函式庫;否則此技能應保持語言無關。
  • 若要求是「設計參數」,請勿偏離到實作細節。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

steipete/agent-transcript

GitHub PR/issue agent transcripts: redact, preview, and insert safely.

steipete/beeper

Beeper cache: contact hints, room lookup, WhatsApp/iMessage traces, FTS.

steipete/browser-use

Existing Chrome automation: Chrome plugin first, mcporter fallback.

steipete/clawsweeper-status

ClawSweeper status: URLs, workflow health, active workers, ops snapshot.

steipete/clickclack

ClickClack ops: chat app, Hetzner deploy, DNS/docs/app, Docker rollout.

steipete/cloudflare-registrar

Cloudflare Registrar: domain availability, prices, registration via mcporter.

steipete/codex-debugging

Codex debugging: codex-rs core/tui/exec/cli/app-server/config.

steipete/discord-clawd

Discord-backed OpenClaw agent/session relay; not archive search.

steipete/domain-dns-ops

DNS/domain ops: registrars, zones, redirects, DNS/HTTP verify, manager truth.

steipete/frontend-design

Frontend UI: pages, apps, components, polished non-generic design.

steipete/github-author-context

GitHub contributor context: identity, activity, trust, company/team signal.

steipete/github-cache-hygiene

GitHub quota/cache hygiene: gh, ghx, xcache, gitcrawl, mirrors, limits.

steipete/github-deep-review

GitHub deep review: bugs, PRs, best fix, stale-or-real, read code first.

steipete/github-project-triage

GitHub issue/PR triage: queues, CI, blockers, risk, proof, next actions.

steipete/hopper-debugger

Hopper debugging: macOS/iOS binaries, ObjC/Swift symbols, dyld, LLDB.

steipete/instruments-profiling

Instruments/xctrace profiling: macOS/iOS traces, binaries, args, exports.

steipete/mac-maintenance

Mac upkeep: brew update/upgrade, pull clean repos, empty Trash.

steipete/maintainer-orchestrator

Open-source maintainer orchestration: Codex app workers, work recovery, dependencies, vision, releases.

steipete/markdown-converter

Markdown conversion: PDF, Office, HTML, data, OCR, audio, ZIP, YouTube.

steipete/nano-banana-pro

Nano Banana/Gemini image gen/edit: text/image input, 512-4K workflows.

相關技能