cli-design
Skill1 starsChanged 2 months agoUnlicenseView on GitHub
Best practices for designing command-line interfaces (CLIs). Use when creating, reviewing, or improving CLI tools — covers command structure, naming, flags, help text, output formatting, error handling, robustness, configuration, and Google-specific CLI conventions.
- Reads credentials
7 other projects use a version of this.
Adopted by
Most recently taken up by
- notque/vexjoy-agenttheir own version, first seen Sep 26, 2026
- 2867203296/hermes-agenttheir own version, first seen Aug 19, 2026
- magarcia/skillstheir own version, first seen Jul 23, 2026
- metyatech/skill-cli-designtheir own version, first seen Jul 22, 2026
- shinzoxD/knackboxtheir own version, first seen Jul 10, 2026
- jkeifer/skillstheir own version, first seen Jul 9, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- notque/vexjoy-agent★ 424same name
- magarcia/skills★ 4same name
- damacus/agent-skills★ 2same name
- 2867203296/hermes-agent★ 0same name
- jkeifer/skills★ 0same name
- metyatech/skill-cli-design★ 0same name
- shinzoxD/knackbox★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository71 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ad-copy-writerSkill
- ae-inspect-describeSkill
- algorithmic-artSkill
- animation-directorSkill
- brainstorming-and-ideatingSkill
- brainstorming-research-ideasSkill
- brainstormingSkill
- brief-to-tasksSkill
- canvas-designSkill
- cli-output-hierarchySkill
- commit-messageSkill
- craft-uiSkill
- creative-directorSkill
- design-briefSkill
- design-flowSkill
- design-mock-auditSkill
- design-reviewSkill
- design-system-patternsSkill
- design-tokensSkill
- deslopifySkill
- diagnoseSkill
- doc-restructureSkill
- eval-criticSkill
- formatting-open-markdownsSkill
- frontend-designSkill
- frontend-slidesSkill
- gdocs-tab-writerSkill
- gemini-apiSkill
- gif-creationSkill
- github_repo_researchSkill
- grill-meSkill
- grill-with-docsSkill
- hallmarkSkill
- handoffSkill
- html-presentationSkill
- humanizerSkill
- improve-codebase-architectureSkill
- information-architectureSkill
- install-skill-from-githubSkill
- markdown-output-hierarchySkill
- marketing-psychologySkill
- merge-latestSkill
- modern-web-performanceSkill
- motion-designSkill
- pdf-readerSkill
- pm-brainstormingSkill
- pm-discovery-brainstormSkill
- product-marketingSkill
- prototypeSkill
- pull-requestSkill
- ralph_loopSkill
- react-best-practicesSkill
- skill-creatorSkill
- skill-optSkill
- steve-voiceSkill
- systematic-debuggingSkill
- tastemaker-styleSkill
- tech-doc-codelabSkill
- threejsSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
27 rules. 0 are common, 15 are distinctive, and 12 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
15
Distinctive
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Human-first design: If a command is used primarily by humans, design for humans first.
- Very specific: line 19
Simple parts that work together: Use stdout/stderr/exit codes correctly so programs compose via pipes.
- Distinctive: line 21
Consistency across programs: Follow existing conventions — don't invent new flag names when standard ones exist.
- Distinctive: line 23
Say just enough: Don't hang silently. Don't dump pages of debug output.
- Very specific: line 36
Prefer noun-verb ordering for multi-level subcommands: docker container create, gcloud compute instances list.
- Distinctive: line 41
Use subcommands to reduce complexity of tools with many operations.
- Distinctive: line 66
Use standard flag names when they exist:
- Very specific: line 81
Use --no- prefix for boolean negations (--reboot / --no-reboot).
- Very specific: line 89
When run without required arguments, show concise help: description, one–two examples, common flags, and a pointer to --help.
- Distinctive: line 97
After each command completes, suggest what the user might do next:
- Distinctive: line 116
If state changes, tell the user what happened and what the new state is.
- Distinctive: line 120
Use color to aid scanning, not as decoration:
- Distinctive: line 125
Don't overuse — if everything is colored, nothing stands out.
- Distinctive: line 130
Use spinners or progress bars for long operations.
- Distinctive: line 135
Rewrite errors for humans: Don't dump raw stack traces or internal codes.
- Distinctive: line 138
Put the most important information at the end — that's where eyes go.
- Distinctive: line 139
Use non-zero exit codes for failures.
- Very specific: line 163
Follow the XDG Base Directory spec (~/.config, ~/.cache, etc.).
- Very specific: line 164
Read from .env files where appropriate, but don't use them as a substitute for proper config files.
- Very specific: line 168
Check standard env vars: NO_COLOR, DEBUG, EDITOR, PAGER, TMPDIR, HTTP_PROXY, HOME, TERM.
- Distinctive: line 173
Keep changes additive: Add new flags rather than changing existing ones.
- Distinctive: line 176
Don't create time bombs: Avoid hard dependencies on external services that may disappear.
- Very specific: line 188
Deployment: Use BinFS (go/binfs) for automated deployment to /google/bin/releases.
- Very specific: line 190
Documentation: Create a go/${TOOL_NAME} link pointing to your docs.
- Very specific: line 193
Flag consistency: Use the same flag names as peer tools in your ecosystem (e.g., --detach, -c for CL number).
- Very specific: line 195
Dangerous operations: Default to --dry_run=true for destructive commands.
- Very specific: line 200
CLI frameworks: Use absl.flags (C++/Python), Cobra (Go), picocli (Java), or clikt (Kotlin).
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLI Design Guide
Principles and patterns for building well-designed CLI tools, synthesized from industry best practices and Google-internal conventions.
Philosophy
- Human-first design. If a command is used primarily by humans, design for humans first. Composability with scripts is secondary.
- Simple parts that work together. Use stdout/stderr/exit codes correctly
so programs compose via pipes. Support
--jsonfor structured output. - Consistency across programs. Follow existing conventions — don't invent new flag names when standard ones exist.
- Say just enough. Don't hang silently. Don't dump pages of debug output. Show progress, confirm state changes, and keep noise low.
- Ease of discovery. Comprehensive help, examples, and "next step" suggestions make CLIs learnable without external docs.
Command Structure
Naming
- Command and subcommand names should be lowercase, single words where
possible. Use kebab-case (
my-command) if multiple words are unavoidable. - Topics are plural nouns, commands are verbs:
apps create,containers list,config set. - Prefer noun-verb ordering for multi-level subcommands:
docker container create,gcloud compute instances list.
Subcommands
- Use subcommands to reduce complexity of tools with many operations.
- Be consistent across subcommands — same flag names, similar output formats.
- Don't have ambiguous commands like "update" and "upgrade".
- Don't allow arbitrary abbreviations — they prevent adding new commands.
- Don't have a catch-all subcommand — it blocks future expansion.
Arguments & Flags
Prefer Flags to Args
Flags are self-documenting and order-independent. Positional args are OK only
for simple, unambiguous primary actions (e.g., rm file.txt, cd dir).
# Bad — which is source, which is destination?
mycli deploy production jira
# Good — self-documenting
mycli deploy --environment=production --product=jiraFlag Conventions
- Always provide long-form flags (
--help, not just-h). - Reserve short flags for the most common options only.
- Use standard flag names when they exist:
| Flag | Meaning |
-h, --help | Show help (never overload) |
--version | Show version |
-q, --quiet | Suppress non-essential output |
-v, --verbose | Increase output detail |
-f, --force | Skip confirmations |
-n, --dry-run | Preview without executing |
-o, --output | Output file or format |
--json | Output as formatted JSON |
--no-color | Disable color output |
--no-input | Disable interactive prompts |
- Use
--no-prefix for boolean negations (--reboot/--no-reboot). - Never read secrets from flags — use
--password-fileor stdin instead.
Help & Documentation
Help Text
- Display help for
-h,--help, and (for git-like tools)helpsubcommand. - When run without required arguments, show concise help: description,
one–two examples, common flags, and a pointer to
--help. - Show full help with all flags when
--helpis passed. - Lead with examples — users prefer them over prose.
- Show most common commands first, then group the rest.
Suggesting Next Steps
After each command completes, suggest what the user might do next:
✓ App created successfully.
Next: deploy with `mycli deploy --app=myapp`Output Design
Stdout vs Stderr
- stdout: Primary output and machine-readable data.
- stderr: Log messages, progress, errors, and diagnostics.
Human-Readable First
- Detect TTY to decide output format: rich for terminals, plain for pipes.
- Support
--plainfor grep/awk-compatible tabular output. - Support
--jsonfor structured, parseable output. - If state changes, tell the user what happened and what the new state is.
Color
Use color to aid scanning, not as decoration:
- Red: errors. Yellow: warnings. Other colors: structure/emphasis.
- Disable color when: not a TTY,
NO_COLORis set,TERM=dumb, or--no-coloris passed. - Don't overuse — if everything is colored, nothing stands out.
Progress
- Print something within 100ms so the user knows it's working.
- Use spinners or progress bars for long operations.
- Break long tasks into visible steps with status for each.
Error Handling
- Rewrite errors for humans. Don't dump raw stack traces or internal codes.
- Explain what went wrong and how to fix it:
Can't write to file.txt. Try: chmod +w file.txt - Put the most important information at the end — that's where eyes go.
- Use non-zero exit codes for failures. Map codes to distinct failure modes.
- For unexpected errors, offer a way to submit a bug report with pre-populated context.
Robustness
- Validate input early and fail with clear messages before side effects.
- Make operations idempotent — rerunning should be safe.
- Set network timeouts with sensible defaults.
- Make it recoverable — pressing ↑ Enter should pick up where it left off.
- Handle Ctrl-C gracefully — clean up or exit immediately.
- Make it crash-only — if you can defer cleanup to the next run, do so.
Configuration Hierarchy
Configuration should layer, with more specific sources overriding general ones:
| Priority | Source | Use For |
| 1 (highest) | Flags | Per-invocation settings |
| 2 | Environment variables | Per-session or machine-specific settings |
| 3 | Project config file | Shared, version-controlled project settings |
| 4 | User config file | Personal defaults (~/.config/myapp/) |
- Follow the XDG Base Directory spec (
~/.config,~/.cache, etc.). - Read from
.envfiles where appropriate, but don't use them as a substitute for proper config files. - Never read secrets from environment variables — they leak into logs,
psoutput, and child processes. - Check standard env vars:
NO_COLOR,DEBUG,EDITOR,PAGER,TMPDIR,HTTP_PROXY,HOME,TERM.
Future-proofing
- Keep changes additive. Add new flags rather than changing existing ones.
- Warn before breaking changes. Deprecate flags with in-tool warnings and migration instructions before removing them.
- Don't create time bombs. Avoid hard dependencies on external services that may disappear.
- Changing human-readable output is OK — encourage
--jsonin scripts for stability.
Google-Specific Patterns
For deeper Google-internal guidance, see references/google_cli_patterns.md.
Key highlights:
- Deployment: Use BinFS (
go/binfs) for automated deployment to/google/bin/releases. Don't require users toblaze buildmanually. - Documentation: Create a
go/${TOOL_NAME}link pointing to your docs. - Defaults: Make the tool work with minimal flags. Don't assume the current working directory is the google3 root — infer it.
- Flag consistency: Use the same flag names as peer tools in your
ecosystem (e.g.,
--detach,-cfor CL number). - Dangerous operations: Default to
--dry_run=truefor destructive commands. Force explicit specification of targets like--spanner_database. - Readable invocations: Make commands read like sentences:
diffle -c cl/123 --for server --against embedded. - CLI frameworks: Use absl.flags (C++/Python), Cobra (Go), picocli
(Java), or clikt (Kotlin). See
go/go-style/best-practices#complex-clis.
Reporting Issues
Report bugs or improvements for this skill at Agent Skill: cli_design.
See the skill_issue skill for instructions on filing and triaging skill bugs.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

