← 返回 Skills 市场
g9pedro

Agent-Friendly CLI

作者 G9Pedro · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
181
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install agent-friendly-cli
功能描述
Design and audit CLIs for agent usability. Use when building a new CLI tool, auditing an existing CLI for agent compatibility, reviewing CLI UX for AI agents...
使用说明 (SKILL.md)

Agent-Friendly CLI Design

Checklist and patterns for building CLIs that agents can use effectively. Most CLIs assume a human at the keyboard — these patterns close the gap.

Core Principles

1. Non-Interactive by Default

Every input must be passable as a flag. Interactive prompts block agents.

# ❌ Blocks agents
$ mycli deploy
? Which environment? (use arrow keys)

# ✅ Works
$ mycli deploy --env staging

Keep interactive mode as fallback when flags are missing, never the primary path.

2. Progressive Help Discovery

Don't dump all docs upfront. Let agents discover via --help per subcommand.

# Agent runs top-level, sees subcommands
$ mycli --help

# Picks one, gets specific help
$ mycli deploy --help

An agent wastes no context on commands it won't use.

3. Useful --help with Examples

Every subcommand gets --help. Every --help includes examples. Agents pattern-match off examples faster than descriptions.

$ mycli deploy --help
Options:
  --env     Target environment (staging, production)
  --tag     Image tag (default: latest)
  --force   Skip confirmation

Examples:
  mycli deploy --env staging
  mycli deploy --env production --tag v1.2.3
  mycli deploy --env staging --force

4. Flags and stdin for Everything

Agents think in pipelines. Support chaining and piping.

cat config.json | mycli config import --stdin
mycli deploy --env staging --tag $(mycli build --output tag-only)

Don't require positional args in weird orders. Don't fall back to interactive prompts for missing values.

5. Fail Fast with Actionable Errors

Missing flag? Error immediately with correct invocation. Don't hang or print vague messages.

# ❌ Bad
$ mycli deploy
Error: missing required arguments

# ✅ Good
$ mycli deploy
Error: --env is required
Usage: mycli deploy --env \x3Cstaging|production> [--tag \x3Cversion>]

Agents self-correct when given something to work with.

6. Idempotent Commands

Agents retry constantly — network timeouts, context loss mid-task. Running the same command twice should be safe.

$ mycli deploy --env staging --tag v1.2.3
✓ Deployed v1.2.3 to staging

$ mycli deploy --env staging --tag v1.2.3
✓ Already deployed, no-op

7. --dry-run for Destructive Actions

Let agents preview before committing.

$ mycli deploy --env production --tag v1.2.3 --dry-run
Would deploy v1.2.3 to production
  - Stop 3 running instances
  - Pull image registry.io/app:v1.2.3
  - Start 3 new instances
No changes made.

8. --yes / --force to Skip Confirmations

Humans get "are you sure?" — agents pass --yes.

$ mycli delete-all --yes

Make the safe path the default but allow bypassing.

9. Predictable Command Structure

Pick a pattern and use it everywhere. If an agent learns one, it can guess the rest.

# resource + verb pattern
mycli service list
mycli deploy list
mycli config list

10. Structured Output on Success

Return actionable data, not just decorative messages.

# ❌ Cute but unhelpful
$ mycli deploy
🚀 Deployed successfully!

# ✅ Actionable
$ mycli deploy --env staging --tag v1.2.3
deployed v1.2.3 to staging
url: https://staging.myapp.com
deploy_id: dep_abc123
duration: 34s

Support --json for machine-readable output when possible.

11. Consistent Exit Codes

  • 0 = success
  • 1 = general error
  • 2 = usage error (bad args)

Agents use exit codes to decide next steps.

Audit Checklist

When reviewing an existing CLI for agent compatibility, check each item:

# Pattern Check
1 Non-interactive Can every input be passed as a flag?
2 Progressive help Does each subcommand have its own --help?
3 Examples in help Does --help include usage examples?
4 Stdin support Can data be piped in via --stdin or -?
5 Fast failures Do missing args error immediately with usage hint?
6 Idempotency Is running the same command twice safe?
7 Dry run Do destructive commands support --dry-run?
8 Skip prompts Is there --yes / --force for confirmations?
9 Predictable structure Is command naming consistent (resource + verb)?
10 Structured output Does success output include actionable data?
11 JSON output Is --json available for machine parsing?
12 Exit codes Are exit codes consistent (0/1/2)?

When Designing a New CLI

  1. Start with the flag-only interface. Add interactive prompts later as convenience.
  2. Write the --help examples before writing the implementation.
  3. Default to --json output internally, add human-friendly formatting on top.
  4. Every write operation gets --dry-run. No exceptions.
  5. Test by having an agent use it. Watch where it gets stuck.

Source

Based on Eric Zakariasson's (Cursor) "Building CLIs for agents" (March 2026), field-tested across ClawVault, WorkGraph, and Versatly CLI ecosystem.

安全使用建议
This is a benign, instruction-only checklist for designing and auditing CLIs for agent use. It doesn't request credentials or install code. Before using, consider: (1) the source is unknown — if you plan to rely on this guidance in production, verify the referenced research or link to authors; (2) if you copy examples into code, review them for correctness and licensing; and (3) no secret or sensitive access is required by the skill itself, but be cautious when applying these patterns in tools that do interact with credentials or production systems.
功能分析
Type: OpenClaw Skill Name: agent-friendly-cli Version: 1.0.1 The skill bundle is a purely educational guide and checklist for designing and auditing command-line interfaces (CLIs) to improve usability for AI agents. It contains no executable code, network requests, or instructions that would lead to data exfiltration or unauthorized actions. The content in SKILL.md focuses on best practices such as non-interactivity, structured output, and idempotency.
能力评估
Purpose & Capability
Name and description match the SKILL.md content: both describe patterns and an audit checklist for making CLIs agent-friendly. There are no unrelated binaries, credentials, or install steps requested.
Instruction Scope
SKILL.md is a guidance document and checklist; it does not instruct the agent to read files, call external endpoints, access credentials, or perform system-level actions. All instructions stay within the stated purpose of CLI design and auditing.
Install Mechanism
No install spec and no code files present. Because this is instruction-only, nothing will be written to disk or executed during install.
Credentials
The skill declares no environment variables, credentials, or config paths and the SKILL.md does not reference any secrets — the requested access is proportionate (none) for the stated purpose.
Persistence & Privilege
always:false and default autonomous invocation allowed — appropriate for a user-invocable guidance skill. The skill does not request persistent presence or modify other skills or system settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-friendly-cli
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-friendly-cli 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Repackaged from workspace and published for skills.sh compatibility.
v1.0.0
Initial release — 12-point checklist and patterns for building CLIs that AI agents can use effectively. Based on Cursor team research.
元数据
Slug agent-friendly-cli
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Agent-Friendly CLI 是什么?

Design and audit CLIs for agent usability. Use when building a new CLI tool, auditing an existing CLI for agent compatibility, reviewing CLI UX for AI agents... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 181 次。

如何安装 Agent-Friendly CLI?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-friendly-cli」即可一键安装,无需额外配置。

Agent-Friendly CLI 是免费的吗?

是的,Agent-Friendly CLI 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agent-Friendly CLI 支持哪些平台?

Agent-Friendly CLI 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agent-Friendly CLI?

由 G9Pedro(@g9pedro)开发并维护,当前版本 v1.0.1。

💬 留言讨论