yapi-cli-skill
Overview
Use the yapi CLI only — no separate skill binary, no Python wrapper. MCP tools (yapi_search, yapi_get, …) call the same TypeScript core as these commands. Run from a working directory where yapi.config.json can be resolved (walks upward from cwd).
CLI entry: yapi … if on PATH, otherwise node /path/to/yapi-cli/dist/cli/index.js ….
Quick Start
From the workspace root that contains yapi.config.json:
- Search:
yapi search login --json(ornode dist/cli/index.js search login --json) - Interface detail:
yapi get /user/login -p 1437 --json(add--fullfor raw schemas) - TypeScript:
yapi types /user/login -p 1437 --name Login --json - Mock:
yapi mock /user/login -p 1437 --json - List by category:
yapi list -p 1437 --json
If yapi is not on PATH but this skill bundle is available locally, use:
node /path/to/yapi-cli/dist/cli/index.js search login --json
After npm run build, the same instructions apply using dist/cli/index.js inside the yapi-cli package.
Workflow
yapi search <keyword> --jsonto locate candidates.yapi get <idOrPath> -p <projectId> --jsonfor one interface.yapi types … --jsonoryapi mock … --jsononly when needed.- Summarize outputs; avoid pasting huge JSON verbatim.
Command Choice
search --json— match list (title, path, method, project, category, …).get— method, path, query, body, response fields (--fullfor raw schemas).types --json— JSON envelope with generatedcodestring.mock --json— JSON envelope withmockpayload.list --json— category tree for an overview.
Working Rules
- Prefer
projectIdover project name; config is keyed byprojectId. - Prefer
yapi/node …/dist/cli/index.jsso behavior matches MCP. - Treat
yapi.config.jsonas the source of truth for host and tokens (activeProjectIdswhitelist). - If multiple actives, single-project commands need
-p.
Layout
- Source skill docs:
skills/yapi-cli-skill/(SKILL.md,references/). - After build:
skills/yapi-cli-skill/is packaged asdist/yapi-skills.zip.
Installation
- Install the CLI so
yapiis on PATH. - Run
npm run buildin yapi-cli. - Install the skill by extracting
dist/yapi-skills.zipinto an agent skills directory such as.agents/skills/yapi-cli-skill, or runnpm run install:skillsfrom the yapi-cli repo root. - Enable Agent Skills in your client.
- In a terminal whose cwd resolves to
yapi.config.json, runyapi search test --json. - In agent chat, ask to use
yapi search --json/yapi get --jsonagainst your config.
References
references/workflow.md— decision flow.references/config.md—yapi.config.jsonshape.yapi --helpandyapi <command> --helpfor flags.