api2cli

作者 alexknowshtml已验证

Audience-aware CLI patterns for Node.js + Commander.js. Build CLIs for humans, AI agents, or both.

452
Stars
17
Forks
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/alexknowshtml/api2cli

快速入门

使用 api2cli 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

api2cli

A Claude Code skill that turns any API into a working CLI, then wraps that CLI in a skill. Point it at API docs, a live URL, or a peek-api capture and get a dual-mode Commander.js CLI plus a ready-to-use Claude Code skill -- so any future Claude session can pick it up and use it without reading the code.

Requires Claude Code -- this is a skill, not a standalone tool. Claude handles the discovery, generation, and wiring.

What It Does

  1. Discovers endpoints from API docs pages, live probing, or peek-api network captures
  2. Builds an endpoint catalog with auth, pagination, and rate limit info
  3. Generates a CLI with one subcommand per endpoint, a full-featured API client, and dual-mode output (human-readable in terminal, JSON envelope when piped)
  4. Generates a skill -- a SKILL.md that teaches Claude how to use the CLI, with commands, examples, and common workflows

Example: Resend API

Here's what it looks like when you point api2cli at the Resend email API.

You say:

Build me a CLI for the Resend API. Here are the docs: https://resend.com/docs/api-reference

Claude discovers 15 endpoints across 5 resources:

Found 15 endpoints across 5 resources:
  emails (3 endpoints): send, get, batch
  domains (4 endpoints): list, get, create, delete
  api-keys (3 endpoints): list, create, delete
  audiences (3 endpoints): list, get, create
  contacts (2 endpoints): list, create

Ready to generate the CLI?

Claude generates a CLI at scripts/resend.ts:

# See all commands
$ npx tsx scripts/resend.ts
{
  "ok": true,
  "command": "resend",
  "result": {
    "description": "Resend email API CLI",
    "commands": [
      { "command": "resend emails send", "description": "Send an email" },
      { "command": "resend emails get <id>", "description": "Get email by ID" },
      { "command": "resend domains list", "description": "List all domains" },
      ...
    ]
  }
}

# Send an email
$ npx tsx scripts/resend.ts emails send \
    --to user@example.com \
    --subject "Hello" \
    --html "<p>Hi there</p>"

# List domains (human-readable in terminal)
$ npx tsx scripts/resend.ts domains list
ID          Domain              Status
re_abc123   example.com         verified
re_def456   staging.example.com pending

# Same command piped to an agent (auto-detects, returns JSON)
$ npx tsx scripts/resend.ts domains list | cat
{
  "ok": true,
  "command": "resend domains list",
  "result": { "domains": [...], "count": 2 },
  "next_actions": [
    { "command": "resend domains get re_abc123", "description": "View domain details" },
    { "command": "resend emails send --from noreply@example.com", "description": "Send from verified domain" }
  ]
}

Claude also generates a skill at .claude/skills/resend/SKILL.md:

---
name: resend
description: Interact with the Resend email API via CLI. Use when user wants to
  send emails, manage domains, create API keys, manage audiences and contacts.
  Commands: resend emails send, resend domains list, resend contacts create.
---

# Resend CLI

## Setup
export RESEND_API_KEY=re_your_key_here

## Commands
### emails send --to <email> --subject <text> --html <html>
### domains list | get <id> | create --name <domain>
### contacts list --audience-id <id> | create --email <email>
...

From here, any Claude session in your project can send emails, manage domains, and work with contacts -- without knowing anything about the Resend API.

Install

Copy the skill/ folder into your Claude Code project:

# Clone this repo
git clone https://github.com/alexknowshtml/api2cli.git

# Copy the skill into your project
cp -r api2cli/skill/ /path/to/your/project/.claude/skills/api2cli/

Usage

In Claude Code, tell Claude what API you want to wrap:

"Build me a CLI for the Resend API"
"Generate a CLI from these docs: https://docs.example.com/api"
"Turn this peek-api capture into a CLI"

Claude will:

  1. Ask what API and how to access it
  2. Discover endpoints (parses docs, probes live endpoints, reads peek-api captures)
  3. Show you the endpoint catalog for review
  4. Generate the CLI -- you choose: scaffold into your project or standalone
  5. Test that it works
  6. Generate a skill folder so Claude can use the CLI in future sessions

What Gets Generated

A CLI -- Commander.js with:

  • Dual-mode output -- human-readable in terminal, JSON with next_actions when piped
  • Self-documenting root -- run with no args to see all commands
  • Full API client -- auth, pagination, retry with backoff, rate limiting, caching
  • One subcommand per endpoint -- mycli customers list, mycli customers get <id>
  • Error handling -- agent-friendly errors with fix suggestions

A skill -- a .claude/skills/{service}/SKILL.md that:

  • Lists all available commands with examples
  • Includes common multi-step workflows
  • Has the right trigger phrases so Claude auto-activates when relevant
  • Documents auth setup and agent usage

Discovery Methods

MethodBest For
Docs parsingPublic APIs with documentation pages
Active probingAPIs where you have a base URL and credentials
peek-api captureSites where you need to sniff network traffic to find endpoints

What's Inside

skill/
  SKILL.md                                # Main skill instructions
  references/
    discovery-strategies.md               # Endpoint discovery patterns and probing techniques
    api-client-template.md                # API client with pagination, retry, rate limiting, caching
    agent-first-patterns.md               # Agent JSON envelope, HATEOAS, context-safe output
    commander-patterns.md                 # Commander.js advanced patterns

Credits

This came from a pattern of wanting to give my AI agent access to apps and discovering it loved working with CLIs. I wanted an easy way to turn any API into a CLI, then wrap that CLI in a skill. The audience routing (human-first, agent-first, dual-mode), the API discovery pipeline (peek-api, docs parsing, active probing), and the generation approach all came from that.

The agent-side output patterns -- JSON envelope, HATEOAS-style next_actions, self-documenting root commands, and fix suggestions on errors -- were inspired by Joel Hooks' agent-first CLI design.

Related

  • peek-api -- Discover internal APIs from any website by monitoring network traffic

License

MIT

常见问题

What is api2cli?

api2cli is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by alexknowshtml. Audience-aware CLI patterns for Node.js + Commander.js. Build CLIs for humans, AI agents, or both. It has 452 GitHub stars.

Is api2cli safe to use?

Yes. api2cli passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install api2cli?

Clone the repository with "git clone https://github.com/alexknowshtml/api2cli" and add it to your Claude Code skills directory (see the Installation section above).

Are there alternatives to api2cli?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh api2cli against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情