docs-openapi
Write or update OpenAPI documentation in split-per-feature format under `docs/openapi`. Use when endpoints, request/response schemas, or API contracts change.
- License 许可
- MIT
- 最近更新
- 2026-08-18
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- docs-openapi
- description
- Write or update OpenAPI documentation in split-per-feature format under `docs/openapi`. Use when endpoints, request/response schemas, or API contracts change.
02 资源文件 3
- 参考文档agents/openai.yaml281 B
- 参考文档references/context.md1.9 KB
- 参考文档templates/checklist.md1.0 KB
03 SKILL.md 正文
Skill: Docs OpenAPI
Context (Required)
- Output folder:
docs/openapi/ - Entry file:
docs/openapi/openapi.yaml - Per-feature split:
docs/openapi/paths/{feature-slug}.yaml
Use this skill to translate API contracts into consistent, reusable, tool-parseable OpenAPI specs.
Workflow
- Read the API contract or finalized endpoints to document.
- Determine whether the required shared schemas and responses already exist in
components/. - Write or update
paths/{feature}.yamlfor the feature's endpoints. - Add the required
$refentries inopenapi.yaml. - Validate that every
$refpoints to an existing file and key.
File Structure
docs/openapi/
├── openapi.yaml ← entry, $ref to paths + components
├── paths/
│ ├── payment-methods.yaml
│ └── users.yaml
└── components/
├── schemas/
│ ├── PaymentMethod.yaml
│ └── PaginationMeta.yaml
└── responses/
├── NotFound.yaml
└── Validation.yaml
openapi.yaml Format (Entry)
openapi: "3.0.3"
info:
title: API
version: "1.0.0"
paths:
/payment-methods:
$ref: "./paths/payment-methods.yaml#/PaymentMethodsList"
/payment-methods/{id}:
$ref: "./paths/payment-methods.yaml#/PaymentMethodsById"
components:
schemas:
PaymentMethod:
$ref: "./components/schemas/PaymentMethod.yaml"
PaginationMeta:
$ref: "./components/schemas/PaginationMeta.yaml"
responses:
NotFound:
$ref: "./components/responses/NotFound.yaml"
paths/{feature}.yaml Format
PaymentMethodsList:
get:
summary: List payment methods
tags: [PaymentMethods]
parameters:
- name: page
in: query
schema:
type: integer
default: 1
- name: perPage
in: query
schema:
type: integer
default: 10
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
list:
type: array
items:
$ref: "../components/schemas/PaymentMethod.yaml"
meta:
$ref: "../components/schemas/PaginationMeta.yaml"
"401":
$ref: "../components/responses/Unauthorized.yaml"
post:
summary: Create payment method
tags: [PaymentMethods]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, code]
properties:
name:
type: string
code:
type: string
isActive:
type: boolean
default: true
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
data:
$ref: "../components/schemas/PaymentMethod.yaml"
"409":
$ref: "../components/responses/Conflict.yaml"
"422":
$ref: "../components/responses/Validation.yaml"
Rules
- Use OpenAPI 3.0.3
- Split per feature — never dump all endpoints into one file
$reffor any schema or response used more than once- Tag = feature name (PascalCase)
- Every error response uses the shared
components/responses/
Prohibitions
- NEVER duplicate schemas that can be referenced from
components/. - NEVER place all repo endpoints in a single path file.
- NEVER leave a response body without an explicit schema.
- NEVER leave broken
$refentries or invalid placeholders.
Pre-Completion Checklist
- [ ]
paths/{feature}.yamlcovers every endpoint of the feature - [ ]
openapi.yamlreferences the new path - [ ] Shared schemas and responses are reused via
$ref - [ ] No placeholders or broken
$refentries - [ ] Spec parses with standard OpenAPI tooling
- [ ] Every file ends with a newline (EOF)
04 同仓库更多 Skills
web-slicing
Convert screenshot/Figma designs into pixel-perfect frontend UI with reusable components. Use when the task focuses on visual and layout implementation.
web-seo-geo-friendly
Optimize public Next.js App Router pages for SEO and GEO (Generative Engine Optimization). Use when the user explicitly requests SEO/GEO optimization on public pages.
web-code-review
Review frontend code with a firm senior-lead standard, focusing on bugs, regressions, architecture risks, and test gaps in apps/web and the shared contracts the frontend depends on.
web-bugfix
Fix frontend bugs with minimum-touch changes, keep other surfaces stable, and sync schema, types, hooks, constants, tests, and related docs when impacted.
web-api-integrated
Integrate API endpoints into the frontend with Zod schemas, response types, constants, and react-query hooks. Use when implementing endpoints from an API contract, Postman, or Swagger.
skill-creator
Create a new skill from scratch with full structure — SKILL.md, references, templates, openai.yaml, Claude wrapper, and registration in manifest + AGENTS.md + CLAUDE.md.