This skill should be used when the user asks to "design a CLI", "help me design command-line flags", "what flags should my tool have", "create a CLI spec", "refactor my CLI interface", "design a CLI my agent can call", or wants to design command-line UX (args/flags/subcommands/help/output/errors/config) before implementation or audit an existing CLI surface for consistency and composability.
Design CLI surface area (syntax + behavior), agent-aware, human-friendly.
Read ${CLAUDE_PLUGIN_ROOT}/skills/create-cli/references/cli-guidelines.md. Apply it as the default CLI rubric, including the Agent Ergonomics section.
For new CLI designs, also read ${CLAUDE_PLUGIN_ROOT}/skills/create-cli/references/language-selection.md to inform the language recommendation in Phase 2. Skip it for audits — the language is already chosen.
Proceed when cli-guidelines.md is loaded.
Determine whether this is a new design or an audit from the user's trigger.
Ask, then proceed with best-guess defaults if user is unsure:
--json--no-input? confirmations for destructive ops?If an existing CLI spec or tool description is provided, read it first — skip questions already answered by it.
Ask:
--help output).Then explore the codebase: use Glob/Grep to find command definitions, flag registrations, output formatting, and error handling. Run <cli> --help via Bash to capture actual behavior.
Proceed when answers are confirmed or user is unsure — use best-guess defaults.
Apply the conventions from cli-guidelines.md (loaded in Phase 1), including the Agent Ergonomics section. The rules below are the key conventions to enforce — cli-guidelines.md provides the full rubric for edge cases.
If primary consumer is human-only, the Errors and Reduce Tool Calls subsections are optional — apply them only if the user wants script-friendliness.
--json gives structured JSON. Explicit is better than implicit — no TTY sniffing, no surprises.--json mode use NDJSON (one JSON object per line) — enables streaming and jq piping without buffering. For paginated results with metadata, a JSON object with an items array is acceptable. If the CLI extends an existing ecosystem that uses JSON arrays (kubectl, aws, gh), match the ecosystem convention.--json is passed or when stdout is not a TTY.--json is active, emit error objects on stderr: {"error": "<snake_case_code>", "message": "...", "hint": "<exact CLI invocation or null>"} — so agent callers can route recovery logic without parsing free-text stderr. The hint field must be an executable command, not prose.0 success, 1 runtime error, 2 invalid usage; add command-specific codes only when genuinely useful.-h/--help always shows help; ignores other args.--version prints version to stdout.--json preferred for structured output. --output json/-o json acceptable when the CLI needs multiple output formats (yaml, table, csv) under a single flag. Pick one and apply consistently.--id, --force, --json) — agents learn the naming pattern once and apply it everywhere without guessing.--no-input disables prompts. --non-interactive acceptable if the ecosystem already uses it.--force.NO_COLOR, TERM=dumb; provide --no-color.create returns the new resource's ID and key fields. delete echoes what was removed.--json mode, return full objects not just IDs.--limit to adjust. In JSON mode, include has_more (bool) and optionally next_cursor for keyset pagination. Unbounded output wastes tokens and risks context overflow for agent callers.Apply all applicable conventions, then proceed to Phase 4.
Evaluate the existing CLI against every Phase 3 subsection. For each convention, state: what the CLI does today, whether it conforms, and what to change. Also check:
Produce a gap report organized by severity: Breaking (requires API change), Major (agent-breaking or convention violation), Minor (cosmetic/polish). Each finding: current behavior, convention violated, recommended fix with migration risk (none/low/breaking).
Produce a compact spec the user can implement. Include all relevant sections:
--json for structured output; --quiet/--verbose.--dry-run, confirmations, --force, --no-input.Use this skeleton, dropping irrelevant sections:
Go · cobra · single binary · goreleaser for CI
(Omit if language was not determined.)mycmd...mycmd [global flags] <subcommand> [args]mycmd init ...mycmd run ...-h, --help--version-q, --quiet / -v, --verbose (define exactly)--json (structured JSON output; NDJSON for list commands)0 success1 generic failure2 invalid usage (parse/validation)See ${CLAUDE_PLUGIN_ROOT}/skills/create-cli/examples/example-cli-spec.md for a complete worked example.
If the spec is destined for a skill body or CLAUDE.md, omit unused sections entirely (do not mark them "N/A") and limit examples to ≤5 invocations that each demonstrate multiple patterns.
For new specs: confirm the spec covers all applicable sections from the Phase 4 skeleton. Verify the examples section demonstrates at least: --json output, error recovery (if agent/mixed consumer), and one piped/stdin usage.
For audits: confirm the gap report addresses every Phase 3 subsection and includes at least one example invocation showing the recommended fix for each Major finding.
Skill is complete when verification passes.