parse-api-doc

Parse ERP/third-party API docs: extract field names, types, required flags, and descriptions from Markdown tables, JSON Schema, example JSON, or plain text field lists; infer API endpoints and request/response structures automatically and produce field mappings. Trigger phrases include “parse API docs,” “extract API fields,” and “docs to field mapping.”

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "parse-api-doc" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-6b072985c32a4a46e487b601d4738ddb9d64b548d951d49185af3c39b81fb856. Verify the upstream source and version against https://skillhub.cn/skills/user_3ff3c268/parse-api-doc before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Parse ERP/third-party API docs: extract field names, types, required flags, and descriptions from Markdown tables, JSON Schema, example JSON, or plain text field lists; infer API endpoints and request/response structures automatically and produce field mappings. Trigger phrases include “parse API docs,” “extract API fields,” and “docs to field mapping.”

0 Downloads

Introduction source: third_party · user_3ff3c268 · 1.2.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Limits and differences
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter


name: parse-api-doc
description: 解析 ERP/第三方接口文档(Markdown 表格 / JSON Schema / 示例 JSON / 纯文本字段列表),提取字段名、类型、必填、说明,并自动推断接口端点与请求/响应结构,生成字段映射。触发词:解析接口文档、提取 API 字段、文档转字段映射、对接第三方接口、ERP 字段解析、接口文档结构化。
market_desc: 解析 API 文档(Markdown 表格/JSON Schema/示例 JSON/纯文本字段列表),提取字段名、类型、必填、说明,自动推断端点与请求/响应结构,生成字段映射。适合对接第三方接口、低代码搭建,省去手抄字段。 【闭环归属】本技能是「API/数据接入管线闭环」的第 1 步(共 5 步:解析→对齐→合并→换算→导出)。要可交付的数据资产,配齐这 5 个技能即可;总控入口:api-data-pipeline。
version: 1.2.0
display_name: 接口文档转字段映射(ERP/OpenAPI 一键结构化)
changelog: 升级 v1.2.0:中性化署名、场景拓宽、补充闭环归属交叉引用。

parse-api-doc —— 接口文档字段智能解析

把任意格式的接口/字段文档,解析成结构化字段清单 + 字段映射,用于对接第三方系统。 纯函数实现(Node ESM,零依赖),可直接 import 使用,也可作为 AI 抽取字段映射的参考实现。

适用场景

  • 拿到一份 ERP / 开放平台 / 内部中台的接口说明,要快速知道「有哪些字段、什么类型、哪些必填」
  • 要把对方文档字段映射到自己的采集/存储字段(字段名不一致时的别名模糊匹配)
  • 从 Markdown 表格、JSON Schema、示例 JSON、纯文本字段列表里批量提取字段

支持的输入格式(自动探测)

  1. Markdown 表格:| 字段 | 类型 | 必填 | 说明 |
  2. JSON Schema:含 "properties" + "type"
  3. 示例 JSON:{ "asin": "B0XXX", "title": "标题" }
  4. 纯文本字段列表:asin: 商品ID / title (string) 商品标题

用法

import { parseErpDocument, matchField, loadVocabulary } from './scripts/doc-parser.mjs';

const doc = `
| 字段 | 类型 | 必填 | 说明 |
|------|------|------|------|
| asin | string | 是 | 商品ID |
| title | string | 否 | 商品标题 |
`;

const result = parseErpDocument(doc);
console.log(result.detectedFormat);   // markdown_table
console.log(result.productFields);    // [{name,type,required,description}]
console.log(result.fieldMappings);    // [{erpField,erpType,erpRequired,erpDescription,collectorField}]
console.log(result.endpoint);         // 自动推断的 方法+路径

核心 API

  • parseErpDocument(content, options?) → DocParseResult
    • options.vocabulary:自定义字段词汇表(默认内置一组常见电商/API 字段,可注入你自己的)
    • 返回:{ success, detectedFormat, productFields[], endpoint, requestStructure, responseStructure, fieldMappings[], error? }
  • matchField(name, vocabulary?) → 命中的标准字段 key(模糊/别名匹配,归一化大小写与 _-)
  • loadVocabulary(text) → 从文本构建词汇表(便于按需扩展)

字段映射词汇表(可注入)

默认词汇表覆盖常见字段(asin/title/price/rating/bsr/image/brand...)。对接自家系统时,传入你自己的词汇表即可:

const myVocab = [
  { key: 'sku', aliases: ['sku', '货号', '商品编码'] },
  { key: 'stock', aliases: ['stock', '库存', 'quantity'] },
];
parseErpDocument(doc, { vocabulary: myVocab });

注意

  • 解析失败时 success=false 且带 error.code(EMPTY_CONTENT / PARSE_ERROR / NO_FIELDS_FOUND),error.suggestion 给出针对性修改建议。
  • 这是结构抽取工具,不调用网络、不发送任何数据,纯本地解析。

Current listing version

1.2.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value92/100

Highlights

  • 解决ERP/第三方接口对接的字段解析刚需痛点
  • 支持Markdown表格/JSON Schema/示例JSON/纯文本多种格式
  • 闭环归属明确,是API数据接入管线的第一步
Trigger Precision95/100

Highlights

  • 触发词覆盖全面(解析接口文档、提取API字段等6种变体)
  • 边界清晰,不易误触或漏触
Structure and Standards90/100

Highlights

  • 结构清晰:场景→格式→用法→API→词汇表→注意事项
  • 提供完整端到端JS代码示例
  • frontmatter信息完整
Execution Reliability90/100

Highlights

  • 工具来源明确(Node ESM,零依赖)
  • 覆盖主要异常并提供针对性建议
  • 纯本地解析,无网络调用风险
Evidence Verifiability (mean of the first four)92/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.