agent-aware-cli
Skill1.2k starsChanged 6 months agoApache-2.0View on GitHub
Guide for designing and implementing command-line interfaces (CLIs) that are equally usable by human developers and automated coding agents. Use when the user wants to build a CLI, apply CLI best practices, or use Go with Cobra and Viper.
- Reads credentials
Trending
Steady talk.thin dataabout the whole repository
Who's talking about GoogleCloudPlatform/genmedia-creative-studio
- sudosubin/agents.nix“agent-plugins.github.googlecloudplatform.genmedia-creative-studio: init at 3.20.1”GitHub · Oct 4, 2026
- sudosubin/agents.nix“agent-skills.github.googlecloudplatform.genmedia-creative-studio: init at 3.20.1”GitHub · Sep 27, 2026
- ghchinoy/genmedia-creative-studio“chore(main): release mcp 3.21.0”GitHub · Aug 10, 2026
- renovate-bot/GoogleCloudPlatform-_-vertex-ai-creative-studio“chore(main): release mcp 3.21.0”GitHub · Aug 10, 2026
The biggest 4 of 4 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- genmedia-imageSkill
- genmedia-producerSkill
- producerSkill
- build-mcp-genmediaSkill
- genmedia-audio-engineerSkill
- genmedia-image-artistSkill
- genmedia-producerSkill
- genmedia-video-editorSkill
- genmedia-voice-directorSkill
- install-mcp-genmediaSkill
- story-generatorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 11 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
When tasked with building or improving a Command Line Interface (CLI), follow these architectural and design best practices to ensure it …
- Very specific: line 22
Never dump unpaginated or unfiltered lists to stdout.
- Distinctive: line 32
Don't just report failures.
- Distinctive: line 36
Avoid maintaining long-running state loops within the CLI if orchestrating complex workflows.
- Very specific: line 37
Use a stateless task identifier pattern (--task <ID>, --ref <ID>).
- Distinctive: line 40
Add an AGENTS.md or GEMINI.md file at the repository root explaining the tool's usage, workflows, and standards for AI developers.
- Distinctive: line 44
When building a CLI against a large Google/REST API, analyze its Discovery Document (e.g.
- Distinctive: line 45
Consider auto-generating the base commands directly from the Discovery Document to guarantee 100% API coverage.
- Distinctive: line 50
When implementing a CLI in Go, use Cobra for command routing and Viper for configuration management.
- Very specific: line 61
XDG Compliance: Follow the XDG Base Directory Specification for configuration files (e.g., ~/.config/app/config.yaml).
- Very specific: line 62
Smart Fallbacks Priority: Use Viper to ensure values resolve in this consistent order: Command Line Flag > Environment Variable > Config …
- Distinctive: line 64
Secrets Management: Never allow API keys to leak into shell history.
- Distinctive: line 68
When optimizing the CLI for human readability, draw on Tufte-inspired principles to minimize cognitive load:
- Very specific: line 70
Resilient UI Formatting: Always apply padding and width enforcement to raw strings *before* applying terminal styling (e.g., with lipgloss).
- Distinctive: line 72
Semantic Color Tokens: Use specific functional colors rather than aesthetic ones:
- Very specific: line 80
Color Degradation: Ensure colors degrade gracefully when piped to a file, when --json is invoked, or when NO_COLOR is present.
- Distinctive: line 84
When generating or updating a CLI command, you MUST ensure all of the following are implemented on your first pass.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent-Aware CLI Design Guidelines
When tasked with building or improving a Command Line Interface (CLI), follow these architectural and design best practices to ensure it serves both human operators (with rich TUIs) and AI agents (with deterministic, machine-readable output).
Core Principles
- The Dual-Experience Paradigm (DX & AX)
This CLI must be designed as a "Dual-Mode" interface, treating both humans and AI agents as first-class users.
- DX (Developer Experience): Ergonomics for human operators. Emphasizes discoverability, rich TUIs (e.g., Bubbletea, Lipgloss), semantic coloring, and intuitive aliases.
- AX (Agent Experience): Ergonomics for autonomous AI agents. Emphasizes determinism, strict machine-readable output modes (e.g.,
--json), headless authentication, aggressive data scoping (limits/filtering), and mutative safety (--dry-run). - Environment Overrides: Respect
NO_COLORand[APP]_NO_TUIenvironment variables to automatically fall back to non-interactive, unstyled modes.
- Headless-Friendly Authentication
- Agents cannot complete interactive, browser-based OAuth flows. CLIs must either support headless auth methods (Service Accounts, API Keys via ENV vars,
--tokenflags) OR immediately fail with a clear, machine-readable error instructing the human operator to authenticate manually first.
- Agents cannot complete interactive, browser-based OAuth flows. CLIs must either support headless auth methods (Service Accounts, API Keys via ENV vars,
- Sane Defaults & Aggressive Filtering
- Never dump unpaginated or unfiltered lists to
stdout. Default to sensible limits (e.g., top 10 items). Provide rich filtering flags (e.g.,--status,--mine,--limit) so agents can surgically query exactly what they need without blowing out their token context.
- Never dump unpaginated or unfiltered lists to
- Mutative Safety (
--dry-run)- For commands that create, update, or delete external state, implement a
--dry-runflag. This allows an autonomous agent to test its parameter mapping and validate the resulting payload locally before executing the destructive action.
- For commands that create, update, or delete external state, implement a
- Context Window Protection
- Agents have limited context windows. Actively truncate massive text blobs, sort critical action items to the top, and mask raw credentials by default to prevent credential leakage.
- Provide opt-in verbosity (e.g.,
--fullor--verbose) for agents or humans who explicitly request unfiltered data.
- Executable Proactive Error Hints
- Don't just report failures; provide the exact steps to fix them.
- Inject copy-pasteable terminal commands into
stderr(e.g.,Hint: run 'app init' to create a database). This enables autonomous agents to parse the error and self-correct seamlessly.
- Delegated State Management
- Avoid maintaining long-running state loops within the CLI if orchestrating complex workflows.
- Use a stateless task identifier pattern (
--task <ID>,--ref <ID>). Pass the ID back to the backend service, which maintains the token context window and conversation history.
- Externalized Agent Instructions
- Add an
AGENTS.mdorGEMINI.mdfile at the repository root explaining the tool's usage, workflows, and standards for AI developers. - Provide an
agentskills.iocompliantskills/directory withSKILL.mdfiles for complex subcommands.
- Add an
- API Discovery & Progressive Convenience
- When building a CLI against a large Google/REST API, analyze its Discovery Document (e.g.
https://youtube.googleapis.com/$discovery/rest?version=v3) to understand the exact, strict mappings of resources, methods, query parameters, and required OAuth scopes. - Consider auto-generating the base commands directly from the Discovery Document to guarantee 100% API coverage.
- However, raw REST mappings are often un-ergonomic for humans. You must layer "Convenience Wrappers" or "Hints" on top of the raw generated commands. For example, if a user asks to "list videos for a user", the CLI should intelligently abstract away the fact that it takes two API calls (one to resolve the handle to a Channel ID, and another to fetch the playlist) under a single
channel videos @usercommand.
- When building a CLI against a large Google/REST API, analyze its Discovery Document (e.g.
Implementation with Go (Cobra & Viper)
When implementing a CLI in Go, use Cobra for command routing and Viper for configuration management.
Cobra Practices
- Structured Discoverability: Prevent a "wall of text" in the root help output by using Cobra's
GroupIDto categorize commands (e.g.,Task Management,Information). - The Three Pillars of Documentation: Populate these fields for every command:
Short: A 5-10 word summary starting with an action verb for quick scanning.Long: Detailed explanation of what it does, why, and its differentiation.Example: 3-5 concrete, copy-pasteable examples showing common flag combinations.
- Fail Fast Hooks: Validate configuration and connectivity in
PersistentPreRunhooks before executing heavy logic.
Viper & Configuration Practices
- XDG Compliance: Follow the XDG Base Directory Specification for configuration files (e.g.,
~/.config/app/config.yaml). - Smart Fallbacks Priority: Use Viper to ensure values resolve in this consistent order:
Command Line Flag > Environment Variable > Config File > Default Value - Secrets Management: Never allow API keys to leak into shell history. Prefer environment variables over CLI flags for secrets.
Visual Information Design (Human Mode)
When optimizing the CLI for human readability, draw on Tufte-inspired principles to minimize cognitive load:
- Maximize Data-Ink Ratio: Minimize non-essential "ink" like decorative borders. Use whitespace and positioning as the primary tools for conveying hierarchy.
- Resilient UI Formatting: Always apply padding and width enforcement to raw strings before applying terminal styling (e.g., with
lipgloss). Invisible ANSI escape codes can otherwise corruptfmt.Printftable alignments. - The ANSI Alignment Gotcha: When building TUI tables in Go, native tools like
text/tabwriterorfmt.Printfwill break alignment if you pass strings containing invisible ANSI color codes. You MUST pad strings to their fixed widths before applying color wrappers, or use a robust layout engine likelipgloss.Table. - Semantic Color Tokens: Use specific functional colors rather than aesthetic ones:
Accent(Blue): Navigation landmarks, headers, group titles.Command(Grey/Light Grey): Scan targets like command names and flags.Pass(Green): Success states and completed tasks.Warn(Orange/Yellow): Transient or pending states, warnings.Fail(Red): Errors and rejected states.Muted(Dark Grey): De-emphasis for metadata, types, or defaults.ID(Teal/Mint): Unique identifiers.
- Color Degradation: Ensure colors degrade gracefully when piped to a file, when
--jsonis invoked, or whenNO_COLORis present.
Mandatory Implementation Checklist for Agents
When generating or updating a CLI command, you MUST ensure all of the following are implemented on your first pass. Do not treat UI/UX as an afterthought:
- Dual-Experience (DX/AX): Does the command support a
--jsonflag or respectNO_COLOR/[APP]_NO_TUI? - Headless Auth: Can an agent run this command autonomously without hanging on a browser-based OAuth prompt?
- Data Scoping: If returning a list, are there sane default limits and filtering flags (e.g.,
--limit,--status)? - Mutative Safety: If the command mutates state, does it include a
--dry-runflag for agent safety? - Error Hints: Do errors print actionable, copy-pasteable terminal commands to
stderr? - XDG Compliance: Is configuration handled via the XDG Base Directory specification (e.g.
~/.config/app/config.yaml) instead of local.envfiles? - The Three Pillars: Are
Short,Long, andExamplefields fully populated in the Cobra command definition? - Discoverability: Is the command assigned to a logical
GroupID? - Semantic Colors: Is the human-readable output formatted using the semantic color tokens (e.g., Lipgloss)?
- Alignment Safety: If using raw ANSI colors in tables, is string padding applied before the color codes to prevent alignment breaking?
- Help Formatting: Have you overridden Cobra's default
SetUsageTemplateto apply semantic colors to the help output itself (e.g., coloring headers blue)?
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.

