cli-for-agents

Design agent-friendly CLIs with non-interactive behavior, stable output, and idempotent retries.

Updated Mar 11, 2026
One-click install
npx skills add https://github.com/selfagency/agentsy --skill cli-for-agents-selfagency
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-for-agents
Source: https://github.com/selfagency/agentsy/tree/main/.agents/skills/cli-for-agents
Command: npx skills add https://github.com/selfagency/agentsy --skill cli-for-agents-selfagency

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill solves the problem of AI agents being unable to use command-line tools reliably because the CLI hangs on prompts, produces non-actionable errors, lacks machine-readable output, or forces brittle parsing.

Core Features & Use Cases

It provides prescriptive, agent-focused CLI design rules covering non-interactive operation, layered --help with copy-paste examples, actionable stderr errors with correct exit codes, destructive-action safety (dry-run, --yes/--force), composable stdin/pipeline handling, stable output formats (including --json and NDJSON streaming), idempotency patterns for retries, and consistent subcommand structure using a resource-verb shape. It is intended for designing or reviewing any CLI that AI agents or automation will invoke for provisioning, orchestration, retrieval, deployment, and other operational workflows where retries and non-human execution are common.

Quick Start

Apply the cli-for-agents skill while designing your next CLI by asking an AI assistant to review your proposed commands for non-interactive behavior, help/examples, stderr errors, dry-run/--yes for destructive actions, and idempotency under retries.

Frequently Asked Questions about cli-for-agents

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

FAQPage Schema
How do I design a CLI that AI agents can run without hanging or prompting?

Agent-friendly CLI design requires non-interactive operation, bypassing TTY-guarded prompts with flags like --yes or --force, and ensuring headless execution to prevent hangs during automated pipelines.

What makes command-line interface errors actionable for automated agents?

Actionable CLI errors for agents require writing diagnostic details to stderr, using distinct exit codes for different failure modes, and avoiding brittle text parsing by providing machine-readable output formats like JSON.

How do I make destructive CLI operations safe for automated workflows?

Make destructive CLI operations safe for automation by implementing dry-run modes, adding confirmation bypass flags, and ensuring idempotent semantics so state-changing retries produce consistent output shapes without duplicate side effects.

What is the best way to structure CLI help text for AI agent consumption?

The best CLI help text for agents uses a layered structure with copy-paste runnable examples, clearly documents subcommands in a resource-verb shape, and specifies flag usage for stdin and pipeline composition.

Why do my CLI commands fail when invoked by CI pipelines or headless agents?

CLI commands fail in headless CI environments when they attempt interactive prompts without a TTY, lack stable machine-readable output modes like NDJSON streaming, or return non-distinct exit codes that break retry logic.