yapi-skill
Python stdlib scripts for the YApi OpenAPI (no Java/Docker/MCP) — search interfaces, query details, and sync/upsert one interface's docs from a YApi-native payload (often converted from OpenAPI). Read-modify-write with dry-run preview; creates/updates only — never deletes, preserves manual edits; no source-code parsing or full re-import.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 490
01 前言 Front Matter
- name
- yapi-skill
- description
- Python stdlib scripts for the YApi OpenAPI (no Java/Docker/MCP) — search interfaces, query details, and sync/upsert one interface's docs from a YApi-native payload (often converted from OpenAPI). Read-modify-write with dry-run preview; creates/updates only — never deletes, preserves manual edits; no source-code parsing or full re-import.
02 资源文件 7
- 参考文档references/initialization.md5.9 KB
- 脚本scripts/common.py33.5 KB
- 脚本scripts/getInterfaceDetail.py2.4 KB
- 脚本scripts/init_config.py7.6 KB
- 脚本scripts/openapiToYapiPayload.py8.0 KB
- 脚本scripts/searchInterfaces.py1.9 KB
- 脚本scripts/upsertInterface.py11.4 KB
03 SKILL.md 正文
Yapi Search and Query Skill
Overview
You can directly use Python scripts to call the Yapi API, search for Yapi interfaces to locate the interfaceId, or get detailed information of a specific interface (request parameters, response body, description in Markdown). Prefer using this skill instead of starting the yapi-mcp-server (Java/Docker).
Beyond reading, this skill can also write: sync (upsert) a single interface's docs into YApi from a YApi-native payload — typically converted from an OpenAPI contract. Writing is read-modify-write (only managed fields are overwritten; existing writable fields are re-sent to best-preserve un-managed content like mock / test cases / status — verified end-to-end: up is merge semantics, fields not sent are preserved), dry-run by default (a preview artifact is written to a file; only a compact summary is printed), and never deletes (YApi's OpenAPI has no delete endpoint).
Core principle: Configure environment -> choose search / query / sync as needed -> for sync, convert to a payload, dry-run to preview, then apply.
Announce at start: "I am using the yapi-skill to search/query or sync Yapi interface details."
Prerequisites
This skill depends on a local configuration file (base_url + projectId -> token).
If you haven't initialized it, don't know how to get the token, or need to switch between multiple environments, please read first:
skills/yapi-skill/references/initialization.md
Configuration paths support the following override methods:
- Environment variable:
YAPI_SKILL_CONFIG=/path/to/config.json - Single command execution:
--config /path/to/config.json(takes effect forsearchInterfaces.py/getInterfaceDetail.py)
For Windows users, if the
python3command is not available, try usingpy -3orpython.
Workflow
Step 1: Decide the Target (Search or Query Details)
Determine whether you need to first find a specific interface (using the search function) or if you already have the specific interface ID or URL to query the detailed information.
Step 2: Execute the Query
Scenario A: Get Interface Details Directly (Recommended)
Use this when you already know the specific interface URL or the projectId and interfaceId.
python3 skills/yapi-skill/scripts/getInterfaceDetail.py \
--url 'http://yapi.example.com/project/1650/interface/api/414469' \
--format markdown
Description:
--urlsupports directly pasting the interface page URL (the script will automatically parseprojectId/interfaceId).--formatsupportsjson(for secondary processing) andmarkdown(for readability).- It also supports
--projectId+--interfaceId(when you already have the IDs).
Security warning: The Markdown output may contain example request headers/example values from the interface definition (e.g.,
Authorizationexample). Please sanitize it yourself before sharing it externally.
Scenario B: Search for Interfaces (Locate interfaceId)
Use this when you only know the interface keyword or path.
python3 skills/yapi-skill/scripts/searchInterfaces.py --keyword login --format markdown
Common parameters:
- By default, it searches all projects in the
project_tokensof the configuration file. (Use--projectNameto narrow the scope). --projectName: Fuzzy filter by project name (Optional).--keyword: Fuzzy search by interface title (Optional).--path: Fuzzy search by interface path (Optional).--format json|markdown: Defaults tojson.--config <path>: Specify the configuration file path (Overrides default path, Optional).
Write / Sync Workflow
Use this to push an interface's docs into YApi from a contract (e.g. OpenAPI). The scripts are source-agnostic primitives; deciding which interfaces to sync is your job.
Safety rules (always):
- Only touch interfaces you explicitly target — one interface per
upsertInterface.pycall. Never enumerate-and-sync a whole spec blindly. - Dry-run first (the default). Read the field-level diff from the preview artifact, show it to the user, get confirmation, then re-run with
--apply. - Creates/updates only — YApi's OpenAPI cannot delete.
upis read-modify-write and re-sends existing writable fields to best-preserve un-managed content (mock, test cases, status — verified end-to-end:upmerges, so fields not sent are preserved); remove stale interfaces manually in the YApi UI.
Step 1: Build a YApi-native payload
If the source is OpenAPI, convert one operation to a payload file (large schemas stay in files, off your context):
python3 skills/yapi-skill/scripts/openapiToYapiPayload.py \
--spec /path/to/preview-merged.json --path /admin/ad/campaign/create --method post \
--out .yapi-sync/payload-create.json
- JSON spec only; use a dereferenced/"merged" doc (no remaining
$ref/allOf). - It prints the operation's
tag— pass it as--categoryin Step 2/3. - For non-OpenAPI sources, hand-write the payload JSON with YApi-native fields:
title,path,method,req_query,req_headers,req_params,req_body_other,res_body,markdown.
Step 2: Dry-run (preview, no write)
python3 skills/yapi-skill/scripts/upsertInterface.py \
--projectId 1650 --payload .yapi-sync/payload-create.json --category '广告投放计划'
- Probes YApi by
path+method: 1 match → update, 0 → create, multiple → stops and asks for an explicit--interfaceId. - Writes a preview artifact (full final payload + field-level diff) and prints a compact summary. Open the artifact to review what markdown/schema will be overwritten.
Step 3: Apply (after confirmation)
python3 skills/yapi-skill/scripts/upsertInterface.py \
--projectId 1650 --payload .yapi-sync/payload-create.json --category '广告投放计划' --apply
- Update keeps the interface's existing category (no moving). Create places it under
--category(auto-created if missing).
Quick Reference
| Purpose | Command | Key Parameters |
|---|---|---|
| Get Details | python3 scripts/getInterfaceDetail.py |
--url or --projectId/--interfaceId |
| Search Interfaces | python3 scripts/searchInterfaces.py |
--keyword, --path, --projectName |
| Convert OpenAPI→payload | python3 scripts/openapiToYapiPayload.py |
--spec, --path, --method, --out |
| Sync (upsert) interface | python3 scripts/upsertInterface.py |
--projectId, --payload, --category, --apply |
Common Mistakes
Incomplete initialization configuration
- Problem: Missing token or environment info causes request failure.
- Fix: Read
skills/yapi-skill/references/initialization.mdfirst to complete configuration.
Sharing unsanitized Markdown
- Problem: Leaking sensitive example data (e.g., real Tokens or passwords).
- Fix: Manually remove sensitive content from Markdown before sharing.
Syncing interfaces you didn't intend to
- Problem: Pushing every path in a big merged spec overwrites unrelated interfaces (and their manual edits).
- Fix: Target only explicitly-decided interfaces, one upsert call each; review the dry-run diff before
--apply.
Expecting delete or full re-import
- Problem: YApi's OpenAPI token cannot delete, and a full re-import clobbers manual edits.
- Fix: This skill only creates/updates per-interface via read-modify-write; delete stale interfaces manually in the YApi UI.
Example
# Search for interfaces
python3 skills/yapi-skill/scripts/searchInterfaces.py --keyword submit_order --format markdown
# Get interface details
python3 skills/yapi-skill/scripts/getInterfaceDetail.py --url 'http://yapi.example.com/project/123/interface/api/456' --format markdown
04 同仓库更多 Skills
migrate-to-e2e
Moves an existing Playwright, Cypress, Selenium, Appium, Detox, Maestro, or TesterArmy suite to e2e one slice at a time, with the old suite running beside the new one until each ported test is proven. Keeps a MIGRATION.md progress file so any later session resumes where the last stopped. Optionally plants a defect to show both suites catch it. Use for /migrate-to-e2e, "migrate our tests to e2e", "port these Maestro flows", "move our TesterArmy tests", or when a project has an e2e config and an older suite still running.
e2e
Writes, runs, and debugs end-to-end tests for web and mobile apps with e2e, the agentic test runner, which mixes agent.act goals with exact locator assertions on a Playwright browser or an iOS or Android device. Also drives a project's running app live over the e2e MCP server to look at a screen, check a UI change, take a screenshot or record a video, and try a locator; and runs bug bashes, parallel e2e explore runs with each bug proven by a repro test. Use when a project depends on e2e or has an e2e.config.ts, when asked for end-to-end, browser, mobile, or agentic UI tests, to check a change in the running app, to QA or bug bash an app or branch, or when an e2e run fails.
create-verification-skill
Generate a project-local verify-<app> skill on top of e2e, so any coding agent can launch the app, check it is worth driving, exercise a feature the way a user does, keep evidence, and bug bash it. Writes the skill, a feature map with one explore charter per feature, and proves it once. Use for /create-verification-skill, "make a verification skill for this repo", or when a project has no scripted way to prove UI behavior.
deja-search
deja-vu memory — search the user's past AI coding sessions with the deja CLI. Holds what they already settled and never wrote into the repo (naming rules, banned or already-tried tools, required checks before merge, preferred values, who owns what). Use before your first edit in a task, before you call a change done or ready to merge, before you recommend a tool, library, design or reviewer, before re-debugging an error that may already be solved, when they say 'didn't we fix this before', 'what did we decide about X' or 'I already have that', and before telling them something on this machine does not exist.
deja-reflect
End-of-session reflection and memory curation with deja-vu. Review what was decided, what commands broke and what repaired them, and record durable project rules or decisions with deja remember so the next session starts with them.
revid
Make, edit, export and post AI videos with Revid (revid.ai) through the Revid MCP server. Use whenever the user wants a short-form or long-form video made (from an idea, a script, a URL, an article, a PDF, a tweet, a product page, their own clips, or a song), wants to find what is going viral on TikTok, YouTube, Instagram or X before making something, wants to edit or re-export an existing Revid project, generate a standalone AI image or clip, make a series episode, or publish and schedule a finished video to connected social accounts. Covers setup (hosted MCP with OAuth, or an API key), the 36 tools, credits, polling and the rules for publishing. Routes to the more specific revid-* skills when one fits.