OpenAPI specification expert for creating, improving, and validating clear, self-documenting API specs. Use when designing, reviewing, or refactoring OpenAPI/Swagger specs for clarity, consistency, and usability.
インストール
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
OpenAPI specification expert for creating, improving, and validating clear, self-documenting API specs. Use when designing, reviewing, or refactoring OpenAPI/Swagger specs for clarity, consistency, and usability.
OpenAPI Specialist Skill
This skill provides expert guidance for creating, improving, and maintaining high-quality OpenAPI specifications that are self-documenting and easy to consume.
Tool
Use make oas-lint to validate your changes at the end.
When to Use This Skill
Use this skill when:
Creating new API specs from scratch or from existing endpoints
Reviewing and improving existing OpenAPI specifications
Refactoring specs for clarity and consistency
Validating specs against best practices
Generating API documentation from specs
Ensuring API contracts between frontend and backend
The spec should be understandable without external documentation:
Clear descriptions for every endpoint, parameter, and field
Meaningful examples that demonstrate real-world usage
Explanatory titles and summaries
# ✅ GOOD - Self-documenting/workflows/{id}:get:summary:Retrieveaspecificworkflowdescription:|
Fetches a workflow by ID along with all its associated metadata.
Requires read access to the workflow's workspace.
operationId:getWorkflowparameters:-name:idin:pathrequired:truedescription:TheUUIDoftheworkflowtoretrieveschema:type:stringformat:uuidresponses:'200':description:Workflowretrievedsuccessfullycontent:application/json:schema:$ref:'#/components/schemas/Workflow'# ❌ POOR - Unclear and vague/workflows/{id}:get:summary:GetworkflowoperationId:getWorkflowByIdparameters:-name:idin:pathrequired:trueschema:type:string
2. Consistency Over Convention
Consistent naming: Use same verb/noun patterns across endpoints
Consistent response structures: All errors follow the same format
Consistent parameter styles: Consistent naming for query params, paths, headers
Consistent examples: Real, working examples throughout
3. Type Safety and Precision
Every field has a type and constraints
No untyped objects or additionalProperties: true without reason
Create reusable components for pagination, errors, timestamps
Use parameter definitions for repeated parameters
Group related endpoints under the same tag
OpenAPI Structure Best Practices
Root Level Organization
openapi:3.1.0info:title:YousignAPIversion:3.0.0description:|
The Yousign document signing and workflow API.
## AuthenticationUse Bearer tokens in the Authorization header:```Authorization:Beareryour-api-token```## Rate LimitingRequestsarelimitedto100perminuteperAPItoken.contact:name:YousignSupporturl:https://support.yousign.comemail:support@yousign.comlicense:name:Proprietaryurl:https://yousign.com/legalservers:-url:https://api.yousign.com/v3description:ProductionAPI-url:https://sandbox.yousign.com/v3description:Sandboxfortestingtags:-name:Workflowsdescription:Workflowmanagementandexecution-name:Signaturesdescription:Signaturerequestsandtracking-name:Documentsdescription:Documentuploadandmanagementpaths:# ... endpoints herecomponents:# ... schemas, responses, parameters here
Endpoint Organization
paths:/workflows:get:tags: [Workflows]
summary:ListworkflowsoperationId:listWorkflowsdescription:|
Retrieves a paginated list of workflows in the authenticated user's workspace.
Results are ordered by creation date (newest first).
parameters:-$ref:'#/components/parameters/PageParam'-$ref:'#/components/parameters/LimitParam'-name:statusin:queryschema:type:stringenum: [draft, active, archived]
description:Filterbyworkflowstatusresponses:'200':$ref:'#/components/responses/WorkflowList''401':$ref:'#/components/responses/Unauthorized''403':$ref:'#/components/responses/Forbidden'post:tags: [Workflows]
summary:CreateaworkflowoperationId:createWorkflowdescription:Createsanewworkflowintheauthenticateduser'sworkspace.requestBody:required:truecontent:application/json:schema:$ref:'#/components/schemas/CreateWorkflowInput'examples:basic:summary:Basicworkflowcreationvalue:name:SalesAgreementReviewdescription:Contractreviewprocessresponses:'201':description:Workflowcreatedsuccessfullycontent:application/json:schema:$ref:'#/components/schemas/Workflow''400':$ref:'#/components/responses/ValidationError''401':$ref:'#/components/responses/Unauthorized'
Schema Design Best Practices
1. Reusable Schemas
Create base schemas that are composed into others:
components:securitySchemes:BearerAuth:type:httpscheme:bearerbearerFormat:JWTdescription:|
Authenticate using a Bearer token in the Authorization header.
Example:```Authorization:BearereyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...```security:-BearerAuth: []
# Override security for specific endpointspaths:/auth/login:post:security: [] # Public endpoint, no auth required
Best Practices Checklist
When creating or reviewing an OpenAPI spec:
Documentation
Clear, descriptive summary for every endpoint (1-2 sentences)
Detailed description explaining purpose and preconditions
Every parameter has a description
Every schema property has a description
Examples for complex request/response bodies
Structure
All endpoints grouped under logical tags
Consistent HTTP verb usage (GET, POST, PUT, DELETE, PATCH)
Consistent URL patterns (e.g., /resources/{id} for single item)
Consistent response status codes (201 for creation, 204 for deletion, etc.)
All error responses documented (400, 401, 403, 404, 500)
Type Safety
Every field has explicit type
All numeric fields have minimum/maximum or ranges
All string fields have minLength/maxLength or patterns
Enums used for finite value sets
required arrays specify mandatory fields
No type: object without properties defined
Reusability
Common schemas in components/schemas
Reusable parameters in components/parameters
Reusable responses in components/responses
Use $ref to avoid duplication
Use allOf for schema composition
Consistency
Error response format is consistent across all endpoints
Pagination structure is consistent
Timestamp format is consistent (ISO 8601)
Status codes are consistent (same codes for same situations)
Authentication method documented in securitySchemes
All endpoints specify required security
Permission requirements documented
Rate limiting documented if applicable
API Versioning
Version in URL (/v3/) or header
Breaking changes clearly documented
Deprecation notices for old endpoints
Migration guides for deprecated features
Common Mistakes to Avoid
❌ Missing Descriptions
# WRONG - No contextpaths:/workflows/{id}:get:summary:GetworkflowoperationId:getWorkflow
✅ Clear Descriptions
# GOOD - Self-documentingpaths:/workflows/{id}:get:summary:Retrieveaworkflowdescription:|
Fetches a workflow by ID with all associated metadata.
Theauthenticatedusermusthavereadaccesstotheworkflow'sworkspace.Fortemplates,thecreatorororganizationadmincanread.operationId:getWorkflow