一键导入
api
Design REST or GraphQL API endpoints with schemas and validation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design REST or GraphQL API endpoints with schemas and validation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Write a structured handoff at session end. Preserves context so the next agent can resume without human briefing. Invoke before ending any feature session longer than 30 minutes.
Multi-perspective code review against project standards with P1/P2/P3 severity classification. Works in Claude Code (Agent + optional GitHub MCP) and Cursor (Task subagents + gh/git). Use when the user invokes /review, asks for a PR or diff review, or wants a standards-aligned review with severity tags.
Multi-perspective code review (P1/P2/P3) for Cursor: inline checklists plus three parallel Task subagents (perf-auditor, security-reviewer, simplicity-reviewer with combined data-integrity prompt). Use when the user invokes /review, asks for a PR review, or wants repo-standard findings with severity.
Create well-formatted git commits following conventional commit standards.
Red→green→refactor discipline for new behavior — forces a failing test before implementation and a passing test before any claim of done.
Create or manage a git worktree for isolated parallel development — lets multiple agents work in the repo simultaneously without branch collisions.
| name | api |
| description | Design REST or GraphQL API endpoints with schemas and validation. |
Design REST or GraphQL API endpoints with schemas and validation.
/api <action> [resource] [--type <type>] [--methods <methods>]
action: design, scaffold, document, validateresource: Resource name (e.g., users, orders)--type: API type (rest, graphql) (default: rest)--methods: HTTP methods to include (default: all CRUD)When this skill is invoked:
Autonomy:
Quality:
/api design <resource>)Create API specification without code:
Analyze resource requirements:
Generate specification:
Output OpenAPI spec or design document
/api scaffold <resource>)Generate code for API endpoints:
prd/00_technology.md for framework patterns/api document)Generate API documentation:
/api validate)Check API against best practices:
GET /resources # List all
GET /resources/:id # Get one
POST /resources # Create
PATCH /resources/:id # Partial update
PUT /resources/:id # Full replace
DELETE /resources/:id # Delete
# Nested resources
GET /users/:id/orders # User's orders
POST /users/:id/orders # Create order for user
# Actions (when CRUD doesn't fit)
POST /orders/:id/cancel # Cancel order
POST /users/:id/verify # Verify user
/users not /user/order-items/users not /Users| Code | Meaning | When to Use |
|---|---|---|
| 200 | OK | Successful GET, PATCH, PUT |
| 201 | Created | Successful POST |
| 204 | No Content | Successful DELETE |
| 400 | Bad Request | Validation error |
| 401 | Unauthorized | Missing/invalid auth |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource doesn't exist |
| 409 | Conflict | Duplicate resource |
| 422 | Unprocessable | Business rule violation |
| 500 | Server Error | Unexpected error |
// Success (single resource)
{
"data": {
"id": "123",
"type": "user",
"attributes": { ... }
}
}
// Success (collection)
{
"data": [ ... ],
"meta": {
"total": 100,
"page": 1,
"per_page": 20
}
}
// Error
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid email format",
"details": [
{ "field": "email", "message": "Must be valid email" }
]
}
}
openapi: 3.0.3
info:
title: Resource API
version: 1.0.0
paths:
/resources:
get:
summary: List resources
parameters:
- name: page
in: query
schema:
type: integer
default: 1
- name: limit
in: query
schema:
type: integer
default: 20
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/ResourceList'
post:
summary: Create resource
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateResource'
responses:
'201':
description: Created
'400':
description: Validation error
/resources/{id}:
get:
summary: Get resource
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Success
'404':
description: Not found
$ /api design orders --type rest
Designing REST API for: orders
Resource Analysis:
- Primary entity: Order
- Related: User (owner), Items (children), Payment
- Operations: CRUD + cancel, refund
API Specification:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Endpoints
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GET /orders List orders (with filters)
GET /orders/:id Get order details
POST /orders Create new order
PATCH /orders/:id Update order
DELETE /orders/:id Delete order (soft delete)
POST /orders/:id/cancel Cancel order
POST /orders/:id/refund Request refund
GET /orders/:id/items List order items
POST /orders/:id/items Add item to order
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📝 Schemas
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Order:
id: string (uuid)
user_id: string (uuid)
status: enum [draft, pending, confirmed, shipped, delivered, cancelled]
total: number (decimal)
currency: string (ISO 4217)
items: OrderItem[]
created_at: datetime
updated_at: datetime
CreateOrder:
items: CreateOrderItem[] (required, min: 1)
shipping_address_id: string (required)
payment_method_id: string (required)
OrderItem:
id: string
product_id: string
quantity: integer (min: 1)
unit_price: number
total: number
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔒 Security
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- All endpoints require authentication
- Users can only access their own orders
- Admin role can access all orders
- Cancel/refund have time-based restrictions
Generated: openapi/orders.yaml
Next steps:
1. Review specification
2. Run `/api scaffold orders` to generate code
3. Run `/api document` to generate docs