一键导入
api-design
Design API contracts with OpenAPI specifications
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design API contracts with OpenAPI specifications
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create Architecture Decision Record
Assess architecture decisions tradeoffs and edge cases
Design database schemas with migrations and repository interfaces
Break requests into parallel tasks for team execution
Audit dependencies for vulnerabilities and plan upgrades
Structured incident investigation and resolution
| name | api-design |
| description | Design API contracts with OpenAPI specifications |
| allowed-tools | Read, Write, Glob, Grep |
Interactive workflow for designing API contracts. Produces OpenAPI 3.1 specifications and optionally generates typed client code.
Analyze the feature requirements to identify:
Output: Resource inventory table with relationships.
For each resource, design the URL following .claude/rules/api-design.md:
GET /api/v1/{resources} # List (paginated)
POST /api/v1/{resources} # Create
GET /api/v1/{resources}/{id} # Get by ID
PUT /api/v1/{resources}/{id} # Full update
PATCH /api/v1/{resources}/{id} # Partial update
DELETE /api/v1/{resources}/{id} # Delete
For nested resources: /api/v1/{parent}/{parentId}/{children}
For actions: POST /api/v1/{resources}/{id}/{action}
Output: Complete URL structure table with HTTP methods and descriptions.
For each endpoint, define:
Rules:
snake_case in JSON2024-01-15T10:30:00Z)tenant_id in response (from server context, never from request)Output: Schema definitions for all request/response types.
For each endpoint, define error responses using RFC 7807 Problem Details:
Output: Error catalog with types, status codes, and example responses.
Generate a complete OpenAPI 3.1 YAML specification file including:
Write to: docs/spec/api/openapi.yaml (or feature-specific file)
If requested, generate typed client interfaces:
TypeScript:
// Generated from OpenAPI spec
export interface User {
id: string;
tenant_id: string;
name: string;
email: string;
role: 'admin' | 'member' | 'viewer';
created_at: string;
updated_at: string;
}
export interface CreateUserInput {
name: string;
email: string;
role: 'admin' | 'member' | 'viewer';
}
Go:
type User struct {
ID uuid.UUID `json:"id"`
TenantID uuid.UUID `json:"tenant_id"`
Name string `json:"name"`
Email string `json:"email"`
Role Role `json:"role"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Present the complete API design for review:
Ask the user to confirm or request changes before generating the final spec files.