首页/AI 工程/openapi-specification-v2
O

openapi-specification-v2

by @hairyfv1.0.0
3.7(0)

遵循OpenAPI (Swagger) 2.0规范,用于描述和文档化RESTful API,便于AI工程中的接口集成与协作。

OpenAPI Spec (Swagger)REST APIsAPI DesignAPI DocumentationJSON SchemaGitHub
安装方式
npx skills add hairyf/skills --skill openapi-specification-v2
compare_arrows

Before / After 效果对比

1
使用前

传统上,REST API的文档编写和维护常常是独立于代码的,导致文档与实际API不一致,开发人员在理解和使用API时面临挑战。手动更新文档耗时且易错,团队协作效率低下。

使用后

采用OpenAPI 2.0规范后,API文档与代码实现紧密结合,实现了文档的自动化生成和实时更新。这不仅确保了文档的准确性,还极大地简化了前后端开发人员之间的沟通与协作,加速了开发周期。

description SKILL.md


name: openapi-specification-v2 description: OpenAPI (Swagger) 2.0 specification for describing REST APIs. Use when writing, validating, or interpreting Swagger 2.0 specs, generating clients/docs, or working with path/operation/parameter/response/schema/security definitions. metadata: author: hairy version: "2026.1.30" source: Generated from https://github.com/OAI/OpenAPI-Specification, scripts located at https://github.com/antfu/skills

OpenAPI Specification 2.0 (formerly Swagger 2.0) defines a JSON/YAML format for describing RESTful APIs: paths, operations, parameters, responses, schemas, and security. Use this skill when creating or editing Swagger 2.0 specs, validating structure, or generating code/documentation from them.

The skill is based on OpenAPI Specification 2.0, generated at 2026-01-30.

Core References

TopicDescriptionReference
Format and StructureDocument format, file structure, data typescore-format-and-structure
Fixed and Patterned FieldsFixed vs patterned field names in the schemacore-fixed-patterned-fields
Swagger ObjectRoot document, required/optional fields, extensionscore-swagger-object
Info and MetadataInfo, Contact, License objectscore-info-metadata
Tags and External DocsTag Object, External Documentation Objectcore-tags-and-external-docs
Reference Object$ref, JSON Pointer, same-document and external file referencescore-reference-object
Data Types and FormatsPrimitives, format table, validation, file typecore-data-types-and-formats
MIME Typesconsumes/produces, RFC 6838, examplescore-mime-types
HTTP Status CodesResponse keys, default response, IANA/RFC 7231core-http-status-codes
Path TemplatingCurly braces, path parameters, name matchingcore-path-templating
Header ObjectResponse header definition (type, format, items, validation)core-header-object
Headers ObjectContainer for response headers (name → Header Object)core-headers-object
Items ObjectNon-body array items (parameters, headers)core-items-object
Example ObjectResponse examples by MIME typecore-example-object

Paths and Operations

TopicDescriptionReference
Paths and OperationsPaths Object, Path Item, Operation Objectpaths-and-operations
Path Item $refExternal path definition, conflict behaviorpath-item-ref

Parameters and Responses

TopicDescriptionReference
ParametersParameter locations (path, query, header, body, formData)parameters
collectionFormatcsv, ssv, tsv, pipes, multi and where they applyparameters-collection-format
Parameters Definitions (Reuse)Root-level parameters, reuse via $refparameters-definitions-reuse
ResponsesResponses Object, Response Objectresponses
Responses Definitions (Reuse)Root-level responses, reuse via $refresponses-definitions-reuse

Schemas and Definitions

TopicDescriptionReference
Schema and DefinitionsSchema Object, Definitions, composition, polymorphismschema-and-definitions
Schema JSON Schema KeywordsJSON Schema Draft 4 subset and Swagger-specific fieldsschema-json-schema-keywords

Security

TopicDescriptionReference
SecuritySecurity Definitions, Security Schemesecurity
Security Requirement ObjectApplying security at root/operation, OR/AND logicsecurity-requirement-object
Scopes ObjectOAuth2 scope name → descriptionsecurity-scopes-object
Basic and API Keybasic and apiKey Security Schemesecurity-basic-apikey
OAuth2 Flowsimplicit, password, application, accessCode and required URLssecurity-oauth2-flows

Best Practices

TopicDescriptionReference
Spec AuthoringoperationId, tags, responses, parameters, definitions, securitybest-practices-spec-authoring

Advanced

TopicDescriptionReference
Vendor Extensionsx- prefix, value types, where allowedadvanced-vendor-extensions
Security FilteringEmpty Paths, empty Path Item for access controladvanced-security-filtering
Extensions and XMLXML Object for schema propertiesadvanced-extensions-and-xml

forum用户评价 (0)

发表评价

效果
易用性
文档
兼容性

暂无评价,来写第一条吧

统计数据

安装量326
评分3.7 / 5.0
版本1.0.0
更新日期2026年3月16日
对比案例1 组

用户评分

3.7(0)
5
0%
4
0%
3
0%
2
0%
1
0%

为此 Skill 评分

0.0

兼容平台

🔧Claude Code
🔧OpenClaw
🔧OpenCode
🔧Codex
🔧Gemini CLI
🔧GitHub Copilot
🔧Amp
🔧Kimi CLI

时间线

创建2026年3月16日
最后更新2026年3月16日