api2cli

A generator that turns an API (a service software can call) into a Node.js command-line program and a Claude Code skill. It can start from API documentation, a live base URL, or a captured endpoint catalogue.

In plain words
What is it for?
Inspecting an API, cataloguing its endpoints, scaffolding a Commander.js CLI for people and agents, and generating a skill folder for the resulting CLI.
Why use it?
It removes much of the repeated work of discovering endpoints, building an API client, creating command-line commands, and teaching an agent how to use them.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/alexknowshtml/api2cli/skill
Any agent
npx skills add alexknowshtml/api2cli --skill skill
Clone the repo
git clone --depth 1 https://github.com/alexknowshtml/api2cli

Made for: Claude Code, Codex.

Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,948 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00101 $0.02948
Opus 5 $0.00051 $0.01474
Sonnet 5 $0.00020 $0.00590
Haiku 4.5 $0.00010 $0.00295

Measured 2d ago against content hash 92918ec1d1ef, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api2cli scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skill/SKILL.md · 337 lines

How it starts

The opening of the file, as written. The whole thing — 337 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

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

Read the full file on GitHub · 337 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 337 lines · 101 tokens per session scan A 92918ec1d1ef

Subscribe to this mod's changes

api2cli is a skill published in the GitHub repository alexknowshtml/api2cli (452 stars, last pushed 6mo ago), licensed MIT. It adds 101 tokens to every session and 2,948 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

completion-rule

大模型代码生成任务的自动自检与纠错规则。 在代码输出后强制执行功能自测、单元测试设计和 Linter 检查。 未通过则自动修正并循环,直到全部通过或达到最大迭代次数。 适用于大模型生成或修改代码且要求正确、可测试、规范的场景。 支持 Python、TypeScript、Go、Java,语言规则通过 references 加载。.

Rain120/qq-music-api · 98 tokens

easy-api-mcp

Teaches AI agents how to connect to the open-wa hosted MCP surface via Easy API.

open-wa/wa-automate-nodejs · 23 tokens

core-runtime

Teaches AI agents about open-wa session lifecycle, readiness expectations, and safe operation patterns.

open-wa/wa-automate-nodejs · 21 tokens

express-docs

Comprehensive Express.js reference covering getting started, routing, middleware, error handling, the Application/Request/Response/Router API objects, template engines, debugging, database integration, security, performance, production patterns, and migration guides. Use whenever the user mentions Express, Express.js…

pledgeandgrow/pledge-skills · 80 tokens

frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI).…

Rain120/qq-music-api · 77 tokens

medusa-development

Extend the open-source Medusa commerce platform with custom services, event subscribers, and API endpoints for unique business requirements.

finsilabs/awesome-ecommerce-skills · 26 tokens