Token导航 LogoToken导航TokenDH.com
开发执行命令github未标认证来源可访问许可证需确认审计提醒

specmatic-openapi-spec-extractorSpecmatic openapi 规范提取器

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

143

周安装

6

GitHub Stars

公开资料未说明

下载量

50
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:specmatic-openapi-spec-extractor(Specmatic openapi 规范提取器)
来源仓库:https://github.com/specmatic/skills
仓库路径:skills/specmatic-openapi-spec-extractor
安装命令:
npx skills add https://github.com/specmatic/skills --skill specmatic-openapi-spec-extractor
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/specmatic/skills --skill specmatic-openapi-spec-extractor

简介

用于辅助 API 设计、接口文档生成和前后端联调支持。

  • 适合梳理 endpoint、生成 OpenAPI 草稿或检查字段命名规范。
  • 通过 npx skills add 命令从 GitHub 仓库安装后调用。
  • 使用时需确认真实业务语义、鉴权方式及避免凭空补充字段信息。
  • specmatic-openapi-spec-extractor 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

specmatic-openapi-spec-extractor

Extract and refine an OpenAPI specification from an existing API codebase.

Any prompt that implies deriving an OpenAPI or Swagger contract from an existing application or codebase should select this skill, not a generic extraction-only skill.

Required Behavior

If this skill is selected, do all of the following:

  • In the first user-facing progress update, explicitly say you are using specmatic-openapi-spec-extractor.
  • Treat extraction as phase 1, not the final outcome.
  • Use the framework-native extraction tool/path for the detected framework. Do not substitute a manual, hand-authored spec when the framework has a supported extraction path in this skill.
  • If the required extraction tool/integration is missing from the codebase, add the minimum non-behavioral framework-specific integration needed so the framework can generate/export the spec, then extract from that generated output.
  • "Use if available" is not acceptable for supported frameworks. For supported frameworks, the agent must make the extraction path available in the project unless the user explicitly forbids code changes.
  • After extraction succeeds, continue into the mandatory post-extraction workflow below. Do not stop after saving the first generated spec.
  • Always prepare the final runnable contract-test assets for the user once extraction and refinement are complete, even if the live Docker-dependent loop cannot run yet.
  • Prefer source annotations/config first, overlay second, and direct edits to the extracted spec never.
  • Do not change application implementation behavior to improve the spec. Allowed code changes are limited to extraction-related annotations, comments, and non-behavioral config required by the extraction tooling.
  • Do not change method signatures, control flow, returned values, persistence logic, auth behavior, or any other runtime semantics unless the user explicitly asks for implementation changes.
  • When running Specmatic validation, examples checks, stubs, or contract tests, use only the shell/Docker commands documented by this skill. Do not use Specmatic MCP tools or any alternate Specmatic execution path while this skill is active.
  • If a later phase is blocked, explicitly say which phase is blocked and why.
  • Do not silently behave like a generic OpenAPI extraction task. Follow this skill's workflow explicitly.

Default execution order:

announce skill -> identify framework -> open one framework guide -> integrate extraction path if missing -> extract spec -> save spec -> inspect gaps -> refine -> re-extract -> prepare Specmatic setup -> run Specmatic feedback loop -> prepare final runnable deliverables

Use this exact style in the first progress update:

  • Using specmatic-openapi-spec-extractor to extract and refine the OpenAPI spec. I’m first identifying the framework and extraction path, then I’ll continue with post-extraction refinement.

Selection Heuristics

Select this skill by default when the user asks to extract or generate an OpenAPI or Swagger spec from an existing application, even if they do not mention Specmatic, skills, validation, refinement, or overlays.

This skill should win over a generic extraction-only skill when:

  • The request is about "this application", "this project", or "this codebase"
  • The request implies deriving a contract from existing code, routes, handlers, controllers, or an already-built API
  • The request uses adjacent terms like API spec, API schema, Swagger docs, API docs, contract, reverse-engineer, infer, or document endpoints
  • The user wants the spec to be accurate, complete, hardened, or refined
  • The task involves an existing API implementation rather than writing a spec from scratch
  • The framework can generate an initial spec and then benefit from contract-test feedback

Docker Execution Rule

  • Assume Docker is available and the Docker engine is running.
  • Do not ask the user about Docker availability before attempting the documented Specmatic docker pull, docker run, validation, or test commands from this skill.
  • Attempt the Specmatic feedback loop first.
  • If command output indicates a Docker-specific failure such as Docker not being installed, Docker not being on PATH, Docker Desktop not being available, or the Docker daemon / engine not running, stop and ask the user exactly: Please confirm if docker engine is running
  • Do not claim the Specmatic feedback loop is blocked on Docker until after a Docker command fails for a Docker-specific reason.

Mandatory Post-Extraction Workflow

Once the first spec has been extracted, the agent must execute these phases in order:

  1. If the framework-native extraction path is not already wired into the project, integrate it first using minimal non-behavioral code/config changes for that framework.
  2. Extract the spec using the framework-native generator/export path, not by manually writing openapi.yaml.
  3. Save the extracted spec to the repo.
  4. Inspect the generated spec for obvious gaps such as wrong status codes, generic */* content types, missing security, weak request/response schemas, and missing error responses.
  5. Refine generation using source annotations/config first. Use overlay only when source-level fixes cannot express the required contract. Allowed refinements: annotations, decorators, doc comments, extraction-tool config, and overlay updates. Disallowed refinements without explicit user approval: implementation changes, behavioral changes, signature changes, data model changes made only to shape the contract, or business-logic edits.
  6. Re-extract the spec after each meaningful refinement.
  7. Attempt the Specmatic feedback loop using the documented docker pull, docker run, validation, and test commands from this skill.
  8. If a Docker command fails for a Docker-specific reason, stop and ask the user exactly: Please confirm if docker engine is running
  9. Prepare the final deliverables from this skill, including run_contract_tests.sh and CONTRACT_TESTS_README.md, regardless of whether deterministic data setup is needed.
  10. If Docker is unavailable, stop only after clearly reporting that extraction and refinement are done, the runnable script and README have been prepared, and the next blocked step is the live Specmatic loop.

Do not treat annotation-only cleanup as the full post-extraction workflow. Do not end the task after exporting openapi.yaml unless the user explicitly asks for extraction only. Do not claim the spec was "extracted" if the file was primarily authored by hand outside the framework generator/export path.

When to Use

  • User has an existing API application, service, or repository and wants to generate an OpenAPI or Swagger specification from it
  • User asks to generate or extract an OpenAPI specification for "this application", "this project", "this service", or "this codebase"
  • User asks to derive, infer, reverse-engineer, document, or generate API docs/schema/contract from existing code or routes
  • User asks for Swagger docs, OpenAPI docs, API schema, or API contract for an existing implementation
  • User asks to create API schema, API docs, or Swagger docs from routes, controllers, annotations, or source code
  • User mentions a specific framework covered below

Inputs

InputRequiredDescription
FrameworkYesThe API framework in use
Project pathYesRoot directory of the API project
Output pathNoWhere to write the spec (default: openapi.yaml)

Outputs

OutputDescription
OpenAPI specExtracted JSON or YAML contract
Refined source metadataAnnotation/config updates used to improve regenerated output
Contract test runnerRunnable run_contract_tests.sh for the full suite, with optional setup hook
Contract test READMECONTRACT_TESTS_README.md describing how to run the generated script

Prerequisites

  • The API project must be buildable and its dependencies installed
  • For runtime extraction, the app must be importable or startable

Decision Framework

Framework rule:

  • For every framework listed below, use the listed extraction method as the required path.
  • If the repo does not yet have the needed package, plugin, annotations, endpoint, config, or export script, add the minimum non-behavioral integration required to enable that extraction method, then run it.
  • Only fall back to non-framework-specific/manual derivation when the framework is not covered by this skill or the user explicitly forbids the required integration changes.
FrameworkMethodOpen this guide
FastAPIBuilt-in exportcontent/frameworks/fastapi.md
FlaskCLI/programmatic exportcontent/frameworks/flask.md
Django REST Frameworkdrf-spectacular CLIcontent/frameworks/django.md
Spring BootRuntime docs endpointcontent/frameworks/spring-boot.md
ASP.NET CoreRuntime docs endpointcontent/frameworks/aspnet.md
Expressswagger-jsdoccontent/frameworks/express.md
NestJSRuntime docs endpoint or scriptcontent/frameworks/nestjs.md
HonoProgrammatic exportcontent/frameworks/hono.md
Railsrswag taskcontent/frameworks/rails.md
Laravell5-swagger commandcontent/frameworks/laravel.md

Reference Routing

Use the smallest amount of reference material needed.

Do not bulk-read all reference files. Identify the framework first, then open only the file needed for the current phase.

Specmatic References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.01%
按下载量换算18

Claude

29.97%
按下载量换算15

Cursor

18.39%
按下载量换算9

Gemini CLI

9.41%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/specmatic/skills --skill specmatic-openapi-spec-extractor 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills