agent-friendly-cli

Author and audit CLI tools for AI agent compatibility using structured output and exit code standards.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/akhy/agent-skills --skill agent-friendly-cli-akhy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: agent-friendly-cli
Source: https://github.com/akhy/agent-skills/tree/main/agent-friendly-cli
Command: npx skills add https://github.com/akhy/agent-skills --skill agent-friendly-cli-akhy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Most command-line tools are designed for humans and are subtly hostile to AI agents: interactive prompts block automation, unstructured output breaks parsing, and vague errors prevent recovery. This Skill provides a concrete checklist and decision framework for building or reviewing CLIs that agents can reliably operate. ## Core Features & Use Cases - Audit Mode: Evaluate an existing CLI against requirements like --json output, meaningful exit codes, idempotency, dry-run, and input hardening, reporting pass/fail/partial with concrete fixes. - Create Mode: Apply all agent-friendly requirements from the start when building a new CLI, including noun-verb command hierarchy and structured error messages. - CLI vs. MCP Decision: Guidance on when to build a CLI versus an MCP server based on command count, statefulness, shell access, and token budget. - Use Case: You are building a deployment CLI that an AI agent will invoke. Use this Skill to ensure it supports --json, --dry-run, --yes, non-TTY detection, and actionable structured errors before shipping. ## Quick Start Audit my existing CLI tool for AI agent compatibility and list the blockers with concrete fixes.

Frequently Asked Questions about agent-friendly-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make a CLI tool work well with AI agents?▼

Add a --json flag that sends machine-readable output to stdout while warnings go to stderr, use meaningful exit codes (0-5), support --dry-run and --yes to bypass prompts, and return structured errors with error_code, input, suggestion, and retryable fields.

When should I build a CLI instead of an MCP server?▼

Choose a CLI when you have fewer than ~15 commands, stateless operations, agent shell access, and token budget concerns. Choose MCP when you have 50+ tools, need stateful sessions, lack shell access, or run multi-agent systems.

What exit codes should a CLI use for agent automation?▼

Use 0 for success, 1 for general failure, 2 for usage errors, 3 for resource not found, 4 for permission denied, and 5 for conflicts such as a resource that already exists. Agents rely on $? for control flow decisions.

How do I handle interactive prompts when agents run my CLI?▼

Provide --yes or --force flags to bypass all prompts since agents cannot type confirmations. Also detect non-TTY stdin with isatty checks and either skip prompts automatically or fail fast with a message pointing to the --yes flag.

Why does my CLI break when an AI agent passes input?▼

Agents hallucinate inputs in ways humans do not, such as path traversals, control characters, or double-encoded sequences like %2520. Validate file paths, reject shell-special characters in IDs, and guard against URL-encoding attacks.