用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ForceInjection/domain-driven-design-skills --skill openapi-design命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | openapi-design |
| description | Contract-first REST API design with OpenAPI 3.1 specification |
| allowed-tools | Read, Glob, Grep, Write, Edit, mcp__perplexity__search, mcp__context7__resolve-library-id, mcp__context7__query-docs |
Use this skill when:
Contract-first REST API design using OpenAPI 3.1 specification for consistent, well-documented APIs.
Before creating OpenAPI specifications:
docs-management skill for API design patternsRequirements → OpenAPI Spec → Review → Generate → Implement → Test
↑ ↓
←←←←←←←←←←←←← Iterate as needed ←←←←←←←←←←←←←←←←←←←←←←
openapi: 3.1.0
info:
title: Order Management API
description: |
API for managing customer orders in the e-commerce platform.
## Features
- Create and manage orders
- Track order status
- Process payments
version: 1.0.0
contact:
name: API Team
email: api-support@example.com
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: https://api.example.com/v1
description: Production
- url: https://api.staging.example.com/v1
description: Staging
- url: http://localhost:5000/v1
description: Development
tags:
-
paths:
/orders:
get:
operationId: listOrders
summary: List orders
description: Retrieve a paginated list of orders with optional filtering
tags:
- Orders
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/PageNumber'
- $ref: '#/components/parameters/PageSize'
- name: status
in: query
description: Filter by order status
schema:
$ref: '#/components/schemas/OrderStatus'
- name: customerId
in: query
description: Filter by customer ID
schema:
[]
[]
[]
[]
[]
components:
schemas:
# Enums
OrderStatus:
type: string
enum:
- draft
- submitted
- paid
- shipped
- delivered
- cancelled
description: Current status of the order
# Value Objects
Money:
type: object
required:
- amount
- currency
properties:
amount:
type: number
format: decimal
minimum: 0
example: 99.99
currency:
type: string
pattern: '^[A-Z]{3}$'
example: USD
# Entities
Order:
type: object
# Use camelCase for properties
customerId: string # ✓ Good
customer_id: string # ✗ Avoid
# Use plural for collections
/orders # ✓ Good
/order # ✗ Avoid
# Use nouns for resources
/orders # ✓ Good
/getOrders # ✗ Avoid
# Use kebab-case for multi-word paths
/line-items # ✓ Good
/lineItems # ✗ Avoid
| Method | Purpose | Idempotent | Safe |
|---|---|---|---|
| GET | Retrieve resource(s) | Yes | Yes |
| POST | Create resource | No | No |
| PUT | Replace resource | Yes | No |
| PATCH | Partial update | No* | No |
| DELETE | Remove resource | Yes | No |
| Code | Use For |
|---|---|
| 200 | Successful GET, PUT, PATCH |
| 201 | Successful POST (resource created) |
| 204 | Successful DELETE (no content) |
| 400 | Malformed request syntax |
| 401 | Authentication required |
| 403 | Authenticated but not authorized |
| 404 | Resource not found |
| 409 | Conflict (state transition, duplicate) |
| 422 | Validation error |
| 500 | Server error |
# URL Path (recommended for breaking changes)
servers:
- url: https://api.example.com/v1
# Header-based
parameters:
- name: API-Version
in: header
schema:
type: string
enum: ['2024-01-01', '2024-06-01']
# Use constraints
quantity:
type: integer
minimum: 1
maximum: 1000
email:
type: string
format: email
maxLength: 255
productCode:
type: string
pattern: '^[A-Z]{3}-\d{6}$'
# Use enums for known values
status:
type: string
enum: [draft, submitted, paid]
# Use nullable for optional fields (OpenAPI 3.1)
middleName:
type: ['string', 'null']
When designing OpenAPI contracts:
For detailed guidance:
Last Updated: 2025-12-26