Token导航 LogoToken导航

Agent Skill · 研究检索

api2cli(api2cli 命令行)

api2cli 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

api2cli 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 52,216。

总安装 563周安装 23GitHub Stars 429下载 182核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:api2cli(api2cli 命令行)
来源仓库:https://github.com/alexknowshtml/api2cli
仓库路径:skills/api2cli
安装命令:
npx skills add https://github.com/alexknowshtml/api2cli --skill api2cli
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/alexknowshtml/api2cli --skill api2cli

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于将任意 API 自动生成 Node.js 命令行接口并封装为 Claude Code 技能。适合在 Codex、Claude、Cursor、Gemini CLI 中快速搭建基于 Commander.js 的双模 CLI 工具。使用时需提供 API 文档 URL 或实时探测目标端点以完成端点发现与标准化转换。

安装方式:通过 npx skills add 命令从指定 GitHub 仓库添加,支持自定义输出路径。生成的技能文件夹包含完整客户端代码与使用说明,可直接集成至现有工作流。

来源仓库内路径:skills/api2cli

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/alexknowshtml/api2cli --skill api2cli;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

api2cli 怎么安装?

在终端执行 npx skills add https://github.com/alexknowshtml/api2cli --skill api2cli。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

api2cli 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

api2cli 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

api2cli 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

api2cli 用的人多吗?

公开数据是累计安装 563 次,近一周安装 23 次,下载 182 次,GitHub 429 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

api2cli 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
api2cli

api2cli 命令行 · 本页

563429接触敏感数据未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

api2cli

Generate a working Node.js CLI from any API, then wrap it in a Claude Code skill. Discovers endpoints, scaffolds a dual-mode Commander.js CLI with a full-featured API client, and creates a skill folder so Claude knows how to use it.

Workflow

  1. Identify the API -- user provides a docs URL, a live API base URL, or a peek-api capture
  2. Discover endpoints -- parse docs, probe the API, or read a peek-api catalog
  3. Build endpoint catalog -- normalize all discovered endpoints into a standard format
  4. Generate CLI -- scaffold Commander.js CLI from the catalog
  5. User chooses destination -- scaffold into current project or create standalone project
  6. Generate skill -- create a SKILL.md that teaches Claude how to use the generated CLI

Step 1: Identify the API

Ask the user:

  • "What API do you want to wrap? Share a docs URL, a base URL, or point me at a peek-api capture."

Determine which discovery paths to use based on what they provide:

InputDiscovery Path
Docs URL (e.g., https://docs.stripe.com/api)Docs parsing + active probing
Base URL (e.g., https://api.example.com/v1)Active probing
peek-api capture dir (e.g., ./peek-api-linkedin/)Read existing catalog
Live website URLSuggest running peek-api first, then active probing

Also ask:

  • "What auth does this API use?" (API key, Bearer token, cookies, OAuth, none)
  • "Do you want this CLI in your current project or as a standalone project?"

Step 2: Discover Endpoints

Use all applicable discovery paths. Combine results into a single catalog.

Path A: Docs Parsing

  1. Fetch the docs URL with WebFetch
  2. Extract endpoint information: method, path, description, parameters, request/response examples
  3. Look for pagination patterns, auth requirements, rate limit info
  4. Follow links to sub-pages for individual endpoint docs if the main page is an index

Path B: Active Probing

  1. Check well-known paths for API specs:

- /.well-known/openapi.json, /.well-known/openapi.yaml - /openapi.json, /openapi.yaml, /swagger.json, /swagger.yaml - /api-docs, /docs, /api/docs - /graphql (with introspection query)

  1. Try OPTIONS on the base URL and common resource paths
  2. Probe common REST patterns: /api/v1/, /api/v2/, /v1/, /v2/
  3. For each discovered resource, try standard CRUD: GET /resources, GET /resources/:id, POST /resources, etc.
  4. Parse response shapes to understand data models
  5. Check response headers for rate limit info (X-RateLimit-*, Retry-After)
  6. Check for pagination patterns in responses (next, cursor, page, offset)

See references/discovery-strategies.md for detailed probing patterns.

Path C: peek-api Capture

  1. Read the capture directory: endpoints.json, auth.json, CAPTURE.md
  2. Parse endpoints into the standard catalog format
  3. Extract auth headers and cookies from auth.json

If peek-api is not installed or no capture exists, tell the user:

To capture endpoints from a live site, install peek-api:
  git clone https://github.com/alexknowshtml/peek-api
  cd peek-api && npm install
  node bin/cli.js https://example.com

Step 3: Build Endpoint Catalog

Normalize all discovered endpoints into this format:

interface EndpointCatalog {
  service: string;           // e.g., "stripe", "nexudus"
  baseUrl: string;
  auth: {
    type: 'api-key' | 'bearer' | 'cookies' | 'oauth' | 'none';
    headerName?: string;     // e.g., "Authorization", "X-API-Key"
    envVar: string;          // e.g., "STRIPE_API_KEY"
  };
  pagination?: {
    style: 'cursor' | 'offset' | 'page' | 'link-header';
    paramName: string;       // e.g., "starting_after", "offset", "page"
    responseField: string;   // e.g., "has_more", "next", "next_page_url"
  };
  rateLimit?: {
    requests: number;
    window: string;          // e.g., "1m", "1h"
  };
  resources: ResourceGroup[];
}

interface ResourceGroup {
  name: string;              // e.g., "customers", "invoices"
  description: string;
  endpoints: Endpoint[];
}

interface Endpoint {
  method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
  path: string;              // e.g., "/v1/customers/:id"
  description: string;
  parameters: Parameter[];
  requestBody?: object;      // JSON schema or example
  responseExample?: object;
}

interface Parameter {
  name: string;
  in: 'path' | 'query' | 'header';
  required: boolean;
  type: string;
  description: string;
}

Present the catalog to the user for review before generating:

Found 24 endpoints across 5 resources:
  customers (6 endpoints): list, get, create, update, delete, search
  invoices (5 endpoints): list, get, create, send, void
  ...
Ready to generate the CLI?

Step 4: Generate CLI

Generate a dual-mode CLI using Commander.js. The CLI auto-detects human vs agent output via process.stdout.isTTY.

File Structure

In-project scaffold:

scripts/
  {service}.ts                    # Entry point with shebang
  {service}/
    lib/
      client.ts                   # API client (auth, pagination, retry, caching)
      envelope.ts                 # Agent JSON envelope helpers
    commands/
      {resource}.ts               # One file per resource group

Standalone project:

{service}-cli/
  package.json
  tsconfig.json
  bin/
    {service}.ts                  # Entry point with shebang
  src/
    lib/
      client.ts
      envelope.ts
    commands/
      {resource}.ts

Code Generation Patterns

See these references for the patterns to apply during generation:

  • references/api-client-template.md -- API client class with pagination, retry, rate limiting, caching
  • references/agent-first-patterns.md -- JSON envelope, HATEOAS next_actions, context-safe output, error fix suggestions
  • references/commander-patterns.md -- Commander.js subcommands, global options, interactive prompts, colored output

Key Generation Rules

Entry point ({service}.ts):

  • Shebang: #!/usr/bin/env npx tsx
  • Self-documenting root command (no args → prints full command tree as JSON)
  • Global options: --json (force JSON output), --verbose, --config <path>

API client (lib/client.ts):

  • Constructor takes base URL + auth config
  • Auth from env var (name based on catalog.auth.envVar)
  • Built-in pagination matching the API's pattern
  • Retry with exponential backoff for 5xx and 429 errors
  • Rate limiting based on discovered limits
  • Optional response caching

Envelope helpers (lib/envelope.ts):

const isAgent = !process.stdout.isTTY;

function respond(command: string, result: any, nextActions: Action[] = []) {
  if (isAgent) {
    console.log(JSON.stringify({ ok: true, command, result, next_actions: nextActions }));
  } else {
    return result; // caller handles human rendering
  }
}

function respondError(command: string, message: string, code: string, fix: string, nextActions: Action[] = []) {
  if (isAgent) {
    console.log(JSON.stringify({ ok: false, command, error: { message, code }, fix, next_actions: nextActions }));
  } else {
    console.error(`Error: ${message}`);
    console.error(`Fix: ${fix}`);
  }
  process.exit(1);
}

Command files (commands/{resource}.ts):

  • One file per resource group
  • Each endpoint becomes a subcommand: mycli customers list, mycli customers get <id>
  • list commands: support --limit, --offset/--cursor, --status (if filterable)
  • get commands: take ID as argument
  • create/update commands: accept --data <json> or individual --field flags
  • Every command includes contextual next_actions for agent mode
  • Errors include fix suggestions

Standalone project extras:

  • package.json with commander, tsx as dependencies, bin field pointing to entry
  • tsconfig.json for TypeScript
  • .env.example with the required env var

Step 5: Verify

After generating the CLI:

  1. Verify it runs: Execute with no args, confirm the self-documenting root works
  2. Test one endpoint: Pick a simple GET endpoint, run it, verify output
  3. Move on to Step 6 to wrap the CLI in a skill

Step 6: Generate Skill

Create a Claude Code skill folder that teaches Claude how to use the generated CLI. This is the final step -- it turns the CLI into something any Claude session can pick up and use without reading the code.

Skill Structure

.claude/skills/{service}/
  SKILL.md                    # Skill instructions

SKILL.md Template

Generate a SKILL.md with this structure:

---
name: {service}
description: Interact with the {Service} API via CLI. Use when user wants to
  {list of actions based on discovered resources, e.g., "list customers,
  create invoices, check order status"}. Commands: {service} {resource} {action}.
---

# {Service} CLI

CLI wrapper for the {Service} API.

## Setup

Set the `{SERVICE_ENV_VAR}` environment variable:
\`\`\`bash
export {SERVICE_ENV_VAR}=your-api-key-here
\`\`\`

## Commands

{For each resource group, list commands with examples:}

### {Resource}

\`\`\`bash
# List {resources}
npx tsx {path/to/cli}.ts {resource} list

# Get a specific {resource}
npx tsx {path/to/cli}.ts {resource} get <id>

# Create a {resource}
npx tsx {path/to/cli}.ts {resource} create --field value
\`\`\`

## Common Workflows

{Generate 2-3 practical workflows combining multiple commands:}

### Example: {Workflow name}
\`\`\`bash
# Step 1: Find the customer
npx tsx {path/to/cli}.ts customers list --status=active

# Step 2: Get their invoices
npx tsx {path/to/cli}.ts invoices list --customer-id=abc123
\`\`\`

## Agent Usage

When piped, all commands return JSON with `next_actions`:
\`\`\`bash
npx tsx {path/to/cli}.ts {resource} list | cat
\`\`\`

Key Rules for Skill Generation

  1. Description is critical -- include specific trigger phrases and list the actions the CLI supports. This is what Claude reads to decide when to use the skill.
  2. Include real command examples -- use the actual CLI path and real subcommand names from the generated CLI.
  3. Generate practical workflows -- combine multiple commands into realistic multi-step scenarios based on how the API's resources relate to each other.
  4. Keep it lean -- the skill should be a quick reference, not a restatement of --help. Focus on what Claude needs to know that it can't infer.

Tell the User

After generating both the CLI and the skill:

CLI generated at {cli_path}
Skill generated at .claude/skills/{service}/SKILL.md

To use the CLI directly:
  npx tsx {cli_path}                           # See all commands
  npx tsx {cli_path} customers list            # List customers

Claude will now automatically use this skill when you ask about {service}.

Reference Files

  • references/discovery-strategies.md -- Detailed probing patterns, well-known paths, GraphQL introspection, response parsing
  • references/api-client-template.md -- Full API client class with pagination, retry, rate limiting, caching
  • references/agent-first-patterns.md -- Agent JSON envelope, HATEOAS, context-safe output, error handling
  • references/commander-patterns.md -- Commander.js subcommands, nested commands, interactive prompts, colored output, config files, testing

平台分布

Codex

33.23%
按下载量换算60

Claude

32.39%
按下载量换算59

Cursor

19.35%
按下载量换算35

Gemini CLI

9.22%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills