cli-generator
Generate a complete, production-ready CLI in Bun from a SPEC (OpenAPI, JSON Schema, markdown contract, or natural-language description). Outputs a runnable…
от Andersonlimahw★ 19 звёзд на GitHub
Установить cli-generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
CLI Generator
SPEC → Bun CLI. Production-ready. Autocomplete, --help, token-aware output.
Quick Start
/cli-generator from-spec <spec-file> — OpenAPI / JSON Schema → CLI
/cli-generator from-api <url> — live API → CLI (probe endpoints)
/cli-generator from-description "<text>" — natural language → CLI
/cli-generator validate <cli-dir> — check generated CLI against spec
Input Sources
| Source | Example | Best for |
|---|---|---|
| OpenAPI 3.x | openapi.yaml, swagger.json |
REST APIs |
| JSON Schema | schema.json |
Data tools, validators |
| GraphQL SDL | schema.graphql |
GraphQL APIs |
| Markdown spec | SPEC.md |
Feature-driven design |
| NL description | "CLI to manage user accounts with CRUD" |
Rapid prototyping |
| Live API URL | https://api.example.com |
Reverse-engineering |
Output — What You Get
my-cli/
├── package.json # bin entry, dependencies
├── tsconfig.json # Bun-optimized TS config
├── src/
│ ├── index.ts # entry point, commander setup
│ ├── commands/ # one file per subcommand
│ │ ├── list.ts
│ │ ├── get.ts
│ │ ├── create.ts
│ │ ├── update.ts
│ │ └── delete.ts
│ ├── lib/
│ │ ├── client.ts # typed API client (generated)
│ │ ├── format.ts # output formatters (json, table, yaml)
│ │ └── config.ts # env vars, config file handling
│ └── types.ts # generated from spec
├── completions/
│ ├── bash.sh
│ ├── zsh.sh
│ └── fish.sh
├── man/
│ └── my-cli.1 # man page
├── test/
│ └── commands.test.ts # bun test suite
├── README.md # usage docs
└── Makefile # build, install, test
Workflow — Spec to CLI
Claude will:
Phase 1: Parse
- Read the input (OpenAPI, JSON Schema, markdown, or NL)
- Extract: commands, subcommands, flags, args, types
- Infer missing details (descriptions, defaults, validation rules)
- Confirm the command tree with user before generating
Phase 2: Generate
- Scaffold project structure with
package.json+tsconfig.json - Generate typed API client from spec (if OpenAPI/GraphQL)
- Generate one file per subcommand with commander/args
- Wire up autocomplete (bash/zsh/fish)
- Generate man page
- Generate test suite with
bun test
Phase 3: Verify
bun run src/index.ts --help— validates CLI bootsbun test— all generated tests passbun run build— compiles without errors- Output: ready to
npm install -gorbun link
Generated Code Example
Input — OpenAPI snippet:
paths:
/users:
get:
operationId: listUsers
summary: List all users
parameters:
- name: role
in: query
schema:
type: string
enum: [admin, user, guest]
- name: limit
in: query
schema:
type: integer
default: 20
- name: offset
in: query
schema:
type: integer
default: 0
post:
operationId: createUser
summary: Create a new user
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, email]
properties:
name:
type: string
email:
type: string
format: email
role:
type: string
enum: [admin, user, guest]
default: user
/users/{id}:
get:
operationId: getUser
summary: Get user by ID
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
Output — src/commands/list.ts:
import { Command } from 'commander'
import { client } from '../lib/client'
import { formatOutput } from '../lib/format'
import type { User } from '../types'
export const listUsersCommand = new Command('list')
.description('List all users')
.option('--role <role>', 'Filter by role (admin, user, guest)')
.option('--limit <number>', 'Max results', '20')
.option('--offset <number>', 'Pagination offset', '0')
.action(async (opts) => {
const { data, error } = await client.GET('/users', {
params: {
query: {
role: opts.role,
limit: Number(opts.limit),
offset: Number(opts.offset),
},
},
})
if (error) {
console.error(`Error: ${error.message}`)
process.exit(1)
}
formatOutput<User[]>(data, {
columns: ['id', 'name', 'email', 'role'],
format: opts.format ?? 'table',
})
})
Bundled Runtime — Token-Aware Output
Every generated CLI includes src/lib/format.ts with three modes:
| Flag | Mode | Use case |
|---|---|---|
--format json |
Structured | Piped to jq, scri |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- plugin.json
FAQ
Что делает скилл cli-generator?
Generate a complete, production-ready CLI in Bun from a SPEC (OpenAPI, JSON Schema, markdown contract, or natural-language description). Outputs a runnable binary with commander-style arg parsing, shell autocomplete, --help generation, man page, and token-aware output formatting. Use when you need to turn an API spec or feature description into a working CLI in minutes.
Как установить скилл cli-generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cli-generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…