Agent friendly cli
LLM agent skills collection
npx -y skills add akhy/agent-skills --skill agent-friendly-cliAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Author or audit AI agent-friendly CLI tools. Use when creating a new CLI, reviewing an existing CLI for agent compatibility, or deciding between CLI and MCP.
SKILL.md
5.4 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
Agent-Friendly CLI Skill
Two modes: Create (new CLI) and Audit (existing CLI).
Mode: Audit
When given an existing CLI, evaluate it against each requirement below. For each item report: ✅ pass, ❌ fail, or ⚠️ partial — and give a concrete fix for every non-pass.
Present findings as a prioritized list (blockers first, then improvements).
Mode: Create
When asked to build a new CLI, apply all requirements below from the start. Remind the user of the CLI vs. MCP decision before writing code.
CLI vs. MCP Decision
Choose CLI when:
- Fewer than ~15 commands
- Stateless operations
- Agent has shell access
- Token budget matters (MCP adds ambient cost in system prompt)
Choose MCP when:
- 50+ tools behind one server
- Stateful sessions needed
- No shell access for agent
- Multi-agent systems
Requirements
1. Structured Output
--jsonflag outputs machine-readable JSON to stdout- In
--jsonmode: all warnings, progress, and human text go to stderr so stdout stays parseable - In normal (human) mode: output goes to stdout as usual
- Keep output flat over nested — easier to parse reliably
- Consistent field types across all commands: timestamps in ISO 8601, durations in seconds
# Human mode — rich output to stdout
$ mytool list
┌─────┬──────┐
│ ID │ Name │
└─────┴──────┘
# Machine mode — clean JSON to stdout, any warnings to stderr
$ mytool list --json
[{"id":"abc","name":"foo","created_at":"2025-01-01T00:00:00Z"}]
2. Exit Codes
Agents use $? for control flow. Use meaningful codes:
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General failure |
| 2 | Usage error (bad arguments) |
| 3 | Resource not found |
| 4 | Permission denied |
| 5 | Conflict (resource already exists) |
3. Idempotency
- Design commands safe to retry: prefer
ensure/upsertsemantics overcreate - Or support
--if-not-existsto turn conflict into a no-op - If idempotency isn't possible, return exit code
5on conflict so agents can handle it
4. Self-Documenting Help
--helpincludes realistic examples for every command- Required vs. optional flags are clearly marked
--jsonis documented prominently- Use hierarchical
noun verbpattern:tool resource action(e.g.docker container ls, notdocker-container-ls)
5. Composability & Piping
--quiet/-qfor bare output (one item per line, no decoration) — pipe-friendly--output jsonwith optional--fields id,nameto limit response size- Batch operations via
--selectoror repeated args instead of requiring 50 individual calls
6. Dry-Run & No-Prompt Modes
--dry-runproduces structured output showing what would change — nothing is mutated--yes/--forcebypasses all interactive prompts (agents cannot type "y")- Detect non-TTY (
!isatty(stdin)) and either skip prompts automatically or fail fast with a clear message pointing to--yes
7. Actionable Error Messages
Include in structured error output:
error_code/error_type(not just"Error: deployment failed")- The failing input echoed back, so agents can construct a fix
- Suggested next step where applicable
- Whether the error is transient (safe to retry) or permanent (give up)
{
"error": "resource_not_found",
"message": "Project 'staging' does not exist",
"input": {"project": "staging"},
"suggestion": "Run 'mytool project list' to see available projects",
"retryable": false
}
8. Input Hardening
Agents hallucinate in ways humans don't:
- Validate file paths — reject traversals (
../../.ssh) - Reject control characters and shell-special characters in IDs/names
- Validate resource IDs — reject
?,#,%, URL-encoded sequences - Guard against double-encoding (
%2520→%20→)
Checklist (quick reference)
[ ] --json flag outputs to stdout; warnings/progress to stderr only in --json mode
[ ] Meaningful exit codes (0–5 minimum)
[ ] Idempotent operations or clear conflict handling (exit 5)
[ ] --help with realistic examples per command
[ ] --dry-run for destructive/mutating commands
[ ] --yes/--force to bypass all prompts
[ ] Non-TTY detection (auto-skip prompts or fail + hint)
[ ] --quiet/-q for bare pipe-friendly output
[ ] Consistent field names and types across commands
[ ] Noun-verb command hierarchy
[ ] Structured error with error_code, input, suggestion, retryable
[ ] Batch operations for bulk work
[ ] Input validation (paths, IDs, encoding)
Note on Design Philosophy
Most CLIs are subtly hostile to agents. The goal isn't a rewrite — it's layering agent-friendly patterns on top of human-friendly ones. Support both paths in the same binary: rich tables for humans when stdout is a TTY, clean JSON when it isn't.
Gives 0 of the 12 instructions most context ai engineering skills give in ~1.2k tokens
Counted across 1,193 of the 1,976 authors here whose files we hold, read 2026-08-07
- dispatch a fresh implementer subagent per taskin 48 of 1193, across 19 files
- dispatch a final code reviewer after all tasksin 33 of 1193, across 8 files
- provide full task text to the subagentin 30 of 1193, across 9 files
- review spec compliance before code qualityin 27 of 1193, across 10 files
- make the hook script executablein 26 of 1193, across 8 files
- re-snapshot after navigation or DOM changesin 25 of 1193, across 19 files
- read files before editing themin 22 of 1193, across 11 files
- answer subagent questions before proceedingin 22 of 1193, across 7 files
- mark task complete in TodoWrite after approvalin 22 of 1193, across 6 files
- merge hook into existing settingsin 21 of 1193, across 3 files
- ask if installation is global or projectin 20 of 1193, across 2 files
- copy the hook script to target locationin 20 of 1193, across 2 files
Said here and by no other author read
- route warnings and progress text to stderr during JSON output
- keep JSON output flat rather than nested
- use meaningful exit codes from zero to five
- use idempotent operations or clear conflict handling
- include realistic examples and flag markings in help text
- use a hierarchical noun verb command structure
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.